Version Numbering and Deployments

I'd like to have my "Publish application" step (publishing to zip file) auto increment a version number in my application.

I'd like to have this version number in several places:

  1. The name of the packaged zip file
  2. The footer at the bottom of the page.

For #2, I see that is ".\Client\Shared\MainLayout.razor":

<RadzenText Text="MyApp v1.0.0" 

For #1, I see that the "Publish Application" dialog in Radzen is managing Publish Profiles located at:

.\Server\Properties\PublishProfiles\

Is this something the Radzen team might be able to help with?

My ideal here would be to manually set a major/minor:

Ex: "1.0"

Then for each build, just take the timestamp:

Ex. "2023.04.29.0927"

And append it to the zip, and update the Main Layout:

Ex: "1.0.2023.04.29.0927"

This would be a great help in making sure that I'm looking at the right version of my app.

It would be great if this could be done as part of the "Publish App" dialog, but I'm willing to manually update a PublishProfile to get it to work.

Thanks in advance.

Additional Notes:

I can copy/duplicate the "ZipProfile" PublishProfile files, rename them, and they show in the UI.

However, on selecting them in the UI I'm not sure if they are used at all.

Radzen Blazor Studio appears to just create a new Profile called "ZipProfile" if it doesn't exist.

So even trying to append a static value to the zip files' name doesn't work:

<ZipDirectory SourceDirectory="$(PublishUrl)" DestinationFile="$(PublishUrl)\..\$(MSBuildProjectName).zip" Overwrite="true" />

Further,

Testing out the database connection strings:

ZipProfile.pubxml: <Value>Server=zipprofile-database

ZipProfileNew.pubxml: <Value>Server=zipprofilenew-database

When I run "Publish" and select "ZipProfileNew", Radzen Blazor Studio overwrites "ZipProfile.pubxml":

ZipProfile.pubxml: <Value>Server=zipprofilenew-database

Okay I think I've got something working as a solution for both the zipped file name and displaying the same version number in the app footer.

BTW, I'd be happy if the Radzen Blazor Studio team copied this approach or had something that met the versioning need in the Publish section of the app.

Setup steps:

  1. Run ZipPublish at least once, this will create the ZipProfile.pubxml file
  2. Open your solution in Radzen Blazor Studio
  3. Create copy of ZipProfile.pubxml, named "ZipProfileVersioned.pubxml"
  4. In the file, update "$(MSBuildProjectName)" to "$(MSBuildProjectName)-$(Version).zip"
  5. Open Client\Shared\MainLayout.razor, change line 36 to:
<RadzenText Text="@version" ...
  1. Open Client\Shared\MainLayout.razor.cs, under line 35 add:
public string version = typeof(Program).Assembly.GetName().Version.ToString();

Running a publish / build that updates the version number:

  1. Open up Powershell window, navigate to Solution folder
  2. Build with this command:
    dotnet publish -c:Release -p:PublishProfile=.\Server\PublishProfiles\ZipProfileVersioned.pubxml /p:Version=1.$((Get-Date).ToString("yyMM")).$((Get-Date).ToString("dd")).$([System.Math]::Floor((Get-Date).TimeOfDay.TotalMinutes)) /p:AssemblyVersion=1.$((Get-Date).ToString("yyMM")).$((Get-Date).ToString("dd")).$([System.Math]::Floor((Get-Date).TimeOfDay.TotalMinutes))

So this will put the zip in the same folder as "Publish", but the name will be:

MyApp-1.2304.29.749.zip

And when your app is running, the footer will display the full version number in the footer.

Notes:

  • In the build command the Major version number is hardcoded in two spots as "1."
  • The build command sets both the "Product Version" and "File Version" to the same number
  • The footer code reads the "File Version"
  • Version number format is .<2digitYear><2digitMonth>.<2digitDay>.

I needed the weird format as there are some restrictions on the version number format.