Fix BuildWorkloadMsis failure by explicitly packing manifests in graph mode#54030
Fix BuildWorkloadMsis failure by explicitly packing manifests in graph mode#54030marcpopMSFT wants to merge 1 commit intomainfrom
Conversation
…h mode The Traversal SDK's Pack target in manifest-packages.csproj has a condition that skips execution when IsGraphBuild=true, relying on the graph scheduler to dispatch Pack to child .Manifest.proj projects via ProjectReferenceTargets. However, the graph builder does not discover these child projects, so the manifest nupkg files are never produced, causing BuildWorkloadMsis to fail with 'Could not find expected manifest packages'. Add a _PackManifestPackages target that explicitly invokes Pack on manifest-packages.csproj with RemoveProperties=IsGraphBuild so the Traversal SDK's Pack target executes normally. This target only runs in graph build mode; non-graph builds continue to work via the existing ProjectReference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses a graph-build (.slnx) failure where workload manifest NuPkg packages are not produced, causing BuildWorkloadMsis to fail with missing manifest packages.
Changes:
- Add a
_PackManifestPackagesMSBuild target that explicitly runsPackonmanifest-packages.csprojin graph build mode while removingIsGraphBuildso the Traversal SDK’sPacktarget executes.
| <Target Name="_PackManifestPackages" | ||
| BeforeTargets="BuildWorkloadMsis" | ||
| Condition="'$(BuildWorkloads)' == 'true' and '$(DotNetBuild)' != 'true' and '$(IsGraphBuild)' == 'true'"> | ||
| <MSBuild Projects="$(RepoRoot)src\Workloads\Manifests\manifest-packages.csproj" |
There was a problem hiding this comment.
The MSBuild Projects path is missing the path separator after $(RepoRoot). In this file the existing ProjectReference uses $(RepoRoot)\src\..., but here it’s $(RepoRoot)src\..., which will produce an invalid path when RepoRoot doesn’t already end with a slash.
| <MSBuild Projects="$(RepoRoot)src\Workloads\Manifests\manifest-packages.csproj" | |
| <MSBuild Projects="$(RepoRoot)\src\Workloads\Manifests\manifest-packages.csproj" |
|
Not sure if this is the right fix as the internal test didn't get far enough and ended up with a lot of every ProjectEvaluations of workloads.csproj. @baronfel any ideas as you're more familiar with these SDKs? |
|
Suggest instead that you make a custom target in manifest-packages.proj: <Project .... DefaultTargets="PackReferences">
<Target Name="PackReferences"
DependsOnTargets="$(PackDependsOn)">
<MSBuild Projects="@(ProjectReference)"
Targets="Pack"
Condition="'%(ProjectReference.Pack)' != 'false'"
BuildInParallel="$([MSBuild]::ValueOrDefault('%(ProjectReference.PackInParallel)',
$([MSBuild]::ValueOrDefault('%(ProjectReference.BuildInParallel)',
$([MSBuild]::ValueOrDefault('$(PackInParallel)', '$(BuildInParallel)'))
))
))"
SkipNonexistentProjects="$(SkipNonexistentProjects)"
SkipNonexistentTargets="$(SkipNonexistentTargets)"
StopOnFirstFailure="$(StopOnFirstFailure)"
ContinueOnError="$([MSBuild]::ValueOrDefault('$(PackContinueOnError)', '$(ContinueOnError)'))" />
</Target>
</Project>This is lifted right from the traversal SDK, and should make the manifest sub-projects get packed as expected. |
The Traversal SDK's Pack target in manifest-packages.csproj has a condition that skips execution when IsGraphBuild=true, relying on the graph scheduler to dispatch Pack to child .Manifest.proj projects via ProjectReferenceTargets. However, the graph builder does not discover these child projects, so the manifest nupkg files are never produced, causing BuildWorkloadMsis to fail with 'Could not find expected manifest packages'.
Add a _PackManifestPackages target that explicitly invokes Pack on manifest-packages.csproj with RemoveProperties=IsGraphBuild so the Traversal SDK's Pack target executes normally. This target only runs in graph build mode; non-graph builds continue to work via the existing ProjectReference.