The macOS install example works perfectly, but when I try the same thing on Windows... no dice!
First I tried dotnet build -f net6.0-windows on the raw template project and got NETSDK1135: SupportedOSPlatformVersion 10.0.17763.0 cannot be higher than TargetPlatformVersion 7.0.
So I looked over the Windows install instructions for Visual Studio and gave this a go: dotnet build -f net6.0-windows10.0.19041
And got: NETSDK1005: Assets file ... doesn't have a target for 'net6.0-windows10.0.19041'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041' in the TargetFrameworks for your project.
So, I edited my .csproj file (with vim, of course!) and added net6.0-windows10.0.19041 to the colon-separated list in the TargetFrameworks element.
This time: MSB4185: The function "Is64BitProcess" on type "System.Environment" is not available for execution as an MSBuild property function.
So, after some searching and reading, I found evidence suggesting that the problem was that I was using the current (at time of writing) version of the dotnet CLI utility, which was 6.0.202. (Is it the CLI utility version or the SDK version? The docs don't make it clear to me.)
So I used winget to install a Preview version of dotnet (7.0.100-preview.3.22179.4) and got: To build this project, the following workloads must be installed: wasm-tools
Okay. Patience. dotnet workload install wasm-tools
And now, when I try to build: NETSKD1139: The target platform identifier android was not recognized.
So I removed everything except net6.0-windows10.0.19041 from my .csproj file's TargetFrameworks element, and got:
MSB4086: A numeric comparison was attempted on "$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentVersion)" that evaluates to "" instead of a number, in condition "'$(AppxUseResourceIndexerApi)' == '' AND '$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentVersion)' < '6.3'".
Argh!
What... is... going... on...?
So, why don't you just give yourself a break and use Visual Studio?
So glad you asked! It could be one of many things. Perhaps...
I've tried, but my company Windows device won't let me turn on Developer Mode.
The licensing terms don't really work for my situation.
Visual Studio hides the build process, meaning that when problems like the above arise, I'm completely mystified about what's causing them. Or conversely, when things do work, I don't understand why they worked. It's all just "magic".