I seem to remember seeing some of these tips in other posts from active Umbraco community members, but being fresh off the Level 2 course I thought I'd put down this quick list of the items I've set in my Umbraco Visual Studio 2008 development environment.
First, an important note: I like to do my development in a Virtual PC instance of Windows Server 2003 with VS 2008 installed and using IIS as the web server. After many years of spending the occasional frustrating day tracking down that one thing that changed and hosed my development environment I've decided the nominal additional effort required to run in this manner is worth is. Additionally, being able to have a 'portable' development machine (albeit virtual) has served me well in moving between machines, employers, and clients. Lastly, it's very useful to save your 'baseline' virtual hard disk image in case of catastrophic machine failure, new team members, etc....
Okay, enough of that topic. Now for the tips:
- Install Umbraco in a different directory - using the installer - than you use for your Visual Studio solution - using Umbraco source code.
- I use c:\websites\umbraco\ for my Umbraco runtime directory
- and c:\work\umbraco\ for my Umbraco development directory
- Create a post build event (from Project > Properties > Build Events) to copy *.aspx and *.dll (and *.pdb) to your runtime folder - this assumes you're working with user controls, could be similar for other extensions.
- XCOPY "$(ProjectDir)\bin\Umbraco*.*" "c:\websites\umbraco\bin\" /y
- XCOPY "$(ProjectDir)\usercontrols\*.ascx" "c:\websites\umbraco\usercontrols\" /y
- To debug:
- Open the Umbraco IIS site in your target browser(s) - making a shortcut to the section you're working with helps
- In Visual Studio select the Debug > Attach to Process menu
- Select w3wp.exe from the list and press OK
- NB: for IIS on XP/2000 select asp_net.exe and press OK
- From Visual Studio you can set breakpoints, step through code, examine runtime values, etc...
- NB: make sure you copy the *.pdb file to the runtime directory, otherwise you may find your breakpoints are not hit
That's it. A few minutes of work and you're on your way to Umbraco development happiness. At least I am. In my experience this work with all 'like' versions of Umbraco; I.e., I install 3.0.3 in the runtime directory and build 28441 in the development directory and I'm able to debug accordingly.
-Paul