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.

SubCommander Visual Studio Configuration
1) Click Tools -> External Tools --> Add

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.


USWebPro said...

Thanks for this. It's a hard to find this information on the new subsonic website.

However, this does not work the same way in VS 2008.

Anonymous said...

I will not concur on it. I over warm-hearted post. Expressly the title attracted me to review the sound story.

Anonymous said...

Nice post and this fill someone in on helped me alot in my college assignement. Thanks you for your information.

Anonymous said...

Easily I assent to but I contemplate the collection should prepare more info then it has.