Rob
Rob

Reputation: 7217

Trying to run a .net Core HelloWorld console app on Ubuntu

I have created a simple console app in .net Core 2.1 and compiled the following output:

HelloWorld.deps.json 
HelloWorld.dll 
HelloWorld.pdb 
HelloWorld.runtimeconfig.dev.json 
HelloWorld.runtimeconfig.json

I have installed the .net Core SDK (link here: https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current)

    user1@VMLinuxTest:~/Downloads/bin$ dotnet run HelloWorld.dll

    Couldn't find a project to run. Ensure a project exists in /home/user1/Downloads/bin, 
    or pass the path to the project using --project.

I'm simply trying to run the console app using the dotnet run command. What am I doing wrong?

Upvotes: 3

Views: 4422

Answers (1)

Severin Jaeschke
Severin Jaeschke

Reputation: 671

As you can read here:

The dotnet run command is used in the context of projects, not built assemblies. If you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command. For example, to run myapp.dll, use:

dotnet myapp.dll

The dotnet run command is only used when you reference .csproj files

Upvotes: 4

Related Questions