The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.
Showing posts with label nant. Show all posts
Showing posts with label nant. Show all posts

Wednesday, June 1, 2011

robocopy fix for exit code of 2

Sometimes you want to use robocopy from nant, a sql job or another build tool, robocopy will return 2 during a successful run, this gets interpreted as an error, a google search on the issue returned this article Fixing Robocopy for SQL Server Jobs.

Robocopy is now installed by default on Windows7 and Windows Server 2008
http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx

here is robocopy_fix.bat based on the code in the "Fixing Robocopy for SQL Server Jobs" article


Thursday, April 9, 2009

'file version' is not in the normal 'major.minor.build.revision' format

At work we use TFS for source control and NAnt for building our application, yesterday our NAnt build started failing with the following error message "Assembly generation The version '2.7.1.65559' specified for the 'file version' is not in the normal 'major.minor.build.revision' format"

After a quick Google search it turns out that each segment in a .net assembly cannot be larger then 65534. We use the TFS changeset for the revision segment but this will no longer work for us as we are now beyond changeset 65534 - doh! As a work around we are now using only the last 4 digits of the changeset, so instead of 2.7.1.65559 we are using the version 2.7.1.5559

this required a small change to the Nant build script
  • the update is here
  • and the original is here
this version constraint is documented here

UPDATE: NAnt build with TFS changeset as revision number

this is a small revision to a previous post NAnt build with TFS changeset as revision number

apparently there is a limitation on the size of the number used in each segment of a .net assembly version so this is a slight update to the c# code that gets the latest changeset from TFS - changes start at "if(latestChangsetId > 65534)"



see also AssemblyVersion - BuildNo Limitation

Sunday, April 20, 2008

NAnt build with TFS changeset as revision number

This code sample is a nant script that
  • deletes the CommonAssembly.cs file (linked to all projects)
  • uses the nant asminfo task to recreate the CommonAssembly.cs file, but after we query TFS for the changeset (revision) number which is used in the version number
  • build the solution in release mode using the ide.exe (there are other - better ways, but this one works)
  • xcopy files to C:\temp\{app} and clean up all the source files

basically I just put together a few bits that I found on other blogs (should have saved the urls - doh!), most were related to using svn for source control and then I added in the code block for the c# stuff to query TFS.

A quick note about the linked CommonAssembly.cs file, visual studio has an option when you are adding an existing file to a project to select 'linked', click the arrow on the 'Add' button when you select your existing file

what this script does not do - get latest from TFS, I usually do that part manually or from ccnet



the c# bit that goes in the nant script block above
NOTE: see updated version of this code block



nant is awesome!