0

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

Moshe Yalovsky
  • 121
  • 1
  • 1
  • 8

1 Answers1

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).
Andrew KeepCoding
  • 7,040
  • 2
  • 14
  • 21
  • 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 – Moshe Yalovsky Feb 17 '23 at 16:43
  • That's what the [doc](https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=cs-vs-community%2Ccpp-vs-community%2Cvs-2022-17-1-a%2Cvs-2022-17-1-b#required-workloads-and-components:~:text=On%20the%20Individual%20components%20tab%20of%20the%20installation%20dialog%20box%2C%20in%20the%20SDKs%2C%20libraries%2C%20and%20frameworks%20section%2C%20make%20sure%20Windows%2010%20SDK%20(10.0.19041.0)%20is%20selected.) says. – Andrew KeepCoding Feb 17 '23 at 23:50
  • I tried that and it did not make a difference. Same error. Something is very odd. Any other ideas? Thanks – Moshe Yalovsky Feb 18 '23 at 14:32
  • 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](https://marketplace.visualstudio.com/items?itemName=TemplateStudio.TemplateStudioForWinUICs) extension. – Andrew KeepCoding Feb 18 '23 at 15:07
  • Also, is your [NuGets Package source](https://learn.microsoft.com/en-us/azure/devops/artifacts/nuget/consume?view=azure-devops&tabs=windows#:~:text=when%20you%27re%20done.-,Install%20packages%20from%20your%20feed,-Now%20that%20you) "nuget.org"? – Andrew KeepCoding Feb 18 '23 at 15:18
  • I will add a reply to myself in order to attach screenshots. – Moshe Yalovsky Feb 18 '23 at 17:41
  • Actually, I don't see how to add an attachment to this thread. Do you know how? Is there a way in Stackoverflow to contact you directly? – Moshe Yalovsky Feb 18 '23 at 17:46
  • Let's try this https://drive.google.com/file/d/1Y08gsQF4-7TZsN29p9zrBWc9JufnBb8E/view?usp=sharing – Moshe Yalovsky Feb 18 '23 at 17:50
  • <> What is your setup? OS is Windows 11? What version? VS2022 - community? What version? Thank much – Moshe Yalovsky Feb 19 '23 at 16:52
  • It's Win11 (22000.1574), VS 2022 Preview but I doubt that this is a version related issue. And sorry. I'm not allowed to click external links. You should be able to paste images from clipboard in your question. – Andrew KeepCoding Feb 20 '23 at 04:52
  • I have used the latest version of VS 2022 and as you said it is probably not version related but still very wired. Thank you very much. I am giving it up for now as it is taking so much time. I might try using my other laptop with Windows 10. – Moshe Yalovsky Feb 22 '23 at 22:27
  • Sorry to hear that. Let me drop [this](https://github.com/microsoft/WindowsAppSDK/issues/3161) just in case. – Andrew KeepCoding Feb 22 '23 at 23:42
  • I didn’t have the time to try but this is very similar to my issue. I am out of the country with another laptop, But certainly going to try it and report back. Thank you very much! – Moshe Yalovsky Feb 24 '23 at 10:32