简体   繁体   English

AssemblyInfo.cs中的文件版本未反映在Windows资源管理器文件属性中?

[英]File version in AssemblyInfo.cs not reflected in Windows Explorer File Properties?

I've got a VS2010 project that contains an AssemblyInfo.cs file. 我有一个包含AssemblyInfo.cs文件的VS2010项目。 This has: 这有:

[assembly: AssemblyFileVersion("10.0.1.0")]

When I run my app and ask for the file version from the executing assembly it picks up 10.0.1 no problem. 当我运行我的应用程序并从执行程序集中请求文件版本时,它会选择10.0.1没问题。 However, if I right-click on the .exe file in Windows Explorer and open the properties dialog - the Details tab shows a File Version of 10.0.0.0(!) 但是,如果我在Windows资源管理器中右键单击.exe文件并打开属性对话框 - “详细信息”选项卡显示文件版本10.0.0.0(!)

Why doesn't Windows see 10.0.1 for the file version? 为什么Windows没有看到10.0.1的文件版本? I must be missing something... 我肯定错过了什么...

Additional info: If I add a Version Resource to my app's .res file then the information shows up in the compiled executable, but if I don't have the info in the Version Resource the compiled exe ignores the file and "informational" (ie Product) version attributes in AssemblyInfo.cs. 附加信息:如果我将版本资源添加到我的应用程序的.res文件中,则信息显示在已编译的可执行文件中,但如果我在版本资源中没有信息,则编译的exe会忽略该文件并“信息”(即AssemblyInfo.cs中的Product)版本属性。

Do you have, by any chance a .RC or .RES file included in your project that contains a Version-Resource Definition? 您是否有任何机会包含项目中包含版本资源定义的.RC或.RES文件? Maybe a custom build target or script adds it? 也许自定义构建目标或脚本会添加它? If that is the case, it would be picked up instead of the version defined in AssemblyVersion.cs (at least that is what Michael Kaplan says here ). 如果是这种情况,它将被取而代之而不是AssemblyVersion.cs中定义的版本(至少这是Michael Kaplan 在这里所说的)。

In that article series he also shows that the version information from a ".MUI" file could overlay the version information from the actual EXE file - although, if I understand that correctly, is only an "issue" with native/unmanaged builds. 在该系列文章中,他还展示了来自“.MUI”文件的版本信息可以覆盖来自实际EXE文件的版本信息 - 但是,如果我理解正确,那只是本机/非托管版本的“问题”。

I am on VS2008 for SmartDevice development. 我在VS2008上进行SmartDevice开发。 After changing the version number in AssemblyInfo.cs to "2.1.*" , I found it impossible to revert the change. 将AssemblyInfo.cs中的版本号更改为“2.1。*”后,我发现无法还原更改。 No matter what I do. 不管我做什么。

After removing the <project_name>.suo , bin/ * , obj/ * , cleaning/rebuilding in release, debug mode, nothing seems to make any difference. 在发布,调试模式中删除<project_name>.suobin/ *obj/ * ,清理/重建后,似乎没有任何区别。

Finally I uninstall the app from CE device first, and retried again. 最后,我首先从CE设备卸载应用程序,然后重新尝试。 This time, Assembly.GetExecutingAssembly().GetName().Version starts to report the correct version. 这次, Assembly.GetExecutingAssembly().GetName().Version开始报告正确的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM