Skip to content

Packaging project caches stale NuGet assembly references across builds #6253

@riverar

Description

@riverar

Also filed in VSdevcom.

Describe the bug

When using the Packaging project to produce MSIX bundles for WinUI apps, downgrading a NuGet package reference and rebuilding results in the previously-built (higher-versioned) DLL being included in the bundle instead of the correct one. Neither Clean Solution or restarting Visual Studio resolves the issue.

(Note: Customer hit this in the field while upgrading a NuGet package reference but I kept the description consistent with my steps to reproduce.)

Steps to reproduce the bug

  1. git clone https://github.com/riverar/repro-9db5e09ea4b6
  2. Open App1.slnx in Visual Studio 2026
  3. Double-click App1 in Solution Explorer
  4. Observe CommunityToolkit.Mvvm is referencing version 8.3.2
  5. Single-click the App1 (Package) in Solution Explorer
  6. Select Project > Publish > Create app packages...
  7. In the wizard, use the following publishing options:
    • Distribution method: Sideloading (without automatic updates)
    • Signing method: No, skip package signing
    • Architectures: x86, x64
  8. After creating a package, navigate to App1 (Package)\AppPackages\App1 (Package)_1.0.14.0_Debug_Test
  9. Open App1 (Package)_1.0.14.0_x86_x64_Debug.msixbundle in your favorite compression tool (e.g., 7-Zip)
  10. Extract App1%20%28Package%29_1.0.14.0_x64_Debug.msix\App1\CommunityToolkit.Mvvm.dll
  11. View the properties of the extracted library.
  12. Observe the library is versioned 8.3.2.1.
  13. In Visual Studio, double-click App1 in Solution Explorer
  14. In the text editor, change CommunityToolkit.Mvvm to reference version 8.4.0 and save.
  15. Select Build > Clean Solution
  16. Repeat steps 5-11, changing the MSIX filenames as needed (if package version auto-increment is enabled)
  17. Observe the library is versioned 8.4.0.1.
  18. Repeat steps 13-16, but with version 8.3.2 again.
  19. Observe the library is still versioned 8.4.0.1. ⚠️

Expected behavior

Bundled output to always match what is referenced in the project

Screenshots

No response

NuGet package version

None

Packaging type

Packaged (MSIX)

Windows version

Insider Build (xxxxx)

IDE

Visual Studio Enterprise 2026 (11519.219)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ExternalTopics external to Windows App SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions