473,785 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

generate AssemblyInfo by using CVS-tags -> Catch 22

Hi all,

we use CVS to manage versions of our code. Since the CVS keeps track of
everything we need I want to synchronize the assembly info with CVS.
The problem is that if I update the assembly info the file is no longer
up-to-date with our CVS-repository. Also if I check the file in to the
CVS-repository the assembly info is no longer up-to-date.

I've seen the 1.0.* -trick and I can accept it on the AssemblyVersion
but the AssemblyFileVer sion should be in sync with the CVS's
fileversion.

I also tried using
[assembly: AssemblyFileVer sion("$Revision : 2.345 $")]
but it is ugly and it gives me a warning upon compilation.

Has anyone done this before me and found a solution? (Anything is
helpful)
*Current solution*
The information I want to use is found in f.x. the text generated in
$Id $ by CVS, typically it expands to something like this when I check
into CVS:
$Id: AssemblyInfoGen erator.cs,v 2.345 2007/01/18 13:04:12 per Exp $
($Id: filename,v version date time user status$)

I made a little program that scans my folders for .cs files and if it
finds one it scans the file for the Id-tag, and if it finds any Id-tag
it updates the AssemblyInfo (if it finds it) of the file by this
pattern:

majorVersion = "1."
AssemblyVersion = majorVersion . year . dayofyear . minuteofday
AssemblyFileVer sion = majorVersion . CVSversion

Example:
// $Id: AssemblyInfoGen erator.cs,v 2.345 2007/01/18 13:04:12 per Exp $

// using...

[assembly: AssemblyTitle(" AssemblyInfoGen erator")]
[assembly: AssemblyVersion ("1.2007.18.252 ")] // major version . year .
dayofyear . minuteofday
[assembly: AssemblyFileVer sion("1.2.345")] // majorversion . CVSversion
// more items that are static

// the rest of the file
But since CVS needs to have checked in to have the $Id $ up-to-date I
cannot generate the assembly info before I check in. And vice versa.
*Another try*
I also tried using some strings that I cut and pasted in, for example
string author = "$Author: per $";
string revision = "$Revision: 2.345 $";

But it seems I cannot execute code in these lines. Something that would
have been great is:
[assembly: AssemblyFileVer sion("1."+"$Rev ision: 2.345
$".Replace("Rev ision:", "").Replace("$" , "").Replace (" ", "") + ".0")]

gives me
Error 1 An attribute argument must be a constant expression, typeof
expression or array creation
expression C:\work\v5\devT ools\AssemblyIn foTests\CVS2Ass embly\CVS2Assem bly.cs 24 32 CVS2Assembly
*Ugly solution (using DoubleThink)*
I could do something like this: before checking in a file I update to
this
version = major version . year . month .dayofmonth
fileversion = major version . current CVS major version . *current
CVS minor version + 1*

This could work just fine but is not as pretty as having assembly info
generated, also it does not give me the time, only the date (pretty
acceptable perhaps).

Any comments on how one *should* do (and how you do do) are welcome.

Thanks,
Per Erik Strandberg

Tired of loosing file when deleting from the console?
Try toTrash: http://www.pererikstrandberg.se/projects/totrash/

----------------------------

"It is white."
-George W. Bush, asked by a child in Britain what the White House was
like.

Jan 18 '07 #1
0 1351

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2550
by: jtsree | last post by:
i am using Visual Studio.net professional 2003 (VisualBasic.net).I am building a very very simple project where i need to connect to Microsoft access database through OledbDataAdapter in design mode by Dragging the OledbDataAdapter Control from the Data tab on the ToolBox and then generate the DataSet. I am able to connect to MS ACCESS and test connection is succedded.Now when i try to generate the Dataset by Right Clicking The Data...
1
1884
by: ½£¾ªºè | last post by:
Give an example:When user pressed "B" or "b",HOOK get that message and let TextBox1.text display "a". The executing founction is as following: **************************************** IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam) { if( code < 0 ) return CallNextHookEx(_nextHookPtr,code, wparam, lparam); if( wparam.ToInt32() == 98 || wparam.ToInt32() == 66 ) {
1
2397
by: Marc Boucher | last post by:
I'm using PG 7.3.4 I've a table with a column of type int8 where I store date-based values, and an index exists for it. The problem is that the index is almost never used with the '>' test. # explain SELECT date FROM album WHERE (date='1093989600'); Index Scan using date_album_key on album (cost=0.00..86.31 rows=21 width=8) Index Cond: (date = 1093989600::bigint)
4
4699
by: Kevin Blount | last post by:
As mentioned before, I'm creating a multi-lingual page where the text of the page comes from a database. This page includes a registration form which asks for address information, including the Country. I have 6 .txt files that contain a complete list of countries that we sell to (65 in total), each written in the appropriate way for the language of the site, e.g. Mexico for English US and UK sites and México for the Spanish language...
3
1830
by: Fred Chateau | last post by:
To catch an exception associated with resources within a Using block, does the Catch block go within the scope of the Using block or following it? If within the scope of the Using block, what about nested Using statements? Will a Catch block in the innermost Using block catch all exceptions? -- Regards, Fred Chateau
4
8928
by: cj | last post by:
my old code Try Dim sw As New System.io.StreamWriter(fileName, True) sw.WriteLine(strToWrite) sw.Close() Catch End Try my new code
2
1431
by: bindu123 | last post by:
Hi All, I have to generate a line chart in C on windows, using distance in the X-axis and throughput in Y-axis. Is it possible to generate charts using C programming in windows ? and i also i would like to develop a GUI interface, please guide me what should be used for the same ? Thanks for your help...
3
1729
by: parez | last post by:
Whats the best way of handing exception of using? Is it method 1 or method 2 or some other way ########## Method 1 ########### using(something) { try { } catch {
0
1290
by: Teka Cherenet | last post by:
I am newer for programming world in C# and SQL Server. so I wonder if it is possible to have a sample code which illustrates how to generate report using C# code. thank you
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.