views:

366

answers:

4

Hi Everyone-
I am building a C# solution in Visual Studio 2008 that has several projects and project dependencies.
I am looking for a way to change dll version numbers ONLY when the code that builds the project changes.

I currently use Beyond Compare to compare my locally built version to the production file system. The goal is to ONLY deploy updated dlls. I am using autoincrementing version numbers, and each time you open visual studio and do a build, all dll version numbers increment. The same goes for a full solution rebuild and when a different developer does a build and tries to deploy.

Is there a way that i can configure Visual Studio to ONLY increment the build number based on changed file contents? Is there an add in that will do this?

It seems a binary comparison of these files will also fail because of the different version numbers within the dlls. Does anyone know of a better tool compare only the contents of dlls?

Thanks in advance.

A: 

Its not quite what you are asking, but I found this helpful in dealing with large solutions: Versioning Controlled Build. According to its doc it detects the changes you are interested in : "If there is a file with a more recent timestamp (which means that the source code has been modified after the previous version change), the project will be marked for version update."

The recommended, supportable solution would be for your project to NOT auto-increment the build number using the visual studio way. Then you would need to manually, or write a pre-build script/ MS Build Task to do the increment.

Jennifer Zouak
A: 

There is an interesting sample in this codeproject article which you should check it out... it involves a prebuild task which does the task of updating the build number based on the day of the year

Jhonny D. Cano -Leftware-
A: 

I would suggest that you look into options that your revision control system provides to embed revision information into source files. I've had enough problems with auto-increment in the past that I promised myself never again. These days I prefer something a little more concrete than a build number though and embed unique identifiers into every product of the build system.

I describe my own system in Embedding mercurial revision information in Visual Studio c# projects automatically. While my solution probably isn't right for you, there were other interesting options suggested in response to my question, so some of the solutions I rejected may, nevertheless, be useful to you, even if you have to adapt them to whatever VCS you use.

Mark Booth
+1  A: 

One option is to move to a continuous integration solution such as Cruise Control .Net this allows builds to be triggered on check in to a source control system.

Regarding assembly versioning what I usually do is create a single SolutionVersion.cs (to replace the default assembly version cs) that is linked to each project (use the add existing item but change the button to add as link)

Then I use a NAnt or MSBuild task to take the cruise control build label number and overwrite the SolutionVersion.cs verison numbers before the solution gets built

That way I can take an assembly and trace it back to the code via CruiseControl build version (even better I usually get CC.net to label the source with the same number in source control)

Richard
+1 for ccnet. For assembly versions, we use the subversion revision number. For the installers, we have ccnet projects that require a force build, so the installer is versioned based on the ccnet build number.
Pedro