0

.net 5 とビジュアル スタジオ コードを使用して最初の helloword アプリを実行しようとしています。

dnvm list を入力すると、次のようになります。

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-beta4       clr     x64          win
       1.0.0-beta4       clr     x86          win
       1.0.0-beta4       coreclr x64          win
       1.0.0-beta4       coreclr x86          win
       1.0.0-beta4-11566 clr     x64          win
       1.0.0-beta4-11566 clr     x86          win
       1.0.0-beta4-11566 coreclr x64          win
       1.0.0-beta5       clr     x86          win
       1.0.0-beta5       coreclr x86          win
  *    1.0.0-rc1-update1 clr     x64          win             default
       1.0.0-rc1-update1 clr     x86          win
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win

そして、私の project.json は単純です:

{
    "frameworks": {
        "dnx451":{}
    }
}

しかし、フォルダーで DNX RUN を使用してアプリを実行すると、このエラーが発生します

System.InvalidOperationException: The current runtime target framework is not compatible with 'HelloWorld'.
Current runtime target framework: 'DNXCore,Version=v5.0 (dnxcore50)'
 Version:      1.0.0-rc1-16231
 Type:         CoreClr
 Architecture: x64
 OS Name:      Windows
 OS Version:   10.0
 Runtime Id:   win10-x64

Please make sure the runtime matches a framework specified in project.json
   at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicationName)
   at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, String appBase, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, BootstrapperContext bootstrapperContext)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, BootstrapperContext bootstrapperContext)

d:\P\HelloWorld>
4

1 に答える 1

0

新しいコンソール コマンドで dnx run を使用してプログラムを実行すると、動作しません。ただし、dnvm use コマンドを使用した vs 2015 コマンド プロンプトで dnx run を使用してプログラムを実行すると、完全に正常に動作します。

デフォルトでアクティブなフレームワークが clr のみの場合でも、2 番目のコマンド プロンプトで coreclr を使用しようとするため、-p 永続パラメーターを指定した dnvm の使用が正しく機能していないように見えます。

そしてYeomanに答えるために、project.jsonはまったく問題ありません。実行するために何も変更しませんでした

于 2016-01-10T18:36:40.507 に答える