in

ASP.NET Weblogs

MindFill - Brian Carroll's Blog

Do While (WhatYouKnow) < (WhatYouKnow + 1)

AssemblyVersion incrementing in C# vs. VB.NET

By default, Visual Studio.NET sets the AssemblyVersion attribute of an assembly to "1.0.*". (This attribute is defined in the project’s AssemblyInfo file.)

The MSDN documentation implies that using an "*" as shown above will cause the <build number> and <revision> to be incremented each time the assembly is rebuilt.

It works exactly as I would expect for a C# project - rebuild the project, get a new version number.  However, for a VB.NET project the version is only incremented the first time the project is rebuilt after being loaded into VS.NET. Any subsequent rebuilds will not result in the version number being incremented. To increment the version number again you must close the solution, reopen it, and then rebuild it.

It seems to me they should both operate the same way.

Published Jan 21 2004, 05:26 PM by bkcarroll
Filed under:

Comments

 

Raul Macias said:

Do you know how to get the value of AssemblyVersion using C# ?? Thx

raul.macias@cox.net
March 3, 2004 7:05 PM
 

H Garske said:

looks like a bug that MS can't bothered fixing ;-) ...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/tdlg_ch5.asp

"Note For a Microsoft Visual Basic® .NET project with an AssemblyVersion set to "1.0.*", the assembly version is only updated the first time the project is rebuilt within the Visual Studio .NET integrated development environment (IDE). The version number remains constant for subsequent rebuilds within the same instance of Visual Studio .NET. This does not represent a problem because the assembly version is for information only in assemblies that do not have a strong name. For strong named assemblies, you should avoid the use of wild characters in the AssemblyVersion attribute, as explained in the following section.
For C# projects with an AssemblyVersion set to "1.0.*", the assembly version is updated every time the project is rebuilt.
"
July 21, 2004 8:03 AM

Leave a Comment

(required)  
(optional)
(required)  
Add