Jesse Naiman tries out the latest ASP.NET MVC and other crazy code stuff like SubSonic and jquery

Friday, May 2, 2008

Subsonic Integration with Visual Studio

Getting SubCommander to work properly in visual studio is a little tricky. Luckily Rob Conery's excellent video showed me how to add a button that generated the classes.

Working like mad to complete deadlines doesn't give me much time to find time or justify watching a video at work. As a result of doing a presentation at work on SubSonic I created these handy steps to configure SubCommander within Visual Studio.

3) Name the tool SubSonic DAL (Or Anything you want, I like consistency myself and the online demo uses this name)

4) In the command field locate the sonic.exe, which is by default installed at: "C:\Program Files\SubSonic\SubSonic 2.0.3\SubCommander\sonic.exe"

5) In the arguments field put this: "generate /out [generated]". The value in the bracket is the directory that the generated files will be placed. It actually looks like this: "generate /out generated"

6) For "Initial directory" put "$(ProjectDir)"

7) Check "Use Output window" and "Prompt for arguments" It should look similar to the image below:

8) Save. This button is now in the Tools menu. Note the placement of this menu item for step 4.

9) Right click on the toolbar --> Click Customize --> Click "Toolbars" tab --> Click New --> Name the toolbar item "SubSonic" (It can be anything you like)4) Click "Commands" tab-> Scroll to Tools in the left hand menu-->Navigate to the external Command# that corresponds to the placement of the SubSonic menu item and drag to the toolbar.

10) You're ready to go. Whenever the schema changes run the SubSonicDAL button and the files should be ready to go.