1

I still want to let my new csproj generate the version number for my library with the new msbuild. But how do I allow the old msbuild behavior of filling in a random build number with an asterix * placeholder?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jbtule
  • 31,383
  • 12
  • 95
  • 128

1 Answers1

0

First you need to turn off rosyln deterministic builds <Deterministic>False</Deterministic>

Then you can use * safely in <AssemblyVersion> If want to get rid of compiler warnings, us <VersionPrefix> to set <AssemblyVersion> and <FileVersion> separately without duplication.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
...
    <VersionPrefix>1.11.31</VersionPrefix>
    <AssemblyVersion>$(VersionPrefix).*</AssemblyVersion>
    <FileVersion>$(VersionPrefix)</FileVersion>
    <Deterministic>False</Deterministic>
  </PropertyGroup>
jbtule
  • 31,383
  • 12
  • 95
  • 128