Today I wanted to do a test on a .cs file that was written by someone that I work with. For some reason, the code wouldn't run on his Windows XP pro. BTW, it was calling unmanaged gdi methods (GetDeviceCaps) and would compile fine, it just wouldn't run.
So I have him send over the code, all in one .cs file, and I open it up in TextPad. The code itself looks fine, so I fire up the csc in TextPad and the code compiles fine. I then go to the output directory, run the .exe, and bam! it works. So, it must be his installation of XP that is messed up, I guess.
For those of you who want to know what 'the csc in TextPad' means:
- Go to Configure->Preferences...
- Highlight the Tools treenode.
- click the Add button
- Browse to C:\%windir%\Microsoft.NET\Framework\%version%\csc.exe
- I also put the label on as csc (v1.1.4322), b/c I have version 1.0 on my machine as well.
- write some code, then click Tools-> csc
That was it. So now I can write some simple code and compile it directly from my text editor of choice. The only caveat: it compiles with the default options of the compiler, for example I compiled a winform but did not specify /t:winexe, so a command prompt shows up before the window. If you wanted to play with the options, I suppose you could write a batch file and call it from the command line. Or you could use Nant. whatever.