是否有必要更改清单文件中的 assemblyIdentity 的版本属性?
在下面的清单中,如果在项目中指定了程序集版本(或者在我的情况下设置为一部分),是否有必要更改 assemblyIdentity 元素的 version
属性MSBuild 任务的一部分)?
根据此 Microsoft Connect 页面,看起来项目的版本号覆盖了清单的版本号。如果我错了请纠正我...
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="MyApp.exe" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
In the following manifest, is it necessary to change the version
attribute of the assemblyIdentity
element if the assembly version is specified in the project (or, in my case, set as part of a MSBuild task)?
According to this Microsoft Connect page, it looks like the project's version number overrides the manifest's version number. Please correct me if I'm wrong...
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="MyApp.exe" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
程序集信息的要点是为 Windows 及其组件唯一标识您的应用程序。这类似于 .NET 使用文件名 + 版本 + 生成的 ID + 目标处理器架构来唯一标识程序集的方式。
如果您选择不更改它,那么 Windows 组件可能不会将您的应用程序的新版本视为与旧版本的独特区别。
有关详细信息,请访问应用程序清单 MSDN 页面。
The point of the assembly information is to uniquely identify your application to Windows and it's components. This is similar to how .NET uses filename + version + ID generated + target processor arch to identify assemblies uniquely.
If you choose not to change it then Windows components may not see new versions of your application as uniquely different from old versions.
More information on the Application Manifests MSDN page.
根据 Microsoft 的文档,看来是的,必须指定确切的版本号:
本参考文献也不例外;例如,您不能使用
mmmmm.nnnnn.*.*
或类似的内容,它必须准确。我尝试加载一个较新的 DLL,但它在清单中指定了较旧的版本。此操作失败并出现以下错误:
使用 sxstrace 我可以看到详细的错误是错误:清单中找到的组件标识不匹配。
这是完整的跟踪(最后 4 行是关键部分):
因此它找到程序集并比较版本,当它们不匹配时,它会拒绝它。
Based on Microsoft's documentation, it appears that YES, the exact version number must be specified:
This reference makes no exceptions; e.g., you can't use
mmmmm.nnnnn.*.*
or something like that, it has to be exact.I have attempted to load a NEWER DLL which had an OLDER version specified in the manifest. This fails with the error:
Using sxstrace I could see the detailed error was ERROR: Component identity found in manifest does not match.
Here's the full trace (the final 4 lines are the key part):
So it finds the assembly and compares the version, and when they don't match it rejects it.