dotnet / dotnet/sdk

PublishSingleFile adds unwanted dependencies in 10.0.200

Open
#53,386 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
A project that I'm working on broke when the .NET SDK was updated to 10.0.200, due to an unexpected and unwanted reference to Microsoft.AspNetCore.App.Runtime.win-x64. I've managed to narrow the issue down to PublishSingleFile.

### To Reproduce
Start with an empty directory, and run `dotnet new console`. Create a file called `nuget.config` right next to the .csproj, with this content:
```xml



```
This is to ensure that nothing gets downloaded or restored in the background, and to make the dependencies visible. In the larger project where this issue was discovered, there is an `` directive that points to a local collection of .nupkgs, which does not include ASP.NET Core, because nothing uses it.

Run `dotnet build`. The project will build successfully, which is a little surprising, but OK. Edit the .csproj, adding this line to its PropertyGroup: `true`

This will break the build:
```
error NU1100: Unable to resolve 'Microsoft.NET.ILLink.Tasks (>= 10.0.4)' for 'net10.0'.
error NU1100: Unable to resolve 'Microsoft.NET.ILLink.Tasks (>= 10.0.4)' for 'net10.0/win-x64'.
error NU1100: Unable to resolve 'Microsoft.NETCore.App.Runtime.win-x64 (= 10.0.4)' for 'net10.0'.
error NU1100: Unable to resolve 'Microsoft.WindowsDesktop.App.Runtime.win-x64 (= 10.0.4)' for 'net10.0'.
error NU1100: Unable to resolve 'Microsoft.AspNetCore.App.Runtime.win-x64 (= 10.0.4)' for 'net10.0'.
```

If you wish, you may download microsoft.netcore.app.runtime.win-x64.10.0.4.nupkg from NuGet, place it next to the .csproj, and edit `nuget.config` so that it's picked up (``). This will remove its corresponding error, as expected, but AspNetCore and WindowsDesktop should not be required to build a trivial command-line hello world.

If the same steps are performed in 10.0.103, there's only one error:
```
error NU1100: Unable to resolve 'Microsoft.NET.ILLink.Tasks (>= 10.0.3)' for 'net10.0'.
```
The regression is the three new App.Runtime NU1100 errors being added to the set.

### Exceptions (if any)
None

### Further technical details
details of dotnet --info


.NET SDK:
Version: 10.0.200
Commit: 40cd698e5c
Workload version: 10.0.200-manifests.b7278506
MSBuild version: 18.3.0-release-26119-122+40cd698e5

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.200\

.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.4
Architecture: x64
Commit: 80d3e14f5e

.NET SDKs installed:
10.0.200 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [1]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.