如何将 ILMerge 集成到 Visual Studio 构建过程中以合并程序集? [英] How to Integrate ILMerge into Visual Studio Build Process to Merge Assemblies?

查看:13
本文介绍了如何将 ILMerge 集成到 Visual Studio 构建过程中以合并程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个 .NET DLL 程序集和一个由 VB.NET 控制台应用程序项目引用的 C# 类库项目合并到一个命令行控制台可执行文件中.

I want to merge one .NET DLL assembly and one C# Class Library project referenced by a VB.NET Console Application project into one command-line console executable.

我可以从命令行使用 ILMerge 执行此操作,但我想将此引用程序集和项目的合并集成到 Visual Studio 项目中.从我的阅读中,我知道我可以通过 MSBuild 任务或目标来做到这一点,并将其添加到 C#/VB.NET 项目文件中,但我找不到具体的例子,因为 MSBuild 是一个很大的话题.此外,我找到了一些将 ILMerge 命令添加到 Post-build 事件的参考.

I can do this with ILMerge from the command-line, but I want to integrate this merging of reference assemblies and projects into the Visual Studio project. From my reading, I understand that I can do this through a MSBuild Task or a Target and just add it to a C#/VB.NET Project file, but I can find no specific example since MSBuild is large topic. Moreover, I find some references that add the ILMerge command to the Post-build event.

  1. 如何将 ILMerge 集成到 Visual Studio (C#/VB.NET) 项目中,这些项目只是 MSBuild 项目,以将所有引用的程序集 (copy-local=true) 合并为一个程序集?

  1. How do I integrate ILMerge into a Visual Studio (C#/VB.NET) project, which are just MSBuild projects, to merge all referenced assemblies (copy-local=true) into one assembly?

这如何与可能的 ILMerge.Targets 文件相关联?

How does this tie into a possible ILMerge.Targets file?

使用 Post-build 事件是否更好?

Is it better to use the Post-build event?

推荐答案

http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSeamlessWithILMergeAndMSBuild.aspx 演示了如何在 VisualStudio 中使用和 MSBuild.aspxa.

The article Mixing Languages in a Single Assembly in Visual Studio seamlessly with ILMerge and MSBuild at http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSeamlesslyWithILMergeAndMSBuild.aspx demonstrates how to use ILMerge and MSBuild within a Visual Studio Project.

这篇关于如何将 ILMerge 集成到 Visual Studio 构建过程中以合并程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆