How do I get AssemblyVersion stamped as FileVersion on the binary
According to Microsoft.NET.GenerateAssemblyInfo.targets
project if you don't specify FileVersion
property and set GenerateAssemblyFileVersionAttribute
to false
then FileVersion
property value will be equal to AssemblyVersion
property.
Try to modify you csproj file like this:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>1.0.*</AssemblyVersion>
<!-- Comment or delete this line. -->
<!-- <FileVersion>1.0.*</FileVersion> -->
<Deterministic>false</Deterministic>
<PackageId>Demo</PackageId>
<Company>My Company</Company>
<Copyright>Copyright © Xyzzy 2020</Copyright>
<Description>Description</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<!-- Set this attribute to false. -->
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyTitleAttribute>true</GenerateAssemblyTitleAttribute>
<GenerateAssemblyConfigurationAttribute>true</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>true</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>true</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>true</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>
</Project>
This approach worked for me. After making above changes to csproj file I was able to see FileVersion
in the file properties window.