2016-10-08 7 views
1

私は非コアプロジェクトをとり、.netコアに転送しようとしています。それを初めて使ったのです。古いコードで実行する.netcoreプロジェクトを取得する

私のファイルは次のようになりますので、私は、正規表現クラスを使用するファイルを持っている:

using System; 
using System.Security.Cryptography; 
using System.Collections.Generic; 
using System.Text; 
using System.Text.RegularExpressions; 

が、私はエラーに

「エラーCS0234型または名前空間名を取得しています'RegularExpressions'は が名前空間 'System.Text'に存在しません(アセンブリがありません 参照)?FantasySports.Server.NET Platform 5.4 "

project.jsonファイルは、私がNuGetからSystem.Text.RegularExpressionsパッケージを追加しようとしたが、私はまだ同じエラーを取得し、この

"frameworks": { 
"net451": { }, 
"net452": { }, 
"net46": { }, 
"dotnet5.4": { 
    "dependencies": { 
    "Microsoft.CSharp": "4.0.1-beta-23516", 
    "System.Collections": "4.0.11-beta-23516", 
    "System.Linq": "4.0.1-beta-23516", 
    "System.Runtime": "4.0.21-beta-23516", 
    "System.Threading": "4.0.11-beta-23516", 
    "Microsoft.AspNet.WebApi.Client": "5.2.2-rc", 
    "System.Runtime.Serialization.Xml": "4.1.0-beta-23516", 
    "System.Text.RegularExpressions": "4.1.0" 
    } 
} 

}

のように見えます。また、このファイルのフレームワークを4.5.1から4.5に変更しようとしましたが、まだ動作していません。私がやっていることを本当に確信していない。

+0

私の回答は役に立ちましたか? – mybirthname

答えて

0

私は、この構成を有している:

"Microsoft.NETCore.App": { 
    "version": "1.0.1", 
    "type": "platform" 
}, 



    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ 
     "dotnet5.6", 
     "portable-net45+win8" 
     ] 
    } 
    }, 

正規表現は、コントローラで正常に動作しています。インポート配列にdotnet5.6portable-net45+win8(またはwin7)を入れる必要があります。

using System.Text.RegularExpressions; 

    public IActionResult About() 
    { 
     ViewData["Message"] = "Your application description page."; 

     Regex regex = new Regex(@"\d+"); 
     Match match = regex.Match("Dot 55 Perls"); 

     return View(); 
    } 
関連する問題