5

I have a common assembly file where I have tried to turn off a warning:

warning CS1607: Assembly generation -- The version '2.0.4.121106' specified for the 'file version' is not in the normal 'major.minor.build.revision' format

I have done this but it isn't working:

#pragma warning disable 1607    
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.4.121106")]
[assembly: AssemblyInformationalVersion("2.0.0.0")]
#pragma warning restore 1607

So is there some way to do this in the code?

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
user1423277
  • 109
  • 2
  • 13
  • 2
    This warning is there for a reason. Because at the OS-level each part of the version number can only be 16 bit, the OS will display a broken version number if you ignore this error. In your case the OS version number would be displayed as 2.0.4.55570. – bitbonk Nov 16 '12 at 10:39

2 Answers2

13

The reason why you are getting the error is because the revision number is greater than 65534. And I found researching the same problem for my solution is that there is no way (or easy/correct) to suppress this warning. But in order for us to get around it we found that we could set the following code in out AssemblyVersion.cs with your versions as an example:

[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.4.121106")]

This will make it the Product Version of our dlls "2.0.4.121106" when viewing the details of the Properties > Details of our dlls.

Sean Keating
  • 1,718
  • 14
  • 28
9

You can do it in project properties on "Build" tab. There is a field called "Suppress warnings" where you should put "1607" there.

Dima
  • 6,721
  • 4
  • 24
  • 43
  • 3
    Also, note that this will disable ALL other (probably valuable) CS1607 warnings too, not just the one with the version number. – bitbonk Nov 16 '12 at 10:26