1

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 *

enter image description here

However, VS2017 tells me

"Assembly file version: In this field, wildcards ("*") aren't allowed.

How can I do this?

tmighty
  • 10,734
  • 21
  • 104
  • 218

5 Answers5

4

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, the AssemblyVersionAttribute is used for the Win32 file versionthat is displayed on the Version tab of the Windows file properties dialog.

Visual Vincent
  • 18,045
  • 5
  • 28
  • 75
  • Sorry, this is not a real solution to my problem as I just found out. – tmighty Nov 09 '17 at 21:55
  • @tmighty : That you want it to work from the command line is a different question though. You never asked for that. -- I think that this feature is only available within Visual Studio, so you might have to use a third-party library for it to work via the command line: https://versioning.codeplex.com/ – Visual Vincent Nov 10 '17 at 06:27
2

I found this:

https://marketplace.visualstudio.com/items?itemName=PrecisionInfinity.AutomaticVersions

It's hilarious that VS doesn't have this built-in.

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • I just found out that this tool doesn't work if I build from the command line, therefore it renders useless for me. – tmighty Nov 09 '17 at 21:56
  • 2
    _It's hilarious that VS doesn't have this built-in_. If you're using the command line compiler, you're not using VS. – Chris Dunaway Nov 13 '17 at 18:40
1

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

Hannah Vernon
  • 3,367
  • 1
  • 26
  • 48
TheFreaky
  • 146
  • 4
0

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.

0

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.

Hannah Vernon
  • 3,367
  • 1
  • 26
  • 48