Why does my .NET app fail to start after changing the runtime version?

Asked 22 days ago Updated 21 days ago 129 views

1

You upgraded the .NET runtime on your server, but the application pool still points to the older version. The result? A crash on launch with a cryptic "Unable to find the specified file" error.

Open a command prompt and run dotnet --list-runtimes. If the version you need is missing, install it via the Microsoft Install Script or your OS package manager. Do not assume the global SDK installation covers the server runtime.

1 Answer


1

I recently bumped the target runtime for a console application from .NET 6 to .NET 8, rebuilt, and now it throws a cryptic error on launch. The process exits immediately, and the usual diagnostic output isn't showing up. Has anyone run into this before?

The first thing I checked was whether the runtime was actually installed. I ran dotnet --list-runtimes and .NET 8 showed up fine. Next, I verified the TargetFramework in the project file matched what I expected, and I double-checked that there were no lingering appsettings.Development.json overrides pointing to an older SDK.

What usually trips this up is a mismatch between the runtime and the SDK, or the app relying on a native dependency that was compiled against a different ABI. If you have any C++/CLI wrappers, third-party native DLLs, or even certain NuGet packages with native assets, they can refuse to load under a newer runtime. Another common culprit is the Microsoft.AspNetCore.App shared framework version drifting out of sync with your target.

A quick way to narrow it down is to run the app under a debugger or with dotnet run --verbosity diagnostic. If you see a BadImageFormatException or a failure to load a specific assembly, that usually points to an architecture or version mismatch rather than a pure configuration issue.

If you're still stuck, paste the exact exception and the contents of your .csproj here. It might also help to confirm whether you're using a self-contained deployment or relying on the shared runtime on the target machine.

Write Your Answer