C# WPF 将 DLL 和 .exe 合并到一个文件
C# WPF Merge DLL and .exe to one file
我在将 DLL 和 .exe 合并到一个文件时遇到了问题。
我试过使用 this 教程,但我不明白我应该在哪里添加这段代码:
<Target Name="AfterResolveReferences">
<ItemGroup>
<EmbeddedResource Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'">
<LogicalName>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
谢谢!
在大多数(所有?)C# 项目文件 (.csproj
) 中,底部附近有一行:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
博客 post 说您应该在项目文件的该行之后插入新行。您将需要使用文本编辑器来执行此操作:无法使用 Visual Studio UI.
更改项目文件的该部分
我在将 DLL 和 .exe 合并到一个文件时遇到了问题。
我试过使用 this 教程,但我不明白我应该在哪里添加这段代码:
<Target Name="AfterResolveReferences">
<ItemGroup>
<EmbeddedResource Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'">
<LogicalName>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
谢谢!
在大多数(所有?)C# 项目文件 (.csproj
) 中,底部附近有一行:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
博客 post 说您应该在项目文件的该行之后插入新行。您将需要使用文本编辑器来执行此操作:无法使用 Visual Studio UI.
更改项目文件的该部分