Home » dotnet » dotnet run – dotnet : Couldn’t find a project to run. Ensure a project exists in…

dotnet run – dotnet : Couldn’t find a project to run. Ensure a project exists in…

I need to test a .Net core project as if it was deployed to production, so in order to do that I need to set the environment variable to production. According to the docs you should be able to that by typing this at the cmd prompt:

set ASPNETCORE_ENVIRONMENT=Production
dotnet run --no-launch-profile

However on doing so I get an error message which says something like:

dotnet : Couldn’t find a project to run. Ensure a project exists in C:\Users\echristy\Repos\WebAPI, or pass the path to the project using –project.

As the instructions say, typing this seems to wokr:

dotnet run --project name-of-project-here

If you aren’t sure of the name of your project, right click on the project name in the solution explorer, and select Properties (it’s the last option in the long list on my PC). When the Properties window opens you can copy the value from the Assembly name textbox and use that in the command.

The dotnet run command is used in the context of projects, so if you are trying to run an application dll instead you can simply type this instead:

dotnet yourprojectname.dll