Skip to content

Commit 6ad31bf

Browse files
committed
Use ILMerge to bundle Newtonsoft.Json DLL with exe
1 parent 9ad6f93 commit 6ad31bf

8 files changed

Lines changed: 395 additions & 1 deletion

File tree

RI Mod Manager.csproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="packages\ILMerge.3.0.41\build\ILMerge.props" Condition="Exists('packages\ILMerge.3.0.41\build\ILMerge.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -13,12 +14,14 @@
1314
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1415
<Deterministic>true</Deterministic>
1516
<TargetFrameworkProfile />
17+
<NuGetPackageImportStamp>
18+
</NuGetPackageImportStamp>
1619
</PropertyGroup>
1720
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1821
<PlatformTarget>x86</PlatformTarget>
1922
<DebugSymbols>true</DebugSymbols>
2023
<DebugType>full</DebugType>
21-
<Optimize>false</Optimize>
24+
<Optimize>true</Optimize>
2225
<OutputPath>bin\Debug\</OutputPath>
2326
<DefineConstants>DEBUG;TRACE</DefineConstants>
2427
<ErrorReport>prompt</ErrorReport>
@@ -118,4 +121,13 @@
118121
<None Include="Resources\libcurl.dll" />
119122
</ItemGroup>
120123
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
124+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
125+
<PropertyGroup>
126+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
127+
</PropertyGroup>
128+
<Error Condition="!Exists('packages\ILMerge.3.0.41\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILMerge.3.0.41\build\ILMerge.props'))" />
129+
</Target>
130+
<PropertyGroup>
131+
<PostBuildEvent>"$(SolutionDir)packages\ILMerge.3.0.41\tools\net452\ILMerge.exe" /out:"$(TargetDir)Merged.exe" "$(TargetPath)" "$(TargetDir)Newtonsoft.Json.dll"</PostBuildEvent>
132+
</PropertyGroup>
121133
</Project>

packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="ILMerge" version="3.0.41" targetFramework="net472" />
34
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
45
</packages>
18.1 KB
Binary file not shown.
338 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<PropertyGroup>
4+
<ILMergeConsolePath>$(MSBuildThisFileDirectory)..\tools\net452\ILMerge.exe</ILMergeConsolePath>
5+
</PropertyGroup>
6+
7+
</Project>

packages/ILMerge.3.0.41/docs/ilmerge-manual.md

Lines changed: 374 additions & 0 deletions
Large diffs are not rendered by default.
67.4 KB
Binary file not shown.
717 KB
Binary file not shown.

0 commit comments

Comments
 (0)