1

I have a Blazor app that the generated DLL does not get updated with the referenced <AssemblyVersion>2022.01.14.1</AssemblyVersion> found in the .csproj file.

Nor does the <FileVersion> and <Version>

Microsoft Visual Studio Professional 2022 (64-bit) Version 17.0.5

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
MDC
  • 175
  • 1
  • 12

2 Answers2

1

How do you check the version, from the code or from the file properties?

I tried the scenario you described on a Blazor application, and after building the project in the properties of the .dll file I can see all versions I set in the .csproj

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings> 
    <AssemblyVersion>2022.01.14.1</AssemblyVersion>
    <FileVersion>2022.01.14.1</FileVersion>
    <Version>3.3.3.3-xyz</Version>

And the result can be seen in the image below:

enter image description here

Is it possible that some other external process changes the version in the files after you build?

Cristina Alboni
  • 1,014
  • 9
  • 15
  • @Alboni - if I check the dll after the build of the project the version has not been changed. – MDC Jan 19 '22 at 16:45
  • I use file explorer by going to the file selecting it then alt + enter to bring up the properties. – MDC Jan 20 '22 at 09:40
  • 1
    You can check the file properties from powershell as well: `[Diagnostics.FileVersionInfo]::GetVersionInfo('C:\Temp\MyApp\MyApp.dll')` – Lucas Nov 23 '22 at 23:23
0

You need to have the 'Generate assembly info' option selected in the project properties:

enter image description here

(which is the GenerateAssemblyInfo property in the .csproj file)

 <GenerateAssemblyInfo>True</GenerateAssemblyInfo>

Then the Version property in the first PropertyGroup of the .csproj file will make it through to the file version property in Explorer:

<Version>1.0.1<Version> 

enter image description here

If you have a PropertyGroup with the typical AssemblyVersion and AssemblyFileVersion properties as seen in AssemblyInfo.cs then those will be used instead.

RonnieScotland
  • 132
  • 2
  • 5