Msbuild Visual Studio如何填充';依赖关系';解决方案资源管理器中的节点

Msbuild Visual Studio如何填充';依赖关系';解决方案资源管理器中的节点,msbuild,.net-core,dotnet-sdk,Msbuild,.net Core,Dotnet Sdk,我正在编写自定义MSBuild目标,它在特定条件下替换了的一些 <ItemGroup> <!-- remove packages we are redirecting to projects, and include the projects --> <PackageReference Remove="@(ExcludePackageReferences)" /> <ProjectReference Inclu

我正在编写自定义MSBuild目标,它在特定条件下替换了
的一些

    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>
我有以下msbuild目标:

<Target Name="ApplyProjectRedirects"
      BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences;BeforeResolveReferences;ResolveAssemblyReferences"
      AfterTargets="PaketRestore">
    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>

    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>

全部的
我的项目引用在Visual Studio依赖项中不可见。然而,项目按照预期进行编译

    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>
我发现当目标在CollectPackageReferences之前运行时,目标内部带有
是受尊重的。但是,我无法用任何目标填充
,即使是第一个目标

    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>
VisualStudio如何用解决方案项目填充依赖关系

    <ItemGroup>
      <!-- remove packages we are redirecting to projects, and include the projects -->
      <PackageReference Remove="@(ExcludePackageReferences)" />
      <ProjectReference Include="@(IncludeProjectPaths)" />
    </ItemGroup>

    <ItemGroup>
      <!-- include the packages in visual studio 'nuget' display, so we know what we redirected -->
      <PackageReference Include="@(ExcludePackageReferences)">
        <ExcludeAssets>all</ExcludeAssets>
      </PackageReference>
    </ItemGroup>

</Target>