缺少 "BuiltProjectOutputGroupDependencies" 根据新的简化 csproj 构建 VSIX

Missing "BuiltProjectOutputGroupDependencies" building VSIX depending on new simplified csproj

我有一个标准的 VSIX 项目依赖于同一解决方案中的 class 库项目。在我将 class 库切换到新的 VS2017RC 简化的 csproj 之前,一切都在构建中。 class 库构建良好(我的 dotnet SDK 是 1.0.0-preview4-004233),但是在尝试构建 VSIX 时我得到:

error MSB4057: The target "BuiltProjectOutputGroupDependencies" does not exist in the project.

这显然看起来与传统 VSIX csproj 不兼容,期望从依赖项目获得新 csproj 不提供的东西。

有没有人遇到过这个问题或有任何解决此问题的建议?我将研究删除项目引用并手动引用输出 DLL。

作为相关附注,尚不清楚 VSIX 将从 class 库中 select 哪个输出 DLL,因为新的 csproj 支持多个目标框架。

我相信您可能会遇到我在尝试从面向多个框架的 .NET Standard 库中引用我的 Visual Studio 扩展时遇到的相同问题。有一个 GitHub 问题 dotnet/sdk#433 关于它。

我所要做的就是删除我的其他目标。就我而言,我有:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFrameworks>netstandard1.3;net46</TargetFrameworks>
    </PropertyGroup>    
    ...
</Project>

我不得不将其修改为仅针对 netstandard1.3(因为根据 .NET Standard chart,它与 .NET 4.6 兼容),而我的 VSIX 则针对 .NET 4.6。

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard1.3</TargetFramework>
    </PropertyGroup>  
    ...
</Project>

on the GitHub issue 所述,这里有一个解决方法:

  1. 卸载 VSIX 项目。
  2. 右键单击并编辑其 .csproj 文件。
  3. 找到开始导致问题的项目 <ProjectReference>
  4. 添加元素 <AdditionalProperties>TargetFramework=net452</AdditionalProperties>,使用您在引用项目中定位的正确 .NET Framework 版本。
  5. 重新加载并重建 VSIX 项目。