Kebechet
Kebechet

Reputation: 2377

.NET MAUI .csproj MSBUILD

When I am developing my MAUI application and I press build. The build process runs for all platforms (I am on windows). But what I want to achieve is build specific to emulator and configuration I have chosen, to speed things up.

I develop mobile app for android and iOS but sometimes I test it on Windows and my colegues on MAC.

So for release it is simple:

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
</PropertyGroup>

but for Debug we currently have just:

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworks);net6.0-maccatalyst</TargetFrameworks>
</PropertyGroup>

What we want to achieve is build specific to current debug emulator/machine that is specified up here: https://i.sstatic.net/8dnxY.png

So in case we have chosen

on the other hand

Is something like this even possible ? Yes, I could theoretically temporarily comment out those frameworks I dont want to build for, but I would rather solve it the MSBUILD way.

Upvotes: 2

Views: 1349

Answers (1)

Jianwei Sun - MSFT
Jianwei Sun - MSFT

Reputation: 4312

But what I want to achieve is build specific to emulator and configuration I have chosen, to speed things up.

You can right click on .csproj and then click Properties. In Application, uncheck the platform you don't want to build. It will automatically comment out those frameworks you don't want to build for.

Upvotes: 0

Related Questions