943,690 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 815
  • C# RSS
Nov 5th, 2008
0

auto incrementation of assembly

Expand Post »
hi all,
here i got strucked on auto incrementation of version using c# ,iam trying to do it programatically but i could able to change version number in variables but iam not able to write it back as it is read only.Is there any alternative for this?.

my code is as follows.


C# Syntax (Toggle Plain Text)
  1. string versionnum;
  2. int rev;
  3. int major;
  4. int minor;
  5. int build;
  6. Assembly assem = Assembly.GetExecutingAssembly();
  7. AssemblyName assemName = assem.GetName();
  8. applicationVersion = assemName.Version;
  9.  
  10. major = Convert.ToInt32(applicationVersion.Major);
  11. minor = Convert.ToInt32(applicationVersion.Minor);
  12. build = Convert.ToInt32(applicationVersion.Build);
  13. rev = Convert.ToInt32(applicationVersion.Revision) + 1;
  14. versionnum = major+"."+minor+"." + build + "." + rev;
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrkcse is offline Offline
9 posts
since Apr 2008
Nov 5th, 2008
0

Re: auto incrementation of assembly

You should be changing the version in the compile, not at runtime. Versions are read only at runtime.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Nov 5th, 2008
0

Re: auto incrementation of assembly

think you got your revision number hardcoded probably if its not changing, take a look at your assemblyinfo.cs file

you can do this get revision to change automatically

C# Syntax (Toggle Plain Text)
  1. [assembly: AssemblyVersion("1.1.1.*")]
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 6th, 2008
0

Re: auto incrementation of assembly

Please anyone tell me how to increment version no at compile time.

I have tried by placing following line in assemblyinfo.cs file still its not working
C# Syntax (Toggle Plain Text)
  1. [assembly: AssemblyVersion("1.0.0.*")]
Last edited by mrkcse; Nov 6th, 2008 at 12:21 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrkcse is offline Offline
9 posts
since Apr 2008
Nov 6th, 2008
0

Re: auto incrementation of assembly

that one changes revision btw

also check the same for

C# Syntax (Toggle Plain Text)
  1. AssemblyFileVersion

you can look at it in
Project -> Properties ->Application -> Assembly Information

also if you really feel lazy you can use this add in
http://www.codeproject.com/KB/macros/vsautover.aspx
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 6th, 2008
0

Re: auto incrementation of assembly

Thanks for the replies, i got the solution. Actually it is incrementing but in my application more than one dll we are using,it is pointing to other dll. so , i have taken primary output assembly version and now it is giving inremented version no everytime.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrkcse is offline Offline
9 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Encryption Problem
Next Thread in C# Forum Timeline: wrong output





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC