I am having trouble running a simple console test app using the dnx command line. I know this is an evolving technology at the moment but I would like to get this going for my own sanity.
Here is the program:
using System;
public class Program
{
public void Main(string[] args)
{
Console.WriteLine("Foo");
Console.ReadLine();
}
}
This is the DNVM List
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
This is the 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"
}
}
This is the result of 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
Here is where I am confused becuase some of the older videos I have seen are now obsolete and I am not sure where to look to find how what has changed.
I am expecting that dnx ConsoleApp me
will run my program but it sadly it does not.
Error:
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)
You have it configured wrong. I guess what you want to have is the below one inside the project.json file:
{
"frameworks": {
"dnx451" : {
}
"dnxcore50" : {
"dependencies": {
"System.Console": "4.0.0-beta-*"
}
}
},
"commands": {
"me": "run"
}
}
Now run:
dnu restore
dnx . me
It should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With