Reputation: 227
When you publish a .NET Core self-contained app right now, your exe is in the middle of a few dozen .NET Core runtime libraries, along with all the Nuget packages.
MyApp/
--ct/
--de/
--es/
...
--zh-Hant/
--Accessibility.dll
--api-ms-win-core-console.dll
... A dozen other .dlls
--MyApp.dll
--MyApp.exe
... Even more .dlls
I would like to set up publish so that these files are organized, like such
MyApp/
--netcoreapp3.0/
--nuget/
--MyApp.dll
--MyApp.exe
or even
MyApp.exe
MyApp/
--netcoreapp3.0/
--nuget/
--MyApp.dll
Alternatively, maybe there could be a way to change the directory of framework libraries in the .csproj <TargetFramework>
tag? That way, I could use the framework-dependent publishing option and remove all the duplicate files.
Upvotes: 2
Views: 864
Reputation: 2273
If there is no constraint to use the framework-dependent publishing option you can publish with the PublishSingleFile
option being true
.
Your publish command would be
dotnet publish -c Release -r win-x64 /p:PublishSingleFile=true
Then in your publish folder you will find a "cleaner" result of an executable file, and some configuration files only (like appsettings.json or web.config). No nuget or runtime dlls.
Upvotes: 1