.NET Core console app fails to run on Windows Server [duplicate] .NET Core console app fails to run on Windows Server [duplicate] windows windows

.NET Core console app fails to run on Windows Server [duplicate]


The Publish command is one of the rare cases where Microsoft tools do what they claim to do—namely, publish the application to a specified location.

The files under the bin/release are compilation artifacts with local dependencies. Your server can't find the dependencies because those files are meant to be executed on your development machine. Those dependencies can be located in a variety of places and the compiler consolidates them in release folder.

The files under Publish are built for deployment, and depending on your publish settings, can be self-contained (default) or framework-dependent. You should copy the Publish folder's contents (or the entire folder) to your final deployment path. If you want to publish your application as framework-dependent, then modify your publish command like so:

dotnet publish -c Release -r win10-x64 --self-contained false

You can also add the -o flag to specify a deployment path.