<AssemblyFileVersion> property is empty
msedi opened this issue · 2 comments
I'm not sure, it seems I'm a bit dumb, because I think this must work.
We need to distribute our application via ClickOnce and we wanted to take the AssemblyFileVersion
as the ApplicationVersion
of ClickOnce, the pubxml
looks like this.
<Project>
<PropertyGroup>
<ApplicationVersion>$(AssemblyFileVersion)</ApplicationVersion>
But it seems the AssemblyFileVersion
is not set. Looking deeper in the binlog, it is really not set. I thought that nerdbank is creating those properties since also GenerateAssemblyFileVersion=false
but I couldn't find where these properties are generated in the resulting files (even in the obj folders). Also the bin log shows no AssemblyFileVersion
.
Nerdbank.GitVersioning does indeed set these properties, but it cannot set them in the msbuild evaluation model -- it sets them inside a <Target>
. That means you can't set your dependent property until after NB.GV has run. Something like this should work for you:
<Target Name="SetApplicationVersion" DependsOnTargets="GetBuildVersion" AfterTargets="GetBuildVersion">
<PropertyGroup>
<ApplicationVersion>$(AssemblyFileVersion)</ApplicationVersion>
</PropertyGroup>
</Target>
Awesome. Thanks. That solved it.