Have looked at this problem for 3 days. I cannot build NET6 for OS 10 on my dev system. I can build for os7 or os8 using the simplest "WinFormsApp1"
I tried several suggestions googling that "NuGet restore" but none worked
[App Property Image] (this did not work so I pasted the image below)
--and--
On another win11 system I did a clean install of VS2022 and had no problem building for NET6 OS 10 that exact sample app.
The only difference I can tell is that VS2022 on my system has extensive c++ development and my VS2022 has been upgrade from early versions of VS2022 unlike the fresh install that was basically C#
What I have tried
repaired VS2022
manually deleted the nupkg at C:\Program Files\dotnet\library-packs and reinstall MAUI SDK. This actually got me the latest versions of those nupkg unlike just removing MAUI and then adding it back in using the installer
Brought up VS2022 "about" on both systems, did a "copy info" on each and looked, comparing (as best as I could) to see if I was missing something on my development system.
Tried the following
C:\Users\josep\Downloads>nuget restore c:\Users\josep\source\repos\WinFormsApp1
MSBuild auto-detection: using msbuild version '17.6.3.22601' from 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\bin'.
Restoring packages for c:\Users\josep\source\repos\WinFormsApp1\WinFormsApp1.csproj...
NU1101: Unable to find package Microsoft.Windows.SDK.NET.Ref. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Package source
Generating MSBuild file c:\Users\josep\source\repos\WinFormsApp1\obj\WinFormsApp1.csproj.nuget.g.props.
Writing assets file to disk. Path: c:\Users\josep\source\repos\WinFormsApp1\obj\project.assets.json
Failed to restore c:\Users\josep\source\repos\WinFormsApp1\WinFormsApp1.csproj (in 457 ms).
I do not know what else to do other than using revo uninstaller and removing VS2022 community for a clean install.
the above did not work either
Is there a xml or config file for Visual Studio Installer that I can copy from the working system over to the one that cannot build OS 10?
I did the export and import but still did not work. I also installed VS2022 on another system, win11, and it worked fine. Just cannot get past that SDK missing.