Open
Description
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
- Create any .NET project targeting
net5.0-windows10.0.17763.0
or any other version of Win SDK as long as the target framework isnet5.0
. - Reference any UWP type like
Windows.Devices.Power.Battery
. dotnet build
with .NET 9.0 RC2 (I tried with the 6th November nightly build and the behavior was the same).