473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 AssemblyFileVersion should be in sync with the CVS's
fileversion.

I also tried using
[assembly: AssemblyFileVersion("$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: AssemblyInfoGenerator.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
AssemblyFileVersion = majorVersion . CVSversion

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

// using...

[assembly: AssemblyTitle("AssemblyInfoGenerator")]
[assembly: AssemblyVersion("1.2007.18.252")] // major version . year .
dayofyear . minuteofday
[assembly: AssemblyFileVersion("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: AssemblyFileVersion("1."+"$Revision: 2.345
$".Replace("Revision:", "").Replace("$", "").Replace(" ", "") + ".0")]

gives me
Error 1 An attribute argument must be a constant expression, typeof
expression or array creation
expression C:\work\v5\devTools\AssemblyInfoTests\CVS2Assembly \CVS2Assembly.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 1334

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

Similar topics

1
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...
1
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...
1
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. #...
4
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...
3
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...
4
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
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...
3
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.