12

I'm developing a REST API using ASP.NET Core and want the version number to be automatically incremented. This used to be easily by the following pattern in the AssemblyInfo file: [assembly: AssemblyVersion("1.6.*")].

I have read a couple of suggestions to use gulp or other third party tools to accomplish this, like the answer here

But do I really need a third party tool to get automatically increased version number? Is there no longer a built-in feature to support this? It feels like I'm missing something here.

6
  • 2
    Did you see this issue Commented Jan 4, 2017 at 10:01
  • No, I did not - but now I have :-) I may be stupid, but I don't really understand if it should be possible to automatically increase my version number without using any third party tools or scripts. Commented Jan 4, 2017 at 10:07
  • Maybe it will return in a later release Commented Jan 4, 2017 at 10:10
  • So you mean that it may be possible to automatically increase version numbers in a later release? Commented Jan 4, 2017 at 10:46
  • Who can say? they might, they might not. Commented Jan 4, 2017 at 10:48

1 Answer 1

5

if you call dotnet build /p:Version=YourVersionNumberHere, the build will also set the assembly version. So in your build scripts you can easily read the current build number and set it as the patch.

For example in appveyor the build number is exposed as a variable called APPVEYOR_BUILD_NUMBER, so if you were to use powershell you could call dotnet build /p:Version=1.0.$env:APPVEYOR_BUILD_NUMBER

I do something similar with appveyor here, where I set the version number of my nuget package to be the github tag name, and I set the tag name to be a version. So when I want to do a release I just make a github tag of 1.1.0 for example, and it gets published to nuget.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.