I am near the end of the rope with keeping my builds automated.
· NAnt failing to build my solution and breaking the back of my CI Server. I spent nearly a day on finding what the hell is going wrong! If the IDE can build it why can't you ? I get a stupid regasm error stating "RegAsm error: File or assembly name XXX, or one of its dependencies, was not found. External Program Failed: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\regasm.exe (return code was 100)"
· CruiseControl.NET also has decided to out do NAnt by just timing out my SourceControl operation. It used to run perfectly till about 2 days ago. Now every build times out with Starteam operations timing out. I manually run a batch and that works :P
I have been trying so very hard to find the cause for it. It's a funny pickle I am in. I have spent too much time setting all this up. Now everything tumbling down like a pack of cards and I don't wanna go back to batch files (which still run as you tell them to. Day in Day out!).
I figured that maybe the NAnt issue was due to some things in the bin or obj folders. I have solved Intellisense lock ups by deleting the bin and obj folders under each project directory. I hunted around for some recursive dir delete switch in the DOS command line utilities. No luck. Next tried NAnt task. Fine help that is ... couldn't figure that one out -- assuming that it is possible. Finally I decided to write one myself - A Bin Obj Blaster - A recursive directory/folder delete utility
You can just paste into a .cs file and compile it as a 'GetBob Console App'. Then configure your PATH variable so that the exe is available everywhere.
>GetBOB.exe -t
(TestMode: lists out all bin and obj folders that would be deleted but does NOT delete it)
>GetBOB -v
(verbose: Lists and deletes all bin and obj folders)
>GetBOB
(silent mode - deletes all bin and obj folder directly)
>GetBOB temp*
(this should also work - haven't given it a try. Will delete all folder beginning with 'Temp' in the current folder or it's sub-directories.
It's pretty cool and something I needed for quite some time. Give it a whirl :) and let me know of any quick improvements!
I really need to learn how to post code in a blog. XML Comments and indentations are totally screwing up my blog layout. So please ignore...
using System;
using System.Collections;
using System.IO;
using System.Diagnostics;
namespace CallBOB
{
class BOB
{
private static bool bVerboseMode;
private static bool bTestMode;
[STAThread]
static void Main(string[] arrDirPatterns)
{
try
{
Console.WriteLine("BinObjBlaster (B.O.B.) - A recursive 'seek and destroy' folder utility");
Console.WriteLine("Created: Gishu Pillai Nov 17, 2005.");
Console.WriteLine("DISCLAIMER: I give everyone the right to copy/use! Use as you please and at your own risk and free will. The author is not responsible for any damages that may occur from using this.");
ArrayList alDirPatterns;
GetDirPatternsForDelete(arrDirPatterns, out alDirPatterns);
if (alDirPatterns.Count == 0)
{ alDirPatterns.Add("bin"); alDirPatterns.Add("obj"); }
else
{ // we have their number }
DirectoryInfo obDirInfo = new DirectoryInfo(Environment.CurrentDirectory);
SeekAndDestroy(obDirInfo, alDirPatterns);
}
catch(Exception obExcep)
{ Console.WriteLine(obExcep); }
}
private static void GetDirPatternsForDelete(String[] arrArguments, out ArrayList alDirPatterns)
{
alDirPatterns = new ArrayList();
try
{
foreach(string sLoop in arrArguments)
{
if (sLoop.StartsWith("-"))
{
string sTemp = sLoop.Replace("-", "").ToLower();
if (0 == sTemp.Length)
{ continue; }
switch (sTemp[0])
{
case 'v':
bVerboseMode = true;
break;
case 't':
bTestMode = true;
break;
case 'h':
Console.WriteLine("List of Available switches");
string sFormatString = "-{0} {1:15} {2}";
Console.WriteLine( sFormatString, "t", "Test Mode", "Prints a listing of directories that would be deleted but does NOT Delete them");
Console.WriteLine( sFormatString, "v", "Verbose Mode", "Prints the name of the deleted directories");
break;
default:
break;
}
}
else
{
alDirPatterns.Add( sLoop );
}
}
}
catch(Exception obExcep)
{ Console.WriteLine( obExcep ); }
}
private static void SeekAndDestroy(DirectoryInfo obCurDirInfo, ArrayList alDirPatterns)
{
try
{
foreach(string sDirPattern in alDirPatterns)
{
foreach(DirectoryInfo obDirForDelete in obCurDirInfo.GetDirectories(sDirPattern))
{
if (bVerboseMode || bTestMode)
Console.WriteLine( "Found " + obDirForDelete.FullName );
if (!bTestMode)
obDirForDelete.Delete(true);
}
}
foreach(DirectoryInfo obLivingDir in obCurDirInfo.GetDirectories())
{
SeekAndDestroy( obLivingDir, alDirPatterns );
}
}
catch(Exception obExcep)
{ Console.WriteLine(obExcep); }
return;
}
}
}
After some detective work, I have my CI Server up again,
ReplyDeleteCruiseControl had an attribute to control the timeout value which was not documented at that time. Somehow the time taken for the SourceControl op has doubled in the last week (the Starteam server is across WANs). With Owen's help, the timeout period was increased and CC.net is back up. A build now takes a whopping 38 minutes, most of which is due to the SourceControl. I'm still keeping the faith.
NAnt on the other hand is proving to be difficult to catch. I have narrowed down the problem to the 'Register for COM Interop' project property. When this is reset, the build is working beautifully. I tried to repro out a sample but failed. Will get this sample nailed soon for Gert to fix.. Meanwhile I created a copy of the csproj file with the property reset and replace the checked out version with this one before a build. Sneaky 8) but everything's working now !!