Today I get the version specified for the "product version", which is not in the standard warning format "major.minor.build.revision".
This is due to the use of AssemblyInformationalVersionAttribute .
My build attributes:
[assembly: AssemblyInformationalVersion("XXX 1.1.0")] [assembly: System.Runtime.InteropServices.ComVisible(false)]
Basically, the compiler complains about XXX 1.1.0 , which is not like xyzr . From MSDN:
The information version contains additional version information for the assembly in lowercase format. It is intended for informational purposes only and is not used at run time. Although you can specify any text, a warning message appears during compilation if the line is not in the format used by the version number of the assembly, or if it is in this format but contains wildcards. This warning is harmless.
Thus, they say that there can be a dangerously harmless warning. The problem is that it breaks my build. I canโt even suppress warning CS1607 (I tried this at the project level, without effect), as suggested in the following error http://connect.microsoft.com/VisualStudio/feedback/details/275197/assemblyinformationalversion-should-not-generate -cs1607
In fact, everything was fine (without warning) until I added localized resources to my project. I used to have a MyResources.resx file in a project. I added a localized file MyResources.fr.resx , and this resource is the source of the warning (or at least: if I delete this file from the project, it compiles without warning).
I don't see any connection between CS1607 (associated with x64 vs x86), AssemblyInformationalVersionAttribute and localized resource file ...
How can I fix my project to use XXX 1.1.0 as an AssemblyInformationalVersionAttribute without any (even harmless) warning?
I'm not so sure about the suppression of warning CS1607 (which can be useful in case of incorrect links), but I was not even able to suppress it.
Notice, I realized that this is CS1607 using googling, the compiler never returned the actual warning code.
Also note that my project is targeting .Net 2.0 and switching to .Net 4.0 fixes the problem (but of course I cannot do this).
Any explanation is appreciated.
PS: CS1607: the version specified for the "file version" is not in the normal format "major.minor.build.revision" in .NET , the question is not related (not about AssemblyInformationalVersion )
EDIT: Thanks Hans Passant. From your answer, I understand that AssemblyInformationalVersion used to generate two ProductVersion values โโavailable in the Win32 VersionInfo structure.
- If the
AssemblyInformationalVersion attributes are empty, AssemblyVersion used instead. - If
AssemblyInformationalVersion is xyz , then the values โโof ProductVersion xyz . - If
AssemblyInformationalVersion is another string, the numeric value of ProductVersion not set ( 0.0.0 ), and only the text value ProductVersion .
I do not understand why the warning CS1607 is generated by the compiler only under certain circumstances: in my case, only when the project contains localized files and tasks resx.Net 2.0 .
I used the string in AssemblyInformationalVersion years without warning until yesterday, when I added a localized resx to the project.
I am fine if the ProductVersion value is not specified (as you said, only a textual and human-readable value is important to me), but is there a way to prevent the warning from appearing?
EDIT 2:
I created a very small sample solution that demonstrates the problem: http://sharesend.com/mb371c3l
- First compilation: expected CS1607, raised by the compiler.
- Then delete
Logon.aspx.fr.resx and rebuild everything: there are no more warnings on my machine for an unknown reason.