Published 29 September 2005 16:44 by Derek Lakin
Filed Under: , ,

If you ever get all anal about your version numbers then you've probably played around with the AssemblyVersion and AssemblyFileVersion attributes in AssemblyInfo.cs.

In Visual Studio .NET 2003 the AssemblyInfo.cs that you get by default just specifies the AssemblyVersion attribute and the comment above it tells you that you can either explicitly specify or you can specify major.minor.* which generates a build and revision for you.

In Visual Studio 2005 the default AssemblyInfo.cs generated file adds the AssemblyFileVersion attribute aswell. This attribute is the one that is used by Win32 to report the verison and according to the documentation it does not accept wildcards (like AssemblyVersion does), but the comment remains the same.

According to the docs:

"The file version is normally a string of four numbers, separated by periods, reflecting the major version number, minor version number, build number, and revision number; for example, "1.0.4309.00". If version is not in this format, a compiler warning occurs, and the results displayed in the file properties dialog are unpredictable. Wildcards are not supported."

So you can have a generated AssemblyVersion, but not AssemblyFileVersion, however, if you exclude the AssemblyFileVersion (like VS .NET 2K3) then the value is set to the same as AssemblyVersion anyway.

I'm sure somewhere you can change what you get as a default AssemblyInfo.cs, but I haven't found where yet. When I find it I'll set the CLSCompliant and SecurityAttribute permissions too as they both flag warnings when absent if you run a Code Analysis on your project.