question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

windows arm64 dotnet SDK fails to publish self-contained

See original GitHub issue

Describe the bug

The dotnet CLI on a Windows ARM64 machine cannot publish a self-contained application

To Reproduce

On a Windows ARM64 device (e.g. Surface Pro X):

  1. Download https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-preview.7-windows-arm64-binaries
  2. Create a new application:
dotnet new console
  1. Attempt to publish it:
dotnet publish -r win-arm64 --self-contained /p:PublishSingleFile=true
# results in: error NU1100: Unable to resolve 'Microsoft.NETCore.App.Runtime.win-arm64 (= 6.0.0-preview.7.21377.19)' for 'net6.0'.

It’s worth noting within WSL2, the Linux ARM64 dotnet 6 SDK Preview does not have this problem i.e. ARM64 Linux can successfully cross compile for the same target runtime, win-arm64, so this bug appears to be specifically for the Windows ARM64 version of the dotnet 6 SDK. More details below:

Exceptions (if any)

Microsoft (R) Build Engine version 17.0.0-preview-21378-03+d592862ed for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
C:\Users\guide2wsl\Documents\Programming\first\first.csproj : error NU1100: Unable to resolve 'Microsoft.NETCore.App.Runtime.win-arm64 (= 6.0.0-preview.7.21377.19)' for 'net6.0'.
C:\Users\guide2wsl\Documents\Programming\first\first.csproj : error NU1100: Unable to resolve 'Microsoft.WindowsDesktop.App.Runtime.win-arm64 (= 6.0.0-preview.7.21378.9)' for 'net6.0'.
C:\Users\guide2wsl\Documents\Programming\first\first.csproj : error NU1100: Unable to resolve 'Microsoft.AspNetCore.App.Runtime.win-arm64 (= 6.0.0-preview.7.21378.6)' for 'net6.0'.
  Failed to restore C:\Users\guide2wsl\Documents\Programming\first\first.csproj (in 167 ms).

Further technical details

Edition Windows 11 Home Version 21H2 OS build 22000.176

dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.7.21379.14
 Commit:    22d70b47bc

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-arm64
 Base Path:   C:\Users\guide2wsl\Applications\dotnet\sdk\6.0.100-preview.7.21379.14\

Host (useful for support):
  Version: 6.0.0-preview.7.21377.19
  Commit:  91ba01788d

.NET SDKs installed:
  6.0.100-preview.7.21379.14 [C:\Users\guide2wsl\Applications\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [C:\Users\guide2wsl\Applications\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Users\guide2wsl\Applications\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Users\guide2wsl\Applications\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Please investigate, thanks!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
scottmwyantcommented, Nov 10, 2021

I think I’m seeing the same thing on win-x64. Just installed .NET 6.0 this morning. I’ve never done .NET development on this machine before. Don’t have Visual Studio. Working with CLI and VS Code.

Using <PublishSingleFile>true</PublishSingleFile> in my csproj turns the error on and off for me. Set to true and it asks for a runtime, so I run dotnet publish -r win-x64 and get the NU1100 errors. Use <PublishSingleFile>false</PublishSingleFile> and it works.

Output of dotnet --info:

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

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

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

I also had

C:\Users\swyant\code\attempt-dotnet>dotnet nuget list source
No sources found.

So as I saw above, I ran dotnet nuget add source -n nuget.org https://api.nuget.org/v3/index.json then I was able to run dotnet publish with <PublishSingleFile>true</PublishSingleFile> and <RuntimeIdentifier>win-x64</RuntimeIdentifier> right below but this still didn’t produce single-file output.

I was able to get single file output by running dotnet publish -r win-x64 --no-self-contained. I got a warning from the CLI that I needed to use either --self-contained or --no-self-contained.

So if you want to publish framework-dependent single file output you need:

    <PublishSingleFile>true</PublishSingleFile>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>false</SelfContained>
0reactions
guide2wslcommented, Oct 9, 2021

I spoke too soon, I can still reproduce with the .NET 6 rc1 SDK. It turns out on Windows when you run:

dotnet nuget add source -n nuget.org https://api.nuget.org/v3/index.json

More than just: $HOME\.nuget is modified

so wiping that directory alone on Windows wasn’t enough to confirm this was resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Self-Contained Single-File does not produce a single file
Net 5 console application with no dependencies on third party components. I have set it up to publish as a self-contained single-file.
Read more >
Solved: Publish/Deploy self-contained win-x64 not working
I'm using Esri.ArcGISRuntime.WPF v200.0.0 in a WPF + NET7 application. I am publishing it as self-contained win-x64.
Read more >
Publish to arm64 not working when cultured resx file added
Is there a way to make the publish succesfull? Is there a better way to do localization for .net 6.0 projects that need...
Read more >
I get ".NET location: not found" error on Linux when running ...
You are trying to run the resulting binaries from a build that wasn't published as a self-contained application within a container that doesn't ......
Read more >
Dotnet build linux. The answer you're looking for is basically
1. peace When I deploy to Linux, I publish the application on Windows and copy ... The dotnet sdk ships with a self-contained...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found