我无法使用 dnx 命令行运行简单的控制台测试应用程序。我知道目前这是一项不断发展的技术,但为了我自己的理智,我想让它继续下去。
这是程序:
using System;
public class Program
{
public void Main(string[] args)
{
Console.WriteLine("Foo");
Console.ReadLine();
}
}
这是 DNVM 列表
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
* 1.0.0-beta4 clr x64 C:\Users\Tim\.dnx\runtimes
1.0.0-beta4 clr x86 C:\Users\Tim\.dnx\runtimes
1.0.0-beta4 coreclr x64 C:\Users\Tim\.dnx\runtimes
1.0.0-beta4 coreclr x86 C:\Users\Tim\.dnx\runtimes
这是 project.json
{
"frameworks": {
"aspnet50":{}
},
"dnxcore50" : {
"dependencies": {
"System.Console": "4.0.0-*",
"System.Collections": "4.0.10-*",
"System.Linq": "4.0.0-*",
"System.Threading": "4.0.10-*",
"Microsoft.CSharp": "4.0.0-*"
}
},
"commands": {
"me": "Program"
}
}
这是结果dnu build ConsoleApp
Building ConsoleApp for Asp.Net,Version=v5.0
Using Project dependency ConsoleApp 1.0.0
Source: C:\_Git\learndnx\ConsoleApp\project.json
Using Assembly dependency framework/mscorlib 4.0.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
Using Assembly dependency framework/System 4.0.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll
Using Assembly dependency framework/System.Core 4.0.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Core.dll
Using Assembly dependency framework/Microsoft.CSharp 4.0.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Microsoft.CSharp.dll
Build succeeded.
0 Warnings(s)
0 Error(s)
Time elapsed 00:00:00.3038706
这是我感到困惑的地方,因为我看过的一些较旧的视频现在已经过时了,我不知道在哪里可以找到发生了什么变化。
我期待dnx ConsoleApp me
它将运行我的程序,但遗憾的是它没有。
错误:
System.InvalidOperationException: Unable to load application or execute command 'Program'. Available commands: me.
at Microsoft.Framework.ApplicationHost.Program.ThrowEntryPointNotfoundException(DefaultHost host, String applicationN
ame, Exception innerException)
at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)