runtime: Unable to find package runtime.win-x86.Microsoft.WindowsDesktop.App when publishing Blazor self hosted

Steps to reproduce

  1. Delete the .nuget\packages dir (dotnet nuget locals --clear all)
  2. Clone https://github.com/pranavkm/BlazorPublishRepro
  3. Open in VS
  4. Publish WebApplication1.Server to a folder as a self-contained (win-x86) application

Expected behavior

Things work

Actual behavior

Restore fails:

4>------ Publish started: Project: WebApplication1.Server, Configuration: Release Any CPU ------
Connecting to C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Server\bin\Debug\netcoreapp3.0\publish\...
Restore completed in 583.26 ms for C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Client\WebApplication1.Client.csproj.
Restore completed in 583.11 ms for C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Shared\WebApplication1.Shared.csproj.
C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Server\WebApplication1.Server.csproj(0,0): Error NU1102: Unable to find package runtime.win-x86.Microsoft.WindowsDesktop.App with version (>= 3.0.0-preview4-27611-18)
  - Found 43 version(s) in DotNetCore [ Nearest version: 3.0.0-alpha-27309-3 ]
  - Found 2 version(s) in nuget.org [ Nearest version: 3.0.0-preview3-27504-2 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json
  - Found 0 version(s) in https://dotnet.myget.org/F/blazor-dev/api/v3/index.json
  - Found 0 version(s) in AspNetCore
Restore failed in 1.31 sec for C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Server\WebApplication1.Server.csproj.
C:\Users\prkrishn\source\repos\WebApplication1\WebApplication1.Server\WebApplication1.Server.csproj(0,0): Error NU1102: Unable to find package runtime.win-x86.Microsoft.WindowsDesktop.App with version (>= 3.0.0-preview4-27611-18)
  - Found 43 version(s) in DotNetCore [ Nearest version: 3.0.0-alpha-27309-3 ]
  - Found 2 version(s) in nuget.org [ Nearest version: 3.0.0-preview3-27504-2 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json
  - Found 0 version(s) in https://dotnet.myget.org/F/blazor-dev/api/v3/index.json

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview4-011192
 Commit:    4145635c07

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview4-011192\

Host (useful for support):
  Version: 3.0.0-preview4-27610-12
  Commit:  d5a76cb8c0

.NET Core SDKs installed:
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  3.0.100-preview4-011192 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview4-19210-17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview4-27610-12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview4-27611-18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

It also seems weird that the WindowsDesktop packages are needed to publish these web projects self-contained, but I’m not really familiar with how that works.

It is weird but by design. We have to download all runtime packs due to having to pick pre-restore before we can apply transitive framework references. Well, what’s weird is that right now, we still haven’t finished transitive framework references, but the part that is picking the runtime packs to download is already being greedy in anticipation.

Hmm, no I think this is different

The project has:

    <RestoreAdditionalProjectSources>
      https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
      https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
    </RestoreAdditionalProjectSources>

If you change that to

    <RestoreAdditionalProjectSources>
      $(RestoreAdditionalSources);
      https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
      https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
    </RestoreAdditionalProjectSources>

Does it work?

There are some implicit additional sources (which will be gone in Preview 5 --hopefully)

@dagood adding the dotnet-windowsdesktop feed does fix the issue. Presumably this package would be published to NuGet.org as part of the preview4 release. That said, would you know why publishing a self-contained WebApplication results in a reference to the WindowsDesktop framework?

@dagood I did cheat and just delete the .nuget/packages dir prior to running this specific publish. But afaik, dotnet nuget locals --clear all should wipe out the HTTP cache.