我遇到了一些困难,无法使用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
这是项目的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)
dnx me
而不是dnx . me
。 - pg0xC