Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Automatic Versioning
 

Automatic Versioning

I set my AssemblyInfo to version number 1.0.*, so now when I install my program it says its version is "1.0.*". Now from what I've read everywhere (and in the AssemblyInfo.cs file) it should automatically give build and revision numbers, anyone know why it doesn't?

More info:
setting both AssemblyVersion and AssemblyFileVersion to 1.0.*
VS 2008 SP1

Oh and this isn't actually an assembly, it's a windows forms application, but I needa version number so that RemovePreviousVersions will work in my installation project.

ScottyDoesKnow  Tuesday, March 17, 2009 4:24 PM
Hi All,

When you want to havesame Assembly number with Product version, File version. Just when you open AssemblyInfo.vb in Solution Explorer and edit rows:

<Assembly: AssemblyVersion("3.5.*")>
<Assembly: AssemblyFileVersion("3.5.*")>

set second row as comment:

<Assembly: AssemblyVersion("3.5.*")>
'<Assembly: AssemblyFileVersion("3.5.*")>

get Build. And result view on informations:
Pict - information from program
Pict - file properties

Before:
Pict - information from program
Pict - file properties

BetaIQ
  • Proposed As Answer byBetaIQ Tuesday, July 28, 2009 10:39 AM
  • Edited byBetaIQ Tuesday, July 28, 2009 10:37 AMUpdate
  • Edited byBetaIQ Tuesday, July 28, 2009 10:38 AMUpdate
  • Marked As Answer byScottyDoesKnow Tuesday, July 28, 2009 1:18 PM
  •  
BetaIQ  Tuesday, July 28, 2009 10:31 AM

Hi ScottyDoesKnow,

Please look at this related topic.
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/bda19fb9-c76b-4c9f-a287-4fe8acd23edb/

You can use MSBuild to auto increase assembly version number.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Thursday, March 19, 2009 7:31 AM
That task sets the build number to yymmdd, so unfortunately it hasn't worked since 2007 (number cannot be greater than 65534)
ScottyDoesKnow  Thursday, March 19, 2009 2:57 PM
And is there a problem with what I'm doing? Am I doing something wrong here? As far as I know all I should have to do is what I'm doing, set the version to 1.0.* and it should work.
ScottyDoesKnow  Thursday, March 19, 2009 2:58 PM

Hi ScottyDoesKnow,

I want to clarify the concept of each type of the version.

1. AssemblyVersion(in AssemblyInfo.cs file): When you set a "*" to it, it will automatically generate a new version when you build it. For example, set [assembly: AssemblyVersion("1.0.0.*")] first build the assembly, it is 1.0.0.28321 and second build it is 1.0.0.28487. It does change but not increase by 1. You can view this information in the property widow of this file in the Windows Explorer.

You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). For example, [assembly:AssemblyVersion("2.3.25.1")] indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as [assembly:AssemblyVersion("1.2.*")] specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as [assembly:AssemblyVersion("1.2.15.*")] specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is random.
http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx


2. AssemblyFileVersion(in the same file below AssemblyVersion): When you set a "*" to it. it will use that "*" as file version. Just as "1.0.0.*".

3. Setup project version. You cannot use "*" in it Version property. You should use exactly version number like "1.0.0.1".

4. Publish Version(On the publish page of your application): It is ClickOnce publish, the version number will be increased each time you publish.

Overall, when you use "1.0.*" for AssemblyVersion, the default build number increments daily. If you build it more than once times daily, default build number is the same.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, March 20, 2009 8:05 AM
So does the UninstallPreviousVersions property work based on the Setup project version? So I'll always have to manually change it if I want that to work?

And it won't let me use the *'s in AssemblyFileVersion, I can use it in AssemblyVersion but when I try AssemblyFileVersion I get this error:

Assembly File Version:
A wildcard ("*") is not allowed in this field.

This happens when I try 1.0.*.(blank) or 1.0.0.*, and I'm setting this in Properties->Application->Assembly Information...

Edit: and when I go to the dll file in windows explorer, go to properties and to details, both the file and product numbers are 1.0.0.0
ScottyDoesKnow  Friday, March 20, 2009 2:23 PM

Hi ScottyDoesKnow,

VS does not support auto increase version number for MSI package. You need to change that number once you build a new version.

As for the "*" for AssemblyFileVersion and AssemblyVersion, please see the result of my build when I use "*".
Image1
Image2
Image3
Image4

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Monday, March 23, 2009 8:22 AM
Here's what happens when I do that in vista:

http://i42.tinypic.com/23j341f.jpg
ScottyDoesKnow  Monday, March 23, 2009 1:50 PM
And I get the following build warning:

Warning1Assembly generation -- The version '1.0.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' formatPred
ScottyDoesKnow  Monday, March 23, 2009 4:01 PM

Hi ScottyDoesKnow,

I am sorry I don't know you are using Vista, I have done the test on Win2003. After you show me the screenshot, I did the test on Vista and find the same problem.
The document show it support in Vista(almost all windows version).
http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx

I will raise the case to the product team to consult whether it is the problem of Vista or Winform. Thank you for your feedback.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Tuesday, March 24, 2009 2:07 AM
Hi All,

When you want to havesame Assembly number with Product version, File version. Just when you open AssemblyInfo.vb in Solution Explorer and edit rows:

<Assembly: AssemblyVersion("3.5.*")>
<Assembly: AssemblyFileVersion("3.5.*")>

set second row as comment:

<Assembly: AssemblyVersion("3.5.*")>
'<Assembly: AssemblyFileVersion("3.5.*")>

get Build. And result view on informations:
Pict - information from program
Pict - file properties

Before:
Pict - information from program
Pict - file properties

BetaIQ
  • Proposed As Answer byBetaIQ Tuesday, July 28, 2009 10:39 AM
  • Edited byBetaIQ Tuesday, July 28, 2009 10:37 AMUpdate
  • Edited byBetaIQ Tuesday, July 28, 2009 10:38 AMUpdate
  • Marked As Answer byScottyDoesKnow Tuesday, July 28, 2009 1:18 PM
  •  
BetaIQ  Tuesday, July 28, 2009 10:31 AM
Thanks beta, works like a charm.
ScottyDoesKnow  Tuesday, July 28, 2009 1:18 PM

You can use google to search for other answers

Custom Search

More Threads

• Return values of EnableDotNet.exe
• How to install merge modules...?
• .Net framework 1.1 deployement
• How to let the setup program install prerequests offline?
• Upgrade a non-versioned file during upgrade a previous installation??
• User control and resizes!
• Visual Studio setup project treats each file as separate component
• Please tutorial on how to execute scripts with custom actions on installer
• How to Provide optional for user to install dotnet framework before they install setup project
• Composite UI and ClickOnce