question

SimonSays-7439 avatar image
0 Votes"
SimonSays-7439 asked SimonSays-7439 commented

Set <ApplicationDisplayVersion> using Target BeforeBuild in csproj

Before project builds, I would like to read from external source and set the <ApplicationDisplayVersion>. In my csproj, I've the following:

...
<Target Name="CalculateVersionCodeProperties" BeforeTargets="Build">

    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <ApplicationDisplayVersion>1.2.3</ApplicationDisplayVersion>
        <ApplicationVersion>2</ApplicationVersion>
    </PropertyGroup>
</Target>
...

But the above doesn't seems to work. When running AppInfo.VersionString in the code, it is showing the default 1.0.0; it should read 1.2.3

Any pointers? Thanks.

dotnet-mauivs-msbuild
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please provide more detailed information about what doesn't work, in what way, and what is your expected behavior?

You could use MSbuild to check log for confirming whether <ApplicationDisplayVersion> works.

If you want to read your BuildNumber from an external file when it runs, the following documentations would be helpful for you to create task to do it:

0 Votes 0 ·

Why it doesn't work: When running AppInfo.VersionString in the code, it is showing the default 1.0.0

Expected Behavior: It should show 1.2.3

My question is not about how to read my BuildNumber from external file. But whether if there is a way to set <ApplicationDisplayVersion> in MSBuild Task

0 Votes 0 ·

0 Answers