I'm using Visual Studio 2005 SP1 and language is C++
How can I automatically change the version number every time I build the
project ?
Thanks.
Walter Wang [MSFT] - 07 Feb 2007 06:15 GMT
Hi Michael,
I'm afraid you will have to do this using Macro, with help of the build
event OnBuildDone
(http://msdn2.microsoft.com/en-us/library/aa300715(VS.71).aspx).
Here're some examples on how to do that:
#CodeGuru: An Automatic Build Number Incrementer for Visual Studio .NET
http://www.codeguru.com/csharp/.net/net_vs_addins/article.php/c5961/
#CodeGuru: Automatic Build Number Increasing Macro for VS.NET
http://codeguru.earthweb.com/csharp/.net/net_vs_addins/visualstudioadd-ins/a
rticle.php/c5959/
Please try it and let me know if it works for you.
Sincerely,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Dexlex - 07 Feb 2007 07:09 GMT
Michael,
change the AssemblyVersion entry in AssemblyInfo.cs to
[assembly: AssemblyVersion("1.0.*")]
and
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
will return a different string (e.g. "1.0.2593.26374") on each build, which
corresponds to the build time.
> I'm using Visual Studio 2005 SP1 and language is C++
>
> How can I automatically change the version number every time I build the
> project ?
>
> Thanks.
Michael Tissington - 07 Feb 2007 16:39 GMT
Thanks, but I'm not using C# I'm using c++
> Michael,
>
[quoted text clipped - 15 lines]
>>
>> Thanks.
Walter Wang [MSFT] - 08 Feb 2007 03:41 GMT
Hi Michael,
I just found out that my reply from yesterday (see below) is not shown
correctly in the web interface of MSDN Managed Newsgroup here
The strange thing is that it's ok in Outlook Express. It might be an issue
of the web interface, we're sorry for the inconvenience caused. Here's the
reply again:
====================
From: wawang@online.microsoft.com (Walter Wang [MSFT])
Date: Wed, 07 Feb 2007 06:15:36 GMT
Subject: RE: Auto change version # in VS2005 C++
Newsgroups: microsoft.public.vstudio.extensibility
Hi Michael,
I'm afraid you will have to do this using Macro, with help of the build
event OnBuildDone
(http://msdn2.microsoft.com/en-us/library/aa300715(VS.71).aspx).
Here're some examples on how to do that:
#CodeGuru: An Automatic Build Number Incrementer for Visual Studio .NET
http://www.codeguru.com/csharp/.net/net_vs_addins/article.php/c5961/
#CodeGuru: Automatic Build Number Increasing Macro for VS.NET
http://codeguru.earthweb.com/csharp/.net/net_vs_addins/visualstudioadd-ins/a
rticle.php/c5959/
Please try it and let me know if it works for you.
====================
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Michael Tissington - 13 Feb 2007 17:13 GMT
Thanks Walter - the solution from Anders is what I was looking for.
Anders Eriksson - 08 Feb 2007 08:49 GMT
> I'm using Visual Studio 2005 SP1 and language is C++
>
> How can I automatically change the version number every time I build the
> project ?
You have to create an add-in.
Fortunately Mr. Brandon Sneed already has done this ;-)
http://www.codeproject.com/csharp/vsautover.asp
// Anders

Signature
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may improve my English!