为 VS2022 构建扩展时出现有关 ProductArchitecture 的错误 VSSDK1311

Dre*_*kes 8 visual-studio visual-studio-extensions vsixmanifest

我正在构建 VSIX 项目并看到以下错误消息:

VSSDK1311 vsixmanifest 必须包含“PackageManifest:Installation:InstallTarget:ProductArchitecture”的值。

我需要做什么来解决这个问题?

Dre*_*kes 16

由于 VS2022 是 64 位,因此您必须指定您支持的目标的体系结构。

您之前可能写过的地方:

  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[16.0,17.0)" />
  </Installation>
Run Code Online (Sandbox Code Playgroud)

你现在可以写:

  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
  </Installation>
Run Code Online (Sandbox Code Playgroud)

如果您的 VSIX 配置为面向 VS2022以及早期版本,您可以使用类似以下内容进行指定:

  <Installation>
    <InstallationTarget Version="[16.0,18.0)" Id="Microsoft.VisualStudio.Pro">
      <ProductArchitecture>x86</ProductArchitecture>
    </InstallationTarget>
    <InstallationTarget Version="[17.0,18.0)" Id="Microsoft.VisualStudio.Pro">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
  </Installation>
Run Code Online (Sandbox Code Playgroud)

  • 添加“&lt;ProductArchitecture&gt;”后是否出现类似以下错误 1. 命名空间“http://schemas.microsoft.com/developer/vsx-schema/2011”中的元素“PackageManifest”具有无效的子元素“InstallationTarget”在命名空间“http://schemas.microsoft.com/developer/vsx-schema/2011”中。2. 验证 xml 架构时出现问题。未声明“http://schemas.microsoft.com/developer/vsx-schema/2011:InstallationTarget”元素。 (2认同)