【问题标题】:Issue compiling VSIX project in Visual Studio Community 2015 RC在 Visual Studio Community 2015 RC 中编译 VSIX 项目的问题
【发布时间】:2015-07-07 19:29:20
【问题描述】:

我正在尝试创建 Visual Studio VSIX 扩展,但在使用同一解决方案中的 3 个 C# 类库“依赖项”进行编译时遇到了问题:

错误 MSB4057:项目中不存在目标“VSIXContainerProjectOutputGroup”。

错误 MSB4057:项目中不存在目标“VSIXContainerProjectOutputGroup”。

错误 MSB4057:项目中不存在目标“VSIXContainerProjectOutputGroup”。

所有三个程序集都设置为“在此 VSIX 中嵌入”,并且嵌入文件夹设置为“/”;这是“source.extension.vsixmanifest”文件中的 XML:

<Dependencies>
    <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="4.6" d:InstallSource="Download" />
    <Dependency d:Source="Project" d:ProjectName="Networking" d:InstallSource="Embed" Version="0.5" Location="|Networking;VSIXContainerProjectOutputGroup|" DisplayName="|Networking;VSIXNameProjectOutputGroup|" Id="|Networking;VSIXIdentifierProjectOutputGroup|" d:VsixSubPath="/" />
    <Dependency d:Source="Project" d:ProjectName="Utilities" d:InstallSource="Embed" Location="|Utilities;VSIXContainerProjectOutputGroup|" DisplayName="|Utilities;VSIXNameProjectOutputGroup|" Id="|Utilities;VSIXIdentifierProjectOutputGroup|" d:VsixSubPath="/" />
    <Dependency d:Source="Project" d:ProjectName="Data Model" Version="1.0" d:InstallSource="Embed" d:VsixSubPath="/" Location="|Data Model;VSIXContainerProjectOutputGroup|" DisplayName="|Data Model;VSIXNameProjectOutputGroup|" Id="|Data Model;VSIXIdentifierProjectOutputGroup|" />
  </Dependencies>

此代码需要位于单独的程序集中,以便其他项目可以引用。

我已经尝试了this MSDN 论坛问题中提到的两个建议,但都没有奏效。

还有另一个不太麻烦但可能相关的问题正在发生:每隔一段时间,这三个项目中的类和命名空间似乎消失了,我必须删除并重新添加对它们的引用。

任何解决这些问题的帮助将不胜感激;如果我能提供任何其他信息来帮助解决这些问题,请告诉我。

编辑

我尝试在发布模式下重新编译以查看是否是特定于配置的问题,但没有任何改变。

【问题讨论】:

    标签: c# visual-studio msbuild visual-studio-2015 vsix


    【解决方案1】:

    我设法通过删除为扩展项目的 csproj 文件中的项目引用指定 OutputGroupsIncludedInVSIXOutputGroupsIncludedInVSIXLocal 的行来修复它,并将库中的库更改为“资产”而不是“依赖项” vsixmanifest 文件。

    希望这可以帮助其他有同样问题的人。

    【讨论】:

    • 这是 VSIX 项目中的错误。如果您在解决方案中添加指向其他项目的依赖项,它会按如下方式更新清单:
    • 你的意思是IncludeOutputGroupsInVSIX 吗?
    【解决方案2】:

    如果任何依赖项是 VS2017 中的多目标 .NET 核心框架库(即netstandard2.0;net462),您会收到此错误:

    错误:c:\path\to\depproj.csproj:错误 MSB4057:项目中不存在目标“BuiltProjectOutputGroupDependencies”

    添加这个:

    <AdditionalProperties>TargetFramework=net462</AdditionalProperties>
    

    到项目引用节点中的.csproj文件作为附加属性。

    <ProjectReference Include="..\path\to\deprpoj.csproj">
        <Project>{81eab942-30aa-445e-86d6-ad6becdf804c}</Project>
           <Name>Your.Project.Name</Name>   
        <AdditionalProperties>TargetFramework=net462</AdditionalProperties>
    </ProjectReference>
    

    【讨论】:

    • 感谢您的建议,但值得注意的是,这个问题比 .NET Core 更早。此外,对于未来的答案,我建议提供一个解释为什么会出现问题,或者至少解释为什么解决方案有效。如果可能的话。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-31
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 2016-06-09
    • 1970-01-01
    相关资源
    最近更新 更多