Tuesday, September 24, 2019

How to create a single self-contained exe using dotNET core 3.0


Once you converted your project into new .csproj format you can copy these lines into your Visual Studio project file. This exe is total self contained. 

Published trim, new feature trims out all assemblies from .Net Core to shrink the exe. But this is still experimental feature, it can trim to much out. 


1
2
3
4
5
<PropertyGroup>
 <PublishSingleFile>true</PublishSingleFile>
 <RuntimeIdentifier>win-x64<RuntimeIdentifier>
 <PublishTrimmed>true</PublishTrimmed>
<PropertyGroup>

Here's the .NET Conf 2019 (Sept 23, 2019) talking point about single exe feature

No comments:

Post a Comment