System.CodeDom is pruned when winforms is enabled leading to restore failure
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When `UseWindowsForms` is set to `true` and `System.Management` nuget package is referenced, the project restore fails on non-windows machines (Ubuntu 24.04 CI/CD pipeline in our case) with the following error
```sh
$ dotnet restore --locked-mode -r win-x64
error NU1102: Unable to find package System.CodeDom with version (>= 10.0.2)
error NU1102: - Found 102 version(s) in nuget.org [ Nearest version: 10.0.2 ]
```
The issue goes away if either `UseWindowsForms` or `RestoreEnablePackagePruning` is set to `false`.
### To Reproduce
Default console helloworld project modified with said options: https://gist.github.com/zznty/902355f858824b69519f6a8b74920d23
If you set `UseWindowsForms` to `false` then the lock file is updated with `System.CodeDom` dependency included
### Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.100
Commit: b0f34d51fc
Workload version: 10.0.100-manifests.4eab3e0f
MSBuild version: 18.0.2+b0f34d51f
Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: ubuntu.24.04-x64
Base Path: /usr/lib/dotnet/sdk/10.0.100/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0
Architecture: x64
Commit: b0f34d51fc
.NET SDKs installed:
9.0.110 [/usr/lib/dotnet/sdk]
10.0.100 [/usr/lib/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.9 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.9 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
- Dotnet Cli is used directly without additional IDEs
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.