自动嵌入在.NET可执行多个图标多个、可执行、图标、NET

2023-09-02 21:48:45 作者:゜浅夕

我基本上有相同的问题,因为这个问题:嵌入WPF EXE多个图标

I basically have the same issue as this question: Embed multiple icons in WPF EXE

我的.NET 2.0 WinForms应用程序目前有这样当您单击更改图标,在资源管理器:

My .NET 2.0 WinForms application currently has this when you click "Change Icon" in explorer:

我想看看,并与一些黑客有关的建议在上述文章中,我得到这个方式:

What I would like to see, and with some hacking about as suggested by the above article I get this:

但到达那里所有的版本信息组装的过程中丢失。我需要保持的版本信息中的装配为我自动更新过程依赖于这个标识安装的应用程序版本。

However the process of getting there all of the version information for the assembly is lost. I need to maintain the Version Information in the assembly as my auto-update process relies on this to identify the installed version of the application.

我还通过构建一个持续集成过程中的应用,所以我会preFER不要有需要人工干预的任何步骤,所以这是可能以自动化的方式?

I also build the application through a continuous integration process so I would prefer not to have any steps that require manual intervention, so is this possible in an automated way?

推荐答案

我刚刚创建了一个简单的工具做正是这一点,而不必惹的.res文件。这是一个很小的工具,它可以为您生成后事件的一部分使用,并且可以在一个特定的文件夹中添加的所有图标文件到您的程序集。如果我们假设你有一个图标在您的主项目文件夹,文件夹,你可以添加以下生成后事件:

I've just created a simple tool to do exactly this without having to mess with .res files. It is a tiny utility which you can use as part of your Post-Build event and lets you add all icon files in a particular folder to your assembly. If we assume that you have a icons folder under your main project folder you can add the following post-build event:

C:pathtoInsertIcons.exe $(TargetPath) $(ProjectDir)icons

一个进一步的说明和下载可以在http://einaregilsson.com/add-multiple-icons-to-a-dotnet-application/

A further description and a download can be found at http://einaregilsson.com/add-multiple-icons-to-a-dotnet-application/