我正在尝试使用 .net 5 和 Visual Studio 代码运行第一个 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>