8

Here is the help file I am using. It states that it still applies to version 4.6.

Yet, when I try to use the built-in calculations, with the following code:

[assembly: AssemblyVersion("2015.7.*.*")]
[assembly: AssemblyFileVersion("2015.7.*.*")]

I get syntax errors on the asterisk, and the solution won't compile. I am not sure what is going on. According to the help file, it should be working.

2 Answers 2

13

You don't need two * just one is enough.

[assembly: AssemblyVersion("2015.7.*")]

From your link

Examples of valid version strings include:

1

1.1

1.1.*

1.1.1

1.1.1.*

1.1.1.1

Remove the AssemblyFileVersion.

If the AssemblyFileVersionAttribute is not supplied, the AssemblyVersionAttribute is used for the Win32 file version that is displayed on the Version tab of the Windows file properties dialog.

6
  • 2
    Hi, I have tried that. When I use that: '[assembly: AssemblyFileVersion("2015.7.*")]' I get an error: The specified version string does not conform to the recommended format - major.minor.build.revision
    – Choatech
    Commented Jul 24, 2015 at 2:01
  • 4
    Worth noting that any of the version components should be in the range [0; UInt16.MaxValue - 1]. msdn.microsoft.com/en-us/library/…
    – Alex M
    Commented Dec 3, 2015 at 8:47
  • Is there a way to achieve this in the new csproj format (in .NET Core or Standard projects)? Commented Oct 10, 2017 at 9:02
  • 1
    I get the same error in vb with their own example from their comment: <Assembly: AssemblyVersion("1.0.*")> The specified version string does not conform to the required format - major[.minor[.build|*[.revision|*]]]
    – jo0ls
    Commented Sep 28, 2018 at 10:35
  • 3
    If your Project File has <deterministic> set to TRUE then you are not allowed WildCards in the assembly version. This seems to be the default in a new .Net 4.7.2 windows form application. A deterministic build is byte for byte identical when you rebuild it without changes. So you can't have deterministic and wildcards at the same time as the wildcard needs to change with each build.
    – jo0ls
    Commented Sep 28, 2018 at 10:50
0

Answer based on the comment from @jo0ls.

Close down Visual Studio and open the project file (*.csproj or *.vbproj) in a text editor. Search for "Deterministic" which is enabled by default from .NET 4.7.2. Set to "false" or delete the entry in the project file to allow wildcards in the AssemblyVersion attribute.

For some background on the Deterministic compile option see this link. The option ensures repeated builds produce byte-for-byte identical binaries (i.e. version information must not change, hence no wildcards allowed).

Another reason for this error is specific to VB.NET. AssemblyInfo.vb must be in a folder named exactly "My Folder". Say you rename the folder to "MyFolder" and manually update the .vbproj file to point to the renamed folder. The project builds, but only default version information will be included in the assembly. Data in AssemblyInfo.vb is ignored and wildcards in the AssemblyVersion attribute generate compiler error BC36962 "The specified version string does not conform to the required format".

Not the answer you're looking for? Browse other questions tagged or ask your own question.