-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Area: Static GraphIssues with -graph, -isolate, and the related APIs.Issues with -graph, -isolate, and the related APIs.bugtriaged
Description
Issue Description
If a project multitargets, uses GeneratePackageOnBuild, and is referenced by another project in the graph, the Pack target is not run.
Steps to Reproduce
Library\Library.csproj (multitargets and has GeneratePackageOnBuild):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net7.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>Library2\Library2.csproj (references Library.csproj):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net7.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Library\Library.csproj" />
</ItemGroup>
</Project>repro.sln (just a sln containing the two projects):
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.csproj", "{6727BE74-84A6-448F-B8AD-F750AA7603CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library2", "Library2\Library2.csproj", "{4791B1D6-0EAA-4630-A009-E93336BEDA5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6727BE74-84A6-448F-B8AD-F750AA7603CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6727BE74-84A6-448F-B8AD-F750AA7603CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6727BE74-84A6-448F-B8AD-F750AA7603CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6727BE74-84A6-448F-B8AD-F750AA7603CF}.Release|Any CPU.Build.0 = Release|Any CPU
{4791B1D6-0EAA-4630-A009-E93336BEDA5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4791B1D6-0EAA-4630-A009-E93336BEDA5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4791B1D6-0EAA-4630-A009-E93336BEDA5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4791B1D6-0EAA-4630-A009-E93336BEDA5C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Expected Behavior
Library\bin\Debug\Library.1.0.0.nupkg is created.
Actual Behavior
Library\bin\Debug\Library.1.0.0.nupkg is not created.
Analysis
In this scenario, the only target that executes on the outer build of Library.csproj is GetTargetFrameworks. If one were to remove the reference from Library2.csproj, the Build target gets executed, which then hooks Pack due to GeneratePackageOnBuild.
Versions & Configurations
MSBuild version 17.5.0-preview-22506-03+20ce296d6 for .NET Framework
17.5.0.50603
johnterickson
Metadata
Metadata
Assignees
Labels
Area: Static GraphIssues with -graph, -isolate, and the related APIs.Issues with -graph, -isolate, and the related APIs.bugtriaged