Skip to content

Instantly share code, notes, and snippets.

@whb07
Created February 27, 2022 20:55
Show Gist options
  • Save whb07/ecdf7c4770bef85f30335d03af749391 to your computer and use it in GitHub Desktop.
Save whb07/ecdf7c4770bef85f30335d03af749391 to your computer and use it in GitHub Desktop.
Creating a single executable file for .net framework
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ilmerge" Version="3.0.41" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
<Target Name="ILMerge">
<!-- the ILMergePath property points to the location of ILMerge.exe console application -->
<Exec Command="$(ILMergeConsolePath) /out:$(ProjectDir)\path_to_save\$(TargetFileName) $(ProjectDir)\bin\Release\net472\$(TargetFileName) ^
$(ProjectDir)\bin\Release\net472\*.dll ^
/wildcards" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment