是否有必要更改清单文件中的 assemblyIdentity 的版本属性?

发布于 2024-09-12 00:46:05 字数 1157 浏览 2 评论 0原文

在下面的清单中,如果在项目中指定了程序集版本(或者在我的情况下设置为一部分),是否有必要更改 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝礼 2024-09-19 00:46:05

程序集信息的要点是为 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.

滥情稳全场 2024-09-19 00:46:05

根据 Microsoft 的文档,看来是的,必须指定确切的版本号:

汇编版本

2021年1月7日

版本必须在assembleIdentity元素中指定
体现出来。使用四部分版本格式:mmmmm.nnnnn.ooooo.ppppp

本参考文献也不例外;例如,您不能使用 mmmmm.nnnnn.*.* 或类似的内容,它必须准确。


我尝试加载一个较新的 DLL,但它在清单中指定了较旧的版本。此操作失败并出现以下错误:

“应用程序无法启动,因为它并排
配置不正确”

使用 sxstrace 我可以看到详细的错误是错误:清单中找到的组件标识不匹配

这是完整的跟踪(最后 4 行是关键部分):

    INFO: Resolving reference SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.21177".
        INFO: Resolving reference for ProcessorArchitecture msil.
            INFO: Resolving reference for culture Neutral.
                INFO: Applying Binding Policy.
                    INFO: No binding policy redirect found.
                INFO: Begin assembly probing.
                    INFO: Did not find the assembly in WinSxS.
                    INFO: Attempt to probe manifest at C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
                    INFO: Manifest found at C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
                INFO: End assembly probing.

    INFO: Parsing Manifest File C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
        INFO: Manifest Definition Identity is SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.30356".
        ERROR: Component identity found in manifest does not match the identity of the component requested. 
           Reference is SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.21177". 
           Definition   SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.30356".
    ERROR: Activation Context generation failed.

因此它找到程序集并比较版本,当它们不匹配时,它会拒绝它。

Based on Microsoft's documentation, it appears that YES, the exact version number must be specified:

Assembly Versions

01/07/2021

The version must be specified in assemblyIdentity elements of
manifests. Use the four-part version format: mmmmm.nnnnn.ooooo.ppppp.

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:

"The application has failed to start because its side-by-side
configuration is incorrect"

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):

    INFO: Resolving reference SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.21177".
        INFO: Resolving reference for ProcessorArchitecture msil.
            INFO: Resolving reference for culture Neutral.
                INFO: Applying Binding Policy.
                    INFO: No binding policy redirect found.
                INFO: Begin assembly probing.
                    INFO: Did not find the assembly in WinSxS.
                    INFO: Attempt to probe manifest at C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
                    INFO: Manifest found at C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
                INFO: End assembly probing.

    INFO: Parsing Manifest File C:\Program Files (x86)\folder\SomeAssemblyName.DLL.
        INFO: Manifest Definition Identity is SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.30356".
        ERROR: Component identity found in manifest does not match the identity of the component requested. 
           Reference is SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.21177". 
           Definition   SomeAssemblyName,processorArchitecture="msil",version="1.0.8047.30356".
    ERROR: Activation Context generation failed.

So it finds the assembly and compares the version, and when they don't match it rejects it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文