Reputation: 11415
I'm trying to raise the revision number with each build.
I've therefore tried to the project assembly information -> Assembly Version and File Version to
1 0 0 *
1 0 0 *
However, VS2017 tells me
"Assembly file version: In this field, wildcards ("*") aren't allowed.
How can I do this?
Upvotes: 1
Views: 7101
Reputation: 3472
Ensure the Projects "Deterministic" property is set to false
by editing the .vbproj file:
<PropertyGroup>
<Deterministic>false</Deterministic>
</PropertyGroup>
Then open the AssemblyInfo.vb
file and set the assembly version property like this: <Assembly: AssemblyVersion("1.0.*")>
Remove or comment-out the <Assembly: AssemblyFileVersion(...)>
attribute since that cannot use wildcards, and if it isn't present, the file will inherit the version assembly number.
Setting the version number to 1.0.*
, as in the above example, results in a version number similar to 1.0.8888.99999
where the build is equal to the number of days since January 1, 2000 local time, and the revision is equal to the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.
See the Docs site for details.
Upvotes: 0
Reputation: 146
I know this is a very old question, however it appears when googling "auto increment version visual studio". Since the current answer doesn't really answer the question, this is what I did:
Assembly Version looks like 1 1 1 *
File Version like 1 1 1 0.
You cannot use wildcards (*) on the file version. If you use them on Assembly leave empty spaces after the wildcard (1 1 * EMPTY).
That works and the error
"Assembly file version: In this field, wildcards ("*") aren't allowed."
does not appear.
If that still gives you trouble, you could remove the "deterministic" flag editing the .csproj
Upvotes: 1
Reputation: 11
Yet another option is: https://neele.name/item/versioning-controlled-build
This one works with Visual Studio 2017.
I found it to be easy to use and has the advantage that you can choose to invoke it or not depending on if you are creating a test build or a release build.
Upvotes: 0
Reputation: 11415
I found this:
https://marketplace.visualstudio.com/items?itemName=PrecisionInfinity.AutomaticVersions
It's hilarious that VS doesn't have this built-in.
Upvotes: 2
Reputation: 18320
You should remove the AssemblyFileVersion
attribute and just keep the AssemblyVersion
. If AssemblyFileVersion
is not present in the Assembly Information, the file version will automatically be set to the same as the AssemblyVersion
at compile time.
Quoting the documentation:
If the
AssemblyFileVersionAttribute
is not supplied, theAssemblyVersionAttribute
is used for the Win32 file versionthat is displayed on the Version tab of the Windows file properties dialog.
Upvotes: 4