Skip to content

Fix BuildWorkloadMsis failure by explicitly packing manifests in graph mode#54030

Closed
marcpopMSFT wants to merge 1 commit intomainfrom
marcpopMSFT-fixmainworkloadsCI
Closed

Fix BuildWorkloadMsis failure by explicitly packing manifests in graph mode#54030
marcpopMSFT wants to merge 1 commit intomainfrom
marcpopMSFT-fixmainworkloadsCI

Conversation

@marcpopMSFT
Copy link
Copy Markdown
Member

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.

…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>
Copilot AI review requested due to automatic review settings April 22, 2026 00:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _PackManifestPackages MSBuild target that explicitly runs Pack on manifest-packages.csproj in graph build mode while removing IsGraphBuild so the Traversal SDK’s Pack target executes.

<Target Name="_PackManifestPackages"
BeforeTargets="BuildWorkloadMsis"
Condition="'$(BuildWorkloads)' == 'true' and '$(DotNetBuild)' != 'true' and '$(IsGraphBuild)' == 'true'">
<MSBuild Projects="$(RepoRoot)src\Workloads\Manifests\manifest-packages.csproj"
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<MSBuild Projects="$(RepoRoot)src\Workloads\Manifests\manifest-packages.csproj"
<MSBuild Projects="$(RepoRoot)\src\Workloads\Manifests\manifest-packages.csproj"

Copilot uses AI. Check for mistakes.
@marcpopMSFT
Copy link
Copy Markdown
Member Author

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?

@baronfel
Copy link
Copy Markdown
Member

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.

@marcpopMSFT
Copy link
Copy Markdown
Member Author

#54053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants