Reputation: 119
I'm trying to build an Azure Devops pipeline for an iOS and Android app built with .Net Maui. Does anyone know if there are any existing devops tasks to set the version?
The version is now in the csproj file, and I would ideally like to be able to set the values of the following fields:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ApplicationId>com.companyname.</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>0.0.1</ApplicationDisplayVersion>
<ApplicationVersion>0.0.1</ApplicationVersion>
Presumably I could try to write a script that would set the values in the csproj file but that seems a bit clunky.
When I was building xamarin apps, the iOS version was coming from the info.plist file, and for Android it was coming from the manifest.xml, so I'm a bit confused with how .NET Maui has changed things.
Upvotes: 5
Views: 1757
Reputation: 119
I discovered it is possible to set values is the .csproj file by using "/p:" in the build step. So a fairly easy solution is to set the values with:
For example, my iOS build task for .NET Maui looks like this:
- task: DotNetCoreCLI@2
displayName: 'Build iOS app'
inputs:
command: 'publish'
publishWebProjects: false
projects: '$(solutionPath)'
arguments: '-f:net6.0-ios -c:Release /p:RuntimeIdentifier=ios-arm64 /p:CodesignKey="iPhone Distribution" /p:ArchiveOnBuild=true /p:ApplicationId=$(applicationId) /p:ApplicationDisplayVersion=$(version) /p:ApplicationVersion=$(version)'
zipAfterPublish: false
modifyOutputPath: false
Upvotes: 5