dotnet pack does not support multiple architectures when PublishReadyToRun is enabled
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
I am trying to pack an executable to deploy it as dotnet tool in nuget. My tool has `PublishReadyToRun` enabled and dotnet pack.
When I do not specify `-ucr`, I do get the following error
```
C:\Program Files\dotnet\sdk\8.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(396,5): error NETSDK1094: Unable to optimize assemblies for performance: a valid runt
ime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to re
store packages with the PublishReadyToRun property set to true. [<...>.csproj]
```
This is the relevant section from my csproj
```xml
Exe
net8.0
true
Datahunter.Analysis.CLI
analyzercli
preview
enable
true
true
true
0.0.1-local
$(BUILD_BUILDNUMBER)
false
AssemblyKey.snk
false
en
false
false
win-x64;linux-x64
true
analyzercli
./nupkg
```
### To Reproduce
1. Follow the global tools tutorial
2. Add `true` to csproj file
3. Pack the tool using `dotnet pack`
### Exceptions (if any)
```
C:\Program Files\dotnet\sdk\8.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(396,5): error NETSDK1094: Unable to optimize assemblies for performance: a valid runt
ime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to re
store packages with the PublishReadyToRun property set to true. [<...>.csproj]
```
### Further technical details
- Include the output of `dotnet --info`
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
```
.NET SDK:
Version: 8.0.300
Commit: 326f6e68b2
Workload version: 8.0.300-manifests.4e5ea2d8
MSBuild version: 17.10.4+10fbfbf2e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22635
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.300\
.NET workloads installed:
[android]
Installation Source: VS 17.11.34909.67
Manifest Version: 34.0.95/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.95\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 17.11.34909.67
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.2.8053\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.11.34909.67
Manifest Version: 8.0.21/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.21\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 17.11.34909.67
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.2.8053\WorkloadManifest.json
Install Type: Msi
[aspire]
Installation Source: VS 17.10.34916.146
Manifest Version: 8.0.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
Install Type: Msi
Host:
Version: 8.0.5
Architecture: x64
Commit: 087e15321b
.NET SDKs installed:
8.0.105 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.5 [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:
Not set
global.json file:
D:\Datahunter\DataHunter-Main\global.json
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.