Created
January 29, 2019 20:31
-
-
Save patrykbuzowicz/29437bcc2996dd03909ae6b77d668d5b to your computer and use it in GitHub Desktop.
Merges the output exe and all dlls into a single exe. Places a new $(ProjectName).Merged.exe binary in the /bin/Release/net461 output directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net461</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Autofac" Version="4.8.1" /> | |
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> | |
</ItemGroup> | |
<Target Name="RemovePdbs" Condition=" '$(Configuration)' == 'Release' " AfterTargets="PostBuildEvent"> | |
<ItemGroup> | |
<PdbFiles Include="$(OutDir)%(DestinationSubDirectory)\*.pdb" /> | |
</ItemGroup> | |
<Message Importance="high" Text="Cleaning PDB files..." /> | |
<Delete Files="@(PdbFiles)" /> | |
</Target> | |
<Target Name="ILMerge" Condition=" '$(Configuration)' == 'Release' " AfterTargets="RemovePdbs"> | |
<PropertyGroup> | |
<ExeToMerge>$(OutDir)$(MSBuildProjectName).exe</ExeToMerge> | |
</PropertyGroup> | |
<ItemGroup> | |
<DllsToMerge Include="$(OutDir)%(DestinationSubDirectory)\*.dll" /> | |
</ItemGroup> | |
<Message Importance="high" Text="Executing ILMerge..." /> | |
<Exec Command=""$(SolutionDir)lib\ILMerge.exe" /out:"$(OutDir)$(MSBuildProjectName).Merged.exe" "$(ExeToMerge)" @(DllsToMerge->'"%(FullPath)"', ' ')" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment