Debug Umbraco running MSBuild Project

When i was writing my previous post on “Setting up Umbraco Correctly with MSBuild” i was thinking exactly how can we get the standard “F5” debug functionality working, well here is a simple solution to the problem.

You are using MSBuild to output your built umbraco solution to another location, now you just can’t debug normally without having to attach the debugger to IIS. Well maybe there is just a way to do this.

If you follow these steps you should be able to debug easily by a simple F5 button press:

  1. Open Visual Studio
  2. Open your Umbraco MSBuild solution
  3. Right mouse click on the project containing your controls, xslt etc and go to Properties
  4. Then go to “Web” on the right hand side
  5. Now at the bottom you will see “Use Custom Web Server” and enter your URL to the umbraco website, for example mine might be “http://client.umbraco.localhost” (i normally create a new local DNS reference for each umbraco project that way i can use localhost for normal sites and use “client.umbraco.localhost” for my umbraco instances for a client ).
  6. Save the project file
  7. Now press “F5” and the MSBuild processes will fire and then the debugger will run the website in debug mode.

Hopefully everything has worked and your now running your umbraco instance in debug mode. Just a bit easier then building and attaching the Debugger to a process 🙂

About Christopher Giddings
lonely little developer in a great big world.....

5 Responses to Debug Umbraco running MSBuild Project

  1. Aaron Powell says:

    You know that you can just use “Attach to Process” (from the Debug menu) and provided that the PDB files are within the sites root then it’ll work too.

    • cjgiddings says:

      They Aaron the point of this is that umbraco and your project files are separated and you use MSBuild to combine them together. This also helps in wasting time attaching to a process etc. You just have to press F5, need that for some of those lazy people, cough cough me.

  2. Petr Snobelt says:

    Thanks for useful post.

  3. Sid Mansukhani says:

    I was able to debug my usercontrols that sit under the main umbraco project using the Visual Studio web development server. I don’t see the need to separate your project files from umbraco. Is there a reason to do it this way?

    • cjgiddings says:

      Hey Sid,
      This is very funny why you couldn’t debug, maybe try and attach to the correct service, if you have multiply website you need to connect to the correct w3 service.
      This is only a suggestion as to how to separate your code and CMS to allow easy updates of the CMS to be propagate down to other developers easily.

      This also then allows a developer new on the project to just get everything from the source control repository and not worry about what version of the CMS is required.

      Hope this has helped but as i’ve said it’s only a suggestion and you should pick the required structure etc that’s required for your project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: