1

Setup:

OS Windows 11

Visual Studio 2022 community version 17.4.5

Workload installed: .Net Desktop development, Universal Windows Platform development.

Installation details: .Net desktop development tools. Windows 11 SDK (10.0.22621.0)

I created a new project: Blank App, Packaged with Windows Application Packaging Project (WinUI 3 in Desktop)

Error list starts with

Unable to find package Microsoft.Windows.SDK.BuildTools. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Package source  App3    C:\Users\Moshe\source\repos\App3\App3\App3.csproj 

Same for all other packages.

Errors in the code The Type 'Window was not found'

NuGet settings: Package Source C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\microsoft.windows.sdk.buildtools When opening this folder, it has a folder "10.0.22621.1" and in it under bin, are the packages reported missing.

Here is the .proj references

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>App3</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64</Platforms>
    <RuntimeIdentifiers>win10-x86;win10-x64</RuntimeIdentifiers>
    <PublishProfile>win10-$(Platform).pubxml</PublishProfile>
    <UseWinUI>true</UseWinUI>
    <EnableMsixTooling>true</EnableMsixTooling>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Assets\SplashScreen.scale-200.png" />
    <Content Include="Assets\LockScreenLogo.scale-200.png" />
    <Content Include="Assets\Square150x150Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
    <Content Include="Assets\StoreLogo.png" />
    <Content Include="Assets\Wide310x150Logo.scale-200.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>

  <!-- 
    Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
    Tools extension to be activated for this project even if the Windows App SDK Nuget
    package has not yet been restored.
  -->
  <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <ProjectCapability Include="Msix"/>
  </ItemGroup>

  <!-- 
    Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution 
    Explorer "Package and Publish" context menu entry to be enabled for this project even if 
    the Windows App SDK Nuget package has not yet been restored.
  -->
  <PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
  </PropertyGroup>

What I tried so far:

Uninstall and reinstall Visual Studio.

Change SDK from Windows 11 to Windows 10 in Installer.

Use the other possible template under WinUI 3

Nothing helped.

Any pointers on how to resolve this

Thanks

2
  • Visual Studio 2012 ? are you sure? Commented Feb 17, 2023 at 7:29
  • My mistake - it is VS2022. I just edit the the post. Thanks Commented Feb 17, 2023 at 16:45

1 Answer 1

0

Assuming that you mean Visual Studio 2022, not 2012, here is where you can find the requirements. The list below is a short version of the link. Run the Visual Studio Installer and make sure you have these items selected.

  • Workloads tab:

    • Select .NET Desktop Development.
      • Then, in the Installation details pane on the right, select Windows App SDK C# Templates for C# development.
      • If you also need C++, select Windows App SDK C++ Templates.
  • Individual components tab:

    • Scroll all the way down to SDKs, libraries, and frameworks section and select Windows 10 SDK (10.0.19041.0).
Sign up to request clarification or add additional context in comments.

13 Comments

Yes, all the above is selected. I tried both Windows 10 SDK and Windows 11 SDK. Do I need to select 10.0.19401.0? no other version will work? Thanks
That's what the doc says.
I tried that and it did not make a difference. Same error. Something is very odd. Any other ideas? Thanks
Weird. I just happen to do these steps and had no problem. Can you try other templates? For example, "Blank App, Packaged (WinUI 3 in Desktop)" or the template from Template Studio for WinUI extension.
Also, is your NuGets Package source "nuget.org"?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.