Skip to content

Aliased packs are not resolved correctly from TargetingPackName/RuntimePackRuntimeIdentifiers in KnownFrameworkReference items #26384

@rolfbjarne

Description

@rolfbjarne

Describe the bug

I have the following KnownFrameworkReference in a workload:

<KnownFrameworkReference
	Include="Microsoft.iOS"
	TargetFramework="net7.0"
	RuntimeFrameworkName="Microsoft.iOS"
	DefaultRuntimeFrameworkVersion="**FromWorkload**"
	LatestRuntimeFrameworkVersion="**FromWorkload**"
	TargetingPackName="Microsoft.iOS.Ref.NET7"
	TargetingPackVersion="**FromWorkload**"
	RuntimePackNamePatterns="Microsoft.iOS.Runtime.**RID**.NET7"
	RuntimePackRuntimeIdentifiers="iossimulator-x64;ios-arm64;ios-arm;iossimulator-x86;iossimulator-arm64"
	Profile="$(_PlatformName)"
/>

The important part are the values for TargetingPackName and RuntimePackNamePatterns (suffixed with .NET7):

TargetingPackName="Microsoft.iOS.Ref.NET7"
RuntimePackNamePatterns="Microsoft.iOS.Runtime.**RID**.NET7"

The I declare the following in WorkloadManifest.json:

	"packs": {
		"Microsoft.iOS.Ref.NET7": {
			"kind": "framework",
			"version": "15.4.414",
			"alias-to": {
				"any": "Microsoft.iOS.Ref",
			}
		},
		"Microsoft.iOS.Runtime.ios-arm64.NET7": {
			"kind": "framework",
			"version": "15.4.414",
			"alias-to": {
				"any": "Microsoft.iOS.Runtime.ios-arm64",
			}
		},
    }

Note how these entries are aliased entries, where the build is supposed to go look for the pack with the alias-to name (as documented here)

However, this fails to build with:

error NU1101: Unable to find package Microsoft.iOS.Ref.NET7. No packages exist with this id in source(s): ...
error NU1101: Unable to find package Microsoft.iOS.Runtime.ios-arm64.NET7. No packages exist with this id in source(s): ...

Binlog: msbuild.binlog.zip

Further technical details

dotnet --info
$ dotnet --info
.NET SDK:
 Version:   7.0.100-preview.6.22306.4
 Commit:    1e2223659d

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.4
 OS Platform: Darwin
 RID:         osx.12-x64
 Base Path:   /Users/rolf/work/maccore/net7.0/xamarin-macios/builds/downloads/dotnet-sdk-7.0.100-preview.6.22306.4-osx-x64/sdk/7.0.100-preview.6.22306.4/

global.json file:
  /Users/rolf/work/maccore/net7.0/xamarin-macios/global.json

Host:
  Version:      7.0.0-preview.6.22304.5
  Architecture: x64
  Commit:       bad2ab053c

.NET SDKs installed:
  7.0.100-preview.6.22306.4 [/Users/rolf/work/maccore/net7.0/xamarin-macios/builds/downloads/dotnet-sdk-7.0.100-preview.6.22306.4-osx-x64/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.0-preview.6.22303.7 [/Users/rolf/work/maccore/net7.0/xamarin-macios/builds/downloads/dotnet-sdk-7.0.100-preview.6.22306.4-osx-x64/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.0-preview.6.22304.5 [/Users/rolf/work/maccore/net7.0/xamarin-macios/builds/downloads/dotnet-sdk-7.0.100-preview.6.22306.4-osx-x64/shared/Microsoft.NETCore.App]

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

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions