Skip to content

Instantly share code, notes, and snippets.

@aritchie
Created October 16, 2022 01:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aritchie/fa5be94f831f0fe9aaefd22b029915d7 to your computer and use it in GitHub Desktop.
Save aritchie/fa5be94f831f0fe9aaefd22b029915d7 to your computer and use it in GitHub Desktop.
MAUI Single Project /w NET6.0 for unit tests
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--net6.0 at the end makes vs4mac happy-->
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android;net6.0</TargetFrameworks>
<OutputType Condition="'$(TargetFramework)' != 'net6.0'">Exe</OutputType>
<RootNamespace>MyNamespace</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationTitle>My App</ApplicationTitle>
<ApplicationId>com.shinysoft.myapp</ApplicationId>
<ApplicationIdGuid>85C81D9D-257A-496B-96D8-E4922B5D6864</ApplicationIdGuid>
<ApplicationDisplayVersion>2.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'net6.0-ios' OR '$(TargetFramework)' == 'net6.0-maccatalyst'">
<IsAppleTarget>true</IsAppleTarget>
<DefineConstants>$(DefineConstants);APPLE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(IsAppleTarget) == 'true' OR '$(TargetFramework)' == 'net6.0-android'">
<DefineConstants>$(DefineConstants);PLATFORM</DefineConstants>
<IsPlatform>true</IsPlatform>
</PropertyGroup>
<ItemGroup Condition="'$(IsPlatform)' == 'true'">
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<!--All nugets that don't have a net6.0 target go here-->
<ItemGroup Condition="'$(IsPlatform)' == 'true'">
</ItemGroup>
<ItemGroup Condition="'$(IsPlatform)' != 'true'">
<Compile Include="Platforms\NoPlatform\**\*.cs" />
<MauiXaml Remove="**\*.xaml" />
<Compile Remove="**\*.xaml.cs" />
<Compile Remove="MauiProgram.cs" />
<None Include="**\*.xaml" />
<None Include="**\*.xaml.cs" />
<None Include="MauiProgram.cs" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment