February 2005 - Posts

Right Click and Build Solutions from Windows Explorer

When your developing in a team you have so much of depended code and you just want the assembly from that other god forsaken referenced project. But do I have the assembly ? Nope but i do have the latest code.
Now the problem of opening up visual studio and waiting for the whole damn thing to load and then finally CTRL+SHIFT+B..

I guess this would be quite a common story amoung  many guys developing in a team if I'm not wrong. Well this just got me writing a simple batch file when a collegue of mine mentioned that it would nice to right click and build. So if you guys wanna do that I guess this would be a simple approach ..

The Bat File.
Placethis into your visual studio 2003 (aka 7.1) Common7\Tools folder and name it BuildDebug.bat

echo off
call "%VS71COMNTOOLS%\vsvars32.bat"

REM Remove the error log
IF EXIST error.txt del Error.txt

REM Build the solution
devenv.exe /build debug /out "error.txt" %1

REM display if error exists
IF EXIST error.txt type Error.txt

REM Remove the error log
IF EXIST error.txt del Error.txt

PAUSE

The Reg key for adding Shell extentions
You can add the file association manually and pass in the first parameter or simply just save this as a .reg file and run or manually enter the key into your registry

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Solution.7.1\Shell\Build\Command]
@="\"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\BuildDebug.bat\" \"%1\""

 

 

 

with 2 Comments

Guidlines for Visual Studio 2003

Always wanted to know where to end that line of code and well if you need to see that line then just add this registry key.
It seems to work quite well for me on my VS2k3.

[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\7.1\Text Editor
Guides=RGB(192, 192, 192) 80

Here is the post where you can get the full details.

with 0 Comments

StackOverFlowException and empty stack Trace !

Was pretty surprised when one of my collegues pointed out that the stackTrace was empty for a StackOverFlowException.

Did a little digging into that and found it was empty. So where do you get it ?

As usual Rotor to the rescue. http://www1.cs.columbia.edu/~lok/csharp/refdocs/System/types/StackOverflowException.html

Then i just tried it out with Environment.StackTrace. Yup it was there, even though it a small stackTrace was a useful though.. Wonder why the StackTrace of the exception didnt have it. If anyone can put somelight on this would be quite helpful.

class Program{
    
    static void Main(string[] args)
{
       try{
           Method();
       }
       catch{
           Console.WriteLine(Environment.StackTrace);
       }
    }
    public static void Method()
    {
        Method();          //Infinite Recursion  
    }
}

with 0 Comments

Of Enums and IL.

using System;
class Program{

  enum Color{
      Red=0x001,
     Green=0x010,
     Blue=0x100
   };

   public static void Main(){
        int i = (int)(Color.Red|Color.Blue|Color.Green);
    }
}

I was pretty curious at how the IL would be for this and realized its quite optimized. Wonder how other languages targeting VM's would compile this.

MS IL

.locals init ([0] int32 i)
IL_0000: ldc.i4 0x111

with 1 Comments