Skip to content

Microsoft.Windows.SDK.NET.Ref package not referenced when targeting .NET 5.0 in .NET 9.0 RC.2 SDK #44705

Open
@addabis

Description

@addabis

Description

A simple project targeting e.g. net5.0-windows10.0.17763.0 will fail to resolve UWP types like Windows.Devices.Power.Battery because Microsoft.Windows.SDK.NET.Ref references are not passed to C# compiler.

error CS0246: The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'Battery' could not be found (are you missing a using directive or an assembly reference?)

This was working in RC.1.

Changing the target framework version to net6.0-windows10.0.17763.0 resolves this problem.

.NET 5.0 is not supported, but is this intentional?

To Reproduce

  1. Create any .NET project targeting net5.0-windows10.0.17763.0 or any other version of Win SDK as long as the target framework is net5.0.
  2. Reference any UWP type like Windows.Devices.Power.Battery.
  3. dotnet build with .NET 9.0 RC2 (I tried with the 6th November nightly build and the behavior was the same).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions