Skip to content

Fix SamplesCompatTest NU1605: insert missing PackageVersion entries when rewriting samples' Directory.Packages.props#6473

Open
v-arlysenko wants to merge 2 commits into
mainfrom
user/v-arlysenko/fix-sample-base-version-rewrite
Open

Fix SamplesCompatTest NU1605: insert missing PackageVersion entries when rewriting samples' Directory.Packages.props#6473
v-arlysenko wants to merge 2 commits into
mainfrom
user/v-arlysenko/fix-sample-base-version-rewrite

Conversation

@v-arlysenko
Copy link
Copy Markdown
Collaborator

Summary

Fixes an NU1605 build break in BuildSampleApps_x64 / BuildSampleApps_arm64
of TransportPackage-Foundation-Nightly (e.g. build 146281092):

NU1605: Detected package downgrade: Microsoft.WindowsAppSDK.Base
        from 2.0.260223001-experimental to 2.0.3-dev.experimental1
Unpackaged -> Microsoft.WindowsAppSDK.Foundation -> Microsoft.WindowsAppSDK.Base (>= 2.0.260223001-experimental)
Unpackaged -> Microsoft.WindowsAppSDK.Base (>= 2.0.3-dev.experimental1)

Internal work item: AB#62180574

Root cause

test/ModifySampleAppsReferences.ps1 rewrites WASDK package versions in WindowsAppSDK-Samples@release/experimental at pipeline time, using the Foundation transport package's extracted contents as the source of truth.

For Directory.Packages.props it only replaced existing PackageVersion Include="…" Version="…" entries — it never inserted missing ones. The samples branch doesn't declare a PackageVersion for Microsoft.WindowsAppSDK.Base, so the script silently did nothing for that package. NuGet restore then resolved Base from the transport-package metadata, picking an older 2.0.3-dev.experimental1 that conflicts with Foundation's pinned >= 2.0.260223001-experimental → NU1605.

Fix

When rewriting Directory.Packages.props, if the PackageVersion Include="X" entry is missing, insert <PackageVersion Include="X" Version="…" /> into the first <ItemGroup>. Existing entries are still updated in place.

packages.config handling is unchanged; the samples failing in this bug all use central package management. We can add symmetric insert logic later if a packages.config sample hits the same NU1605.

Validation

Local dry-run of the script against a clone of release/experimental using the same $packagesToUpdateTable the pipeline builds: the rewritten Samples/Directory.Packages.props now contains a <PackageVersion Include="Microsoft.WindowsAppSDK.Base" Version="…" /> entry matching the Foundation transport package version.

Risk

Low — change is confined to a build-time script that runs only inside TransportPackage-Foundation-Nightly against a cloned samples repo; no shipping code or sample source is modified.

@Scottj1s
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@v-arlysenko
Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants