dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

[Broken Build]: Self-contained publish regression in .NET 9.0 RC1 #10662

Closed nil4 closed 1 month ago

nil4 commented 1 month ago

Issue Description

ref. https://github.com/dotnet/sdk/issues/43461 which was abruptly closed by a bot without triage.

A WPF or WinForms project using DevExpress components, WCF and a handful of third-party NuGet packages can be published self-contained correctly when targeting net8.0-windows. All relevant .dll files are present in the published output, and the application runs as expected.

When the project is re-targeted to net9.0-windows, the self-contained publish output no longer includes certain WPF assemblies (e.g. PresentationCore.dll or PresentationFramework*.dll) The published application now crashes at startup because it cannot find these WPF assemblies.

This appears to be a regression, and an unexpected breaking change in .NET 9.0 RC1.

Steps to Reproduce

A minimal reproducible sample extracted from the actual application:

Note: an active subscription for access to the DevExpress NuGet package source https://nuget.devexpress.com/${YOUR_SUBSCRIPTION_KEY_HERE}/api/v3/index.json will be required.

Download the script at https://gist.github.com/nil4/9f6c787205340b8b45a7cfe504ba7400 and on line 8, replace the placeholder value with a DevExpress subscription key.

Running the script (pwsh repro.ps1) will:

The script creates two projects, first targeting net8.0 and then net9.0. The publish output for net8.0 consistently includes the WPF assemblies.

The publish output for net9.0, once the final NuGet package reference is added, no longer includes the expected WPF assemblies.

Expected Behavior

The net8.0 app is published correctly, including all WPF runtime dependencies:

Testing net8.0 repro under C:\repro\repro_8
Creating new net8.0 WPF project in C:\repro\repro_8
Disabling <ImplicitUsings> in C:\repro\repro_8\repro_8.csproj

Adding package DevExpress.Mvvm 24.1.5 in C:\repro\repro_8
Adding package DevExpress.Win.Navigation 24.1.5 in C:\repro\repro_8
Adding package DevExpress.Win.Grid 24.1.5 in C:\repro\repro_8
Adding package System.ServiceModel.Http 8.0.0 in C:\repro\repro_8
Adding package System.ServiceModel.Primitives 8.0.0 in C:\repro\repro_8
Adding package System.Drawing.Common 8.0.8 in C:\repro\repro_8
Adding package System.Formats.Asn1 8.0.1 in C:\repro\repro_8
Publishing C:\repro\repro_8 to C:\repro\repro_8\bin\publish
✅ Found 15 files matching C:\repro\repro_8\bin\publish\Presentation*.dll

Adding package Tulpep.ActiveDirectoryObjectPicker 3.0.11 in C:\repro\repro_8
Publishing C:\repro\repro_8 to C:\repro\repro_8\bin\publish
✅ Found 15 files matching C:\repro\repro_8\bin\publish\Presentation*.dll

Actual Behavior

The net9.0 app is published with some runtime dependencies missing (e.g. PresentationCore.dll and PresentationFramework*.dll):

Testing net9.0 repro under C:\repro\repro_9
Creating new net9.0 WPF project in C:\repro\repro_9
Disabling <ImplicitUsings> in C:\repro\repro_9\repro_9.csproj

Adding package DevExpress.Mvvm 24.1.5 in C:\repro\repro_9
Adding package DevExpress.Win.Navigation 24.1.5 in C:\repro\repro_9
Adding package DevExpress.Win.Grid 24.1.5 in C:\repro\repro_9
Adding package System.ServiceModel.Http 8.0.0 in C:\repro\repro_9
Adding package System.ServiceModel.Primitives 8.0.0 in C:\repro\repro_9
Adding package System.Drawing.Common 9.0.0-rc.1.24451.1 in C:\repro\repro_9
Adding package System.Formats.Asn1 9.0.0-rc.1.24431.7 in C:\repro\repro_9
Publishing C:\repro\repro_9 to C:\repro\repro_9\bin\publish
✅ Found 16 files matching C:\repro\repro_9\bin\publish\Presentation*.dll

Adding package Tulpep.ActiveDirectoryObjectPicker 3.0.11 in C:\repro\repro_9
Publishing C:\repro\repro_9 to C:\repro\repro_9\bin\publish
⛔ Found NO files matching C:\repro\repro_9\bin\publish\Presentation*.dll

Ask us questions

No response

AR-May commented 1 month ago

Team Triage: it is a duplicate of https://github.com/dotnet/sdk/issues/43461