question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet run after project migration crashes dotnet

See original GitHub issue

Steps to reproduce

  1. Install d15prerel\26130.0 with no workloads
  2. Install dotnet cli
  3. Download and extract Bala’s test repo
  4. In a prompt navigate to \ProjectKTestProjects-master\Dev14_K101\Tooling202\ConsoleAppOnCore_1
  5. dotnet migrate
  6. dotnet restore - dotnet build - dotnet run

Expected behavior

The project starts running

Actual behavior

dotnet crashes

C:\Users\v-sccarl\Documents\ProjectKTestProjects-master\Dev14_K101\Tooling202\AspNetCoreWeb_IndAuth_WithAI_1>dotnet run

Unhandled Exception: System.InvalidOperationException: Couldn't find a project to run. Ensure a project exists in  C:\Users\v-sccarl\Documents\ProjectKTestProjects-master\Dev14_K101\Tooling202\AspNetCoreWeb_IndAuth_WithAI_1.
Or pass the path to the project using --project
   at Microsoft.DotNet.Tools.Run.RunCommand.Initialize()
   at Microsoft.DotNet.Tools.Run.RunCommand.Start()
   at Microsoft.DotNet.Tools.Run.RunCommand.<>c__DisplayClass0_0.<Run>b__0()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.DotNet.Tools.Run.RunCommand.Run(String[] args)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004707)

Product Information:
 Version:            1.0.0-rc4-004707
 Commit SHA-1 hash:  5aded80a7b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0-rc4-004707

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
livarcocccommented, Apr 12, 2017

To run a published app you don’t use dotnet run. Dotnet run is a development tool and you need to use it by specifying a csproj or by running it from a folder containing a csproj.

For published apps, if it is a portable app, you run it by doing dotnet <path_to_your_app_dll>. Or, if it is a self-contained app, you simply invoke <your_app>.[exe].

1reaction
katebutenkocommented, Apr 14, 2017

@livarcocc thanks for explanation, saved me from banging my head against the wall too much.

Just in case someone comes across this thread looking for an answer how to make it run on Azure App (and have limited ability to test publish before production publish). Correct me if I’m wrong, cause I kinda figured this out.

When you publish to Azure, you don’t need to run anything, if you have this line in web.config:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

Upon publish, this line gets replaced with:

<aspNetCore processPath="dotnet" arguments=".\NameOfYourMainDLL.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

And in this way Azure webserver knows what to run when you request the website. Basically it becomes equivalent to running “dotnet NameOfYourMainDLL.dll” in console when you test publish locally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"dotnet has stopped working" StackOverflowException ...
I'm having a really annoying issue where every time I try to add a migration to my project, dotnet crashes and the migration...
Read more >
NET applications crash at startup - .NET Framework
A user starts a .NET application. However, the application crashes at startup if the user.config file is corrupt. The application works fine ...
Read more >
Visual Studio crashes when opening .net core solution ...
When monitoring the Task Manager, it seems that the crash occurs when MSBUILD is being executed. FYI: I'm trying to open this github...
Read more >
VS2022 debugger crash with error Failed to read ...
I Have created a WPF App .NET Framework. Every time i try to debug, vs is crashing and I have all these event...
Read more >
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found