microsoft-ui-xaml: Error while creating a WinUI 3, C# on Desktop project.

Describe the bug Creating a new WinUI 3,0 project using the C# on Desktop (package) project results in an error:

A problem was encountered creating the sub project 'Arctium Sandbox Studio'. The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKLocation('', 10.0.18362.0)" cannot be evaluated. Parameter "targetPlatformIdentifier" cannot have zero length. C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets

Steps to reproduce the bug

  1. Install the latest VS 2019 Preview+ .NET 5 (Preview 8/RC1)
  2. Install the WinUI 3.0 Preview2 extension.
  3. Create a WinUI C# on Desktop project.

Expected behavior It should create the project without any errors instead of failing.

Version Info WinUI 3 Preview 2

Windows 10 Pro Insider Preview Build 20170

Desktop

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 24 (11 by maintainers)

Most upvoted comments

Here is the install script I use Install-DotNet.zip

If you run this in an admin powershell window: Install-DotNet -version 5.0.100-preview.5.20279.10. This will install both x86 and x64 to program files.

Then you can add a global.json that looks like this:

{
  "sdk": {
    "version": "5.0.100-preview.5.20279.10"
  }
}

With .NET 5 just around the corner, when do you think this will be fixed?

The same here, VS 16.8 Preview 5.0 and .NET 5 rc2 image

This will be fixed in WinUI 3 Preview 3. Unfortunately .NET 5 has had a lot of breaking changes since we released Preview 2; you will need to stick with VS 16.7 and .NET 5 Preview 5 (although I’ve seen some reports that .NET 5 Preview 7 is the most recent version that is still compatible).

@HeyITGuyFixIt Please open a new issue describing the problem that you’re seeing and the steps that we might follow to reproduce it. Given the age of this issue it’s likely that the root cause of your problem is different from that of this one. Thanks!