Today I'm getting a The version specified for the 'product version' is not in the normal 'major.minor.build.revision' format warning.
It's related to the use of AssemblyInformationalVersionAttribute.
My assembly attributes are:
[assembly: AssemblyInformationalVersion("XXX 1.1.0")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
Basically the compiler complains about XXX 1.1.0 that doesn't look like x.y.z.r. From MSDN:
The informational version provides additional version information for an assembly, in string format. It is for informational purposes only and is not used at run time. Although you can specify any text, a warning message appears on compilation if the string is not in the format used by the assembly version number, or if it is in that format but contains wildcard characters. This warning is harmless.
So they say a warning that is harmless can occur. The problem is, it breaks my build. I can't even suppress the CS1607 warning (I tried that at the project level, no effect) as suggested in the following bug http://connect.microsoft.com/VisualStudio/feedback/details/275197/assemblyinformationalversion-should-not-generate-cs1607
Actually, everything was fine (no warning) until I added localized resources to my project. I previously had a MyResources.resx file in the project. I added a localized MyResources.fr.resx file, and this resource is the source of the warning (or at least: if I remove this file from the project, it compiles without warning).
I don't see any link between CS1607 (related to x64 vs x86), AssemblyInformationalVersionAttribute and a localized resource file...
How could I fix my project so I can use XXX 1.1.0 as AssemblyInformationalVersionAttribute without any (even harmless) warning?
I'm not that OK with suppressing the CS1607 warning (that could be useful in case of wrong references), but I didn't even managed to suppress it.
Do note I found it was CS1607 by googling, the compiler never returned the actual warning code.
Also note my project targets .Net 2.0, and moving to .Net 4.0 fixes the issue (but of course I can't do this).
Any explanation is welcome.
PS:
CS1607: The version specified for the 'file version' is not in the normal 'major.minor.build.revision' format in .NET is question is not related (not about AssemblyInformationalVersion)
EDIT:
Thanks Hans Passant. From your answer, I understand AssemblyInformationalVersion is used to generate the two ProductVersion values available in the Win32 VersionInfo structure.
- If the
AssemblyInformationalVersionattributes is empty, thenAssemblyVersionis used instead. - If
AssemblyInformationalVersionisx.y.z, bothProductVersionvalues arex.y.z. - If
AssemblyInformationalVersionis another string, the number value ofProductVersionis not set (0.0.0) and only the textualProductVersionvalue is set.
What I do not understand, is why the CS1607 warning is only generated by the compiler under some specific circumstances: in my case only when the project contains localized resx files and targets .Net 2.0.
I used a string in AssemblyInformationalVersion for years without any warning until yesterday, when I added a localized resx to the project.
I'm OK with not having the number ProductVersion value set (as you said, only the textual and human-readable value is important for me), but is there a way to prevent the warning from being raised?
EDIT 2:
I've created a very small solution sample that demonstrates the issue: http://sharesend.com/mb371c3l
- First compilation: expected CS1607 raised by the compiler.
- Then remove
Logon.aspx.fr.resxand rebuild all: no more warning on my machine, for an unknown reason.