Visual Studio and SubSonic

17 Jun

If you aren’t using SubSonic yet, you should be. You can find out more at subsonicproject.com. Here’s the easiest way to get SubSonic working smoothly from within Visual Studio.

Download the SubSonic source from http://subsonicproject.googlecode.com/files/SubSonic_2.1_Final_Source.zip and extract it. I chose to create a folder for SubSonic in “C:\Program Files\”.

SubSonic Folder

SubSonic Folder

Next, in Visual Studio click the “External Tools…” menu item from the “Tools” menu. A dialog box will pop up allowing you to manage the external tools. Click “Add” and enter the following:

External Tools Dialog

External Tools Dialog

Title: SubSonic (or whatever you want really)
Command: C:\YOUR_SUBSONIC_PATH\SubSonic2.2\SubCommander\sonic.exe
Arguments: generate /out $(ProjectDir)/Generated
Initial directory: $(ProjectDir)

I check “User Output window”. If you don’t a console window will popup every time you run the command.

Now you will have a “SubSonic” menu item in your “Tools” menu which will generate all your subsonic classes.

Tools Menu

Tools Menu

Of course, you need to have your app.config/web.config setup with SubSonic for the classes to generate. You can find more information about doing that here: http://subsonicproject.com/setup/gettingstarted/.

No comments yet

Leave a Reply