Build targets are not only great to differentiate between a Debug and Release builds. You can also use them for targeting different environments or configurations of your app. Now I always like the idea of getting the best performance for apps that I put into my user's hands - in other words; I fancy to enable LLVM
Unfortunately when creating a new Target with Visual Studio 2019 (as of writing 16.5.4) the option to enable LLVM is disabled.
The issue is under consideration by the team, and for the time being, there is no way to enable LLVM via the UI Wizard in Visual Studio. Now one way to solve this is to clone your solution on to a machine running macOS and then enabling it in Visual Studio for Mac. But under Windows, the only option is to open up the
csproj file and enable LLVM manually:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Stuff --> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Gnabber|iPhone'"> <OutputPath>bin\iPhone\Gnabber\</OutputPath> <DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants> <Optimize>true</Optimize> <PlatformTarget>AnyCPU</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <LangVersion>7.3</LangVersion> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <!-- Add the line bellow --> <MtouchUseLlvm>true</MtouchUseLlvm> </PropertyGroup> <!-- More Stuff --> </Project>
Thanks, Victor Garcia Aprea for pointing this out to me and I hope this can be of some help to anyone out there stumbling over the same problem. If you want to check
You can find a small sample Project with a custom build target
Gnabber up on GitHub.