Posts
49
Comments
83
Trackbacks
0
Vmake.msh and format-source.msh: Making it easier to write snippets in C# using Monad

When I want to write a snippet (let’s say with 3-4 source files and maybe a lib reference), I don’t really want to go and create a project in Visual Studio… not because its not easy, but because opening up VS for some reason feels like I’m embarking on a serious project. And that’s not bad… after all, Visual Studio is really an enterprise and professional interface. For the minor snippets, its really easy to call csc directly and compile some files. But you then miss out on some features of an IDE… So I rolled some scripts to help me write quick snippets (actually these work for large projects too!).

 Format-Source uses begin{} process{} end {} clauses to implement the classic cmdlet behaviour in script (allows pipelining etc). Vmake is pretty simple, it runs csc and parses the output to indicate at what line and character you made your mistake. The improvement over plain vanilla csc.exe is:

  • Gives you the line where you ran into your error (using format-source)
  • Gives you the character where the compiler caught an error and colors it red
  • Makes it somewhat easier to specify a quick snippet to compile: vmake new.csv,hello.cs somelibtoref.dll. The previous line will create an exe called new.exe and reference somelibtoref from the current path.

Usual caveats: if you specify a file that does not exist, the script will blow up. I haven’t bothered to fix that as its easy to run the cmdline again. Also, I only added csc.exe parameters for the values that are worthwhile for small projects, you can change these to your liking of course. Get them here: format-source.msh and vmake.msh.

posted on Wednesday, October 05, 2005 12:10 PM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 8 and 7 and type the answer here:
News
A little slow these days as I'm busy working on exchangelabs.com. I will try and post tidbits when I get some time. Enjoy the older posts till then!