Visual Studio 应用程序资源:“图标和清单” vs “资源文件”问题
在 Visual Studio 2010 中,应用程序属性页面上有两个与资源相关的选项:
- 图标和清单
- 资源文件
我一直在使用资源文件方法,因为它是实现我的构建要求之一的唯一方法。
但是,我最近注意到一个问题。
当您在 Windows 资源管理器中右键单击 EXE 文件,单击属性,然后转到详细信息选项卡时,它会显示几条信息(文件描述、产品名称、产品版本等)。
当我使用 构建我的应用程序时图标和清单,我在 Visual Studio 中输入的所有程序集信息都用于填充这些信息字段。
但是当我使用资源文件构建时(正如我所做的那样),这些字段不会被填充。它们是空白的。
有人可以帮忙吗?
- 我做错了什么吗?是否应该将此信息添加到我的自定义资源文件中? (我一直在寻找这种可能性,但没有运气)
- 是否有其他方法来填充这些信息?
- 我必须返回到图标和清单方法吗? (这样的话我就得重新考虑一些其他问题了)
In Visual Studio 2010, there are two options on the Application properties page regarding Resources:
- Icon and manifest
- Resource file
I have been using the Resource file approach, because it is the only way to achieve one of my build requirements.
But, I've recently noticed a problem.
When you right click on an EXE file in Windows Explorer, click properties, and go to the details tab, it shows several pieces of information (file description, product name, product version, etc.)
When I build my app using Icon and manifest, all the assembly information that I enter in Visual Studio is used to populate these information fields.
But when I build using Resource file (as I am doing), these fields are NOT populated. They are blank.
Can anyone help?
- Is there something I'm doing wrong? Should this information be added to my custom resource file? (I've been searching this possibility with no luck)
- Is there another way to populate this information?
- Must I just go back to the Icon and manifest method? (In which case I'll have to re-think some other issues)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚有同样的问题,发现这些信息很有帮助。
通过选择 .res 文件,您基本上就表示您将自己处理所有 win32 资源。这意味着您必须在 .res 文件中包含清单资源和版本资源。如果您选择自己添加 win32 资源,则标准 AssemblyVersion、AssemblyProductVersion 属性无效。
我在 Einar Egilsson 的博客,他在其中讨论了图标和清单与资源方法的一些优缺点。
基本上,如果您选择使用资源方法,则必须在 .rc 资源源文件中提供您自己的 VERSIONINFO。将 .rc 文件编译为 .res 文件并链接应用程序后,您将看到可执行文件的属性现在显示 .rc 文件提供的版本信息。
这对于@Ross 来说可能有点晚了,但希望这对其他人有帮助。
I just had the same question and found this information helpful.
By selecting a .res file you've basically said that you are going to handle all win32 resources yourself. That means that you have to include a manifest resource and a Version resource in your .res file. The standard AssemblyVersion, AssemblyProductVersion attributes have no effect if you've selected that you'll add win32 resources yourself.
I found this at Einar Egilsson's blog where he discusses some of the pros and cons of the Icon and Manifest versus Resource approach.
Basically, if you choose to use the Resource approach, you must provide your own VERSIONINFO in your .rc resource source file. After compiling the .rc file into a .res file and linking your application, you will see the executable's properties now show the Version information supplied by the .rc file.
This might be a little late for @Ross, but hopefully this helps someone else.