Search code examples
.net-coreconsole-applicationdesktop-application

.net core 2.0 console app : exe file location


I am working with .net core 2.0 console application. I need to run this console app using command prompt.

Like, MyApp.exe arguments

I published the console app using below command to generate .exe :

dotnet publish -c Release -r win10-x64

It creates multiple .exe file,

1) \bin\Release\netcoreapp2.0\win10-x64
2) \bin\Release\netcoreapp2.0\win10-x64\publish

I believe both are same and I can use (2) as published version of the app. Correct me if wrong. I am not sure why it generates .exe at (1) and does not contain bunch of dlls at there. What is the difference?

anyone can give me more information about this?


Solution

  • The first one is still a framework-dependent deployment, it used when you call dotnet run -r win-x64. It resolves and configures the shared framework via the information in .runtimeconfig.json and your PATH environment variable and locates the DLLs via a values in the .runtimeconfig.dev.json and .deps.json based on your global packages cache (=> specific to your machine and user).

    For deploying self-contained applications, the publish folder contains all the necessary assets. The host uses the local dlls instead of the shared framework and as well as the necessary DLLs.