geronimus avatar image
0 Votes"
geronimus asked YonglunLiu-MSFT edited

.NET MAUI on Windows without Visual Studio - How to make it work?

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'".


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".

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please tell us how to reproduce this issue?

In my testing, I used the following steps for using .NET MAUI on Windows without Visual Studio, and it works fine.

Step1. Install .NET SDK in .

Step2. Install .NET MAUI workload with the dotnet CLI. Launch a command prompt and enter the following:

dotnet workload install maui

Step3. Verify and install missing components with maui-check command line utility.

dotnet tool install -g

Step4. Create a new folder and a new MAUI app.

Step5. Start your Android Emulator.

Step6. Run the MAUI app in the Android Simulator.
dotnet build -t:Run -f net6.0-android

1 Vote 1 ·
geronimus avatar image geronimus YonglunLiu-MSFT ·

Thanks for the great tip! However, when I do this, maui-check reports the following error:

Workload ID android-aot is not recognized.

When I enter dotnet workload search, I see only the following:

  • android

  • android-33

  • ios

  • maccatalyst

  • macos

  • maui

  • maui-android

  • maui-desktop

  • maui-ios

  • maui-maccatalyst

  • maui-mobile

  • maui-windows

  • tvos

  • wasm-tools

Of those, I have only installed maui because I presumed it contained all the others, and because it was the only workload recommended in the macOS command line installation instructions.

I should also mention that I'm not particularly interested in running my app on an Android emulator or deploying to Android.

It's Windows Desktop that I want to target.

0 Votes 0 ·

1 Answer

YonglunLiu-MSFT avatar image
1 Vote"
YonglunLiu-MSFT answered YonglunLiu-MSFT edited


I can reproduce the same issue as you, then I found this GitHub: Build Windows target using dotnet build instead of msbuild.exe, so it looks like that currnetly using dotnet build to build a .NET MAUI app for Windows doesn't work with the current previews of .NET MAUI, but the good news is that we can use the MSBuild to build the MAUI application.

And I have tried it, it works great on my side. In order to use MSBuild without installing Visual Studio, first you can click this link to download Build Tools for Visual Studio 2022.

In Visual Studio 2022, the tool is installed in: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin, you could set the environment variable for it.

Then, you could run the command line to build your MAUI project.

msbuild -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041

MAUI is still in preview testing, and we will fix these issues as soon as possible.:)

Thanks for your feedback.

Best Regards,

Alec Liu.

If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Perfect! Thanks very much for your help!

0 Votes 0 ·