2016-06-14 33 views
0

ASP.NET Core RC2をインストールしたMacでASP.NET Core RC2プロジェクトをコンパイルしようとしています。これは私のproject.jsonです:アセンブリ 'mscorlib、Version = 4.0.0.0への参照をMacに追加する必要があります

{ 
    "userSecretsId": "aspnet-TestCoreRC2-6a20d1d3-f55a-4683-a8ca-5f5fbff19ab4", 

    "dependencies": { 

    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Razor.Tools": { 
     "version": "1.0.0-preview1-final", 
     "type": "build" 
    }, 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final", 
    "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-final", 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "version": "1.0.0-preview1-final", 
     "type": "build" 
    }, 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final", 
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { 
     "version": "1.0.0-preview1-final", 
     "type": "build" 
    }, 
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": { 
     "version": "1.0.0-preview1-final", 
     "type": "build" 
    } 
    }, 

    "tools": { 
    "Microsoft.AspNetCore.Razor.Tools": { 
     "version": "1.0.0-preview1-final", 
     "imports": "portable-net45+win8+dnxcore50" 
    }, 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": { 
     "version": "1.0.0-preview1-final", 
     "imports": "portable-net45+win8+dnxcore50" 
    }, 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "version": "1.0.0-preview1-final", 
     "imports": [ 
     "portable-net45+win8+dnxcore50", 
     "portable-net45+win8" 
     ] 
    }, 
    "Microsoft.Extensions.SecretManager.Tools": { 
     "version": "1.0.0-preview1-final", 
     "imports": "portable-net45+win8+dnxcore50" 
    }, 
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { 
     "version": "1.0.0-preview1-final", 
     "imports": [ 
     "portable-net45+win8+dnxcore50", 
     "portable-net45+win8" 
     ] 
    } 
    }, 

    "frameworks": { 
    "net451": { 
     "dependencies": { 
     "System.Runtime": "4.0.20" 
     } 
    } 

    }, 

    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 

    "runtimeOptions": { 
    "gcServer": true 
    }, 

    "publishOptions": { 
    "include": [ 
     "wwwroot", 
     "Views", 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 

    "scripts": { 
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ], 
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 
    }, 

    "tooling": { 
    "defaultNamespace": "TestCoreRC2" 
    } 
} 

これはエラーです:私もmscorlibを参照の同様の問題に直面していた

An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.

Generated Code

Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference? public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage Predefined type 'System.Boolean' is not defined or imported public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

おかげ

+0

バグかもしれませんか? https://github.com/dotnet/roslyn/issues/11908 – chemitaxis

答えて

2

here

Asp.Netコアは現在、モノラルnet451の下でうまく動作しませんが、それがうまくいくかもしれないという可能性があるがあります。

提供されているリンクの回避方法に従ってください。

+0

私はそれを信じることができません...私はプロジェクトを作成しようとすると、まず、エラー、ブーム...マイクロソフトのチームに何が起こったの??? – chemitaxis

+1

それは良い質問です。答えはスティーブ・バルマーが起こったことです。それは、彼らが良い古くからのBallmerが.netのプロジェクト全体を殺害した時代に戻ってくると思います。そして彼らは、彼らのバカはBallmerのやり方と比較しても、そしてゴミを放棄するように進んでいないことを理解しています。スティーブは開発者を喜んで裏切ることに彼らを脱感させた。 – sigsegv

+0

申し訳ありませんが、解決策を理解できませんでした。ここで要約してください。 –

1

"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027"を追加して解決しました。このパッケージは、mscorlibを対象としたPCLの依存関係を解決します。詳細はhere

編集 はちょうど今、私はあなたがMac上でnet451をターゲットにしている見ています。クロスプラットフォームをサポートするには、 "netcoreapp1.0":{}に切り替える必要があります。 project.jsonに次の変更を作ってみましょう:

"dependencies": { 
"Microsoft.NETCore.App": { 
    "version": "1.0.0", 
    "type": "platform" 
}, 
//other dependencies 
}, 
"frameworks": { 
    "netcoreapp1.0": {} 
}, 
//Other configs 
+0

Nop、同じエラー... – chemitaxis

+0

この参照はどこに入れましたか?ありがとう! – chemitaxis

+0

project.jsonの依存関係がありません。それは 'mscorlib'エラーを解決しました。 –

関連する問題