3

When you are not using .Net Core you could define your Assembly version in AssemblyInfo.cs like so [assembly: AssemblyVersion("2.1.3.*")]. Note in particular the * which means the default build number

In .Net core as far as I can tell the build number is set in the *.csproj file. However, it appears to not like using an * in version. It complains that version number is invalid.

<PropertyGroup>
    <AssemblyVersion>2.1.3.*</AssemblyVersion>
</PropertyGroup>

I have raised an issue on the dotnet/cli project, but to no avail.

So my question is 'How to set default build number in .Net Core'?

baynezy
  • 6,493
  • 10
  • 48
  • 73
  • Duplicate of https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core – EJD Jun 23 '17 at 16:06
  • Possible duplicate of [Auto Versioning in Visual Studio 2017 (.NET Core)](https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core) – Michael Freidgeim Oct 16 '19 at 20:41

1 Answers1

3

The easiest thing to do is have your build system pass in the version on the CLI. For example if you were using powershell and appveyor you could pass dotnet build -c Release /p:Version=2.1.3.$env:APPVEYOR_BUILD_NUMBER

TerribleDev
  • 2,195
  • 1
  • 19
  • 31