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.
By default, Visual Studio automatically increments the Revision number of the Publish Version each time you publish the application. You can disable this behavior on the Publish page of the Project Designer.
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > Linker > General property page. Modify the Version property.
Versioning is the creation and management of multiple product releases, all of which have the same general function, but are improved, upgraded or customized. While many developers and vendors use the term in different contexts, versioning most often applies to operating systems, software artifacts and web services.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With