- Nuget 下载ILMerge
- 两个工程
dog为测试工程
TestIlmerge为准备合并的类库
- 如下图所示,
由于我们引用下面4个库
正常生成后,会有TestIlmerge.dll和下面的这4个dll
- 只生成TestIlmerge.dll
打开工程文件
在最下方加入以下两段
<Target Name="ILMerge">
<Exec Command="$(ILMergeConsolePath) bin\Debug\TestIlmerge.dll /out:bin\Debug\TestIlmerge.dll bin\Debug\Newtonsoft.Json.dll bin\Debug\Emgu.CV.World.dll bin\Debug\Emgu.CV.UI.dll bin\Debug\ZedGraph.dll" />
</Target>
<Target Name="_ProjectRemoveDependencyFiles" AfterTargets="AfterBuild" DependsOnTargets="ILMerge">
<ItemGroup>
<_ProjectDependencyFile Include="bin\Debug\Newtonsoft.Json.dll" />
<_ProjectDependencyFile Include="bin\Debug\Emgu.CV.World.dll" />
<_ProjectDependencyFile Include="bin\Debug\Emgu.CV.UI.dll" />
<_ProjectDependencyFile Include="bin\Debug\ZedGraph.dll" />
</ItemGroup>
<Delete Files="@(_ProjectDependencyFile)" />
</Target>
- 点击生成即可