Replies: 2 comments 10 replies
-
I added messages to output the generated versions to the console: <Target Name="SpecialTargetTestStep" BeforeTargets="BeforeBuild">
<Message Text="TEST STEP" Importance="high"/>
</Target>
<Target Name="UpdateAssemblyVersion" AfterTargets="MinVer">
<PropertyGroup>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
<Version>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-$(MinVerPreRelease)</Version>
<PackageVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-$(MinVerPreRelease)</PackageVersion>
<ApplicationDisplayVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-$(MinVerPreRelease)</ApplicationDisplayVersion>
</PropertyGroup>
<Message Text="Update Assembly Version" Importance="high"/>
<Message Text="AssemblyVersion = $(AssemblyVersion)" Importance="high" />
<Message Text="Version = $(Version)" Importance="high" />
<Message Text="PackageVersion = $(PackageVersion)" Importance="high" />
<Message Text="ApplicationDisplayVersion = $(ApplicationDisplayVersion)" Importance="high" />
</Target> And it seems to be correct:
Maybe MinVer is running to late in the build process? |
Beta Was this translation helpful? Give feedback.
-
The problem is that MinVar runs after the platform specific Manifest files have been generated so the version does not effect the actual packages. This is a workaround making the MinVar build step run earlier to update the version numbers before app manifests are generated: <!-- Workaround to make MinVer run earlier -->
<!-- This allows to update Versions before platform manifest files are generated -->
<!-- It also sets ApplicationDisplayVersion and AssemblyVersion -->
<Target Name="MinVerPrerun" BeforeTargets="MauiGeneratePackageAppxManifest">
<Message Text="MinVer Prerun" Importance="high"/>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="MinVer" />
</Target>
<Target Name="UpdateVersions" AfterTargets="MinVerPrerun">
<PropertyGroup>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
<ApplicationDisplayVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</ApplicationDisplayVersion>
</PropertyGroup>
<Message Text="Update Versions" Importance="high"/>
<Message Text="AssemblyVersion = $(AssemblyVersion)" Importance="high" />
<Message Text="Version = $(Version)" Importance="high" />
<Message Text="PackageVersion = $(PackageVersion)" Importance="high" />
<Message Text="ApplicationDisplayVersion = $(ApplicationDisplayVersion)" Importance="high" />
</Target> As ApplicationDisplayVersion is not set by MinVar and AssemblyVersion is set to 0.0.0.0 it is updated manually in the second step. |
Beta Was this translation helpful? Give feedback.
-
I am trying to version a .Net MAUI project.
Minver does correctly determine the version from git as seen in the following (detailed) log:
It does however not seem to have any effect on the various versions of the build.
When installing the package and also when getting the version in code via
AppInfo.Current.VersionString
it still displays the versions originally set in the csproj file viaVersion
and/orApplicationDisplayVersion
.I am unsure where to find/get the Assembly version in a MAUI built to validate it.
I also tried to explicitly set the versions as detailed in the custom section but it does not have any effect either:
Beta Was this translation helpful? Give feedback.
All reactions