| Stephen's profileBadCorporateLogoPhotosBlogLists | Help |
|
January 22 Debugging Custom Content Pipeline Extensions (Part 2)In my previous post, I described what happens when you press F5 to debug a game project, and explained why you can't debug your Content Pipeline Extension Library projects that way. However, I also described many ways in which F5 actions can be customized. By tweaking the settings in just the right ways, it turns out that you can debug your Content Pipeline Extension Library projects in the IDE. Here's how you do it... XNA Game Studio (XGS) 2.0 projects use a nested Content project to build content. If you look at your project directory in Explorer, you'll find a file called content.contentproj. That's the MSBuild project that builds all your content. If you want to debug custom components that you use to extend the Content Pipeline, it's as easy as debugging msbuild.exe while it builds the content.contentproj project file. In Visual Studio 2005 (VS), you can accomplish this by changing your Startup Project to launch an external program (msbuild.exe) and pass it the path to your content.contentproj file as a command-line argument (this is described in the XGS documentation, near the bottom of this page on How To: Write a Custom Importer and Processor). The problem, however, is that it's still difficult to set up, and the options described aren't available in Visual C# 2005 Express Edition (VCSExpress). It turns out that although there is no user interface to change the startup program in VCSExpress, the ability to launch and debug another application is still there. If you want to have a C# Startup Project launch msbuild.exe when you start debugging, all you need to do is add the following XML to its .csproj file (after the <Import> element near the bottom is a good spot).
If you want to debug your Content Pipeline components, then you need to add another property, StartArguments, to specify the .contentproj to build, the platform to build it for (Xbox 360 or Windows), and the configuration to build (Debug or Release). It can get a bit long, but to do it right, you need something like this...
If you add these properties to your game project (or game library project), it will launch and debug msbuild.exe as it builds the project's content using the Content Pipeline. That will let you hit breakpoints in your Content Pipeline Extension Library project after hitting F5. The caveat to all this is that it's tedious. It's also a bit dangerous to edit the XML project files directly, because if you don't know exactly what you're doing, you can end up with a project that won't load, and no idea how to fix it! One way to make this super convenient and risk-free would be to have a project template to create projects already configured to debug the Content Pipeline! Well, stay tuned! That will be my next post... TrackbacksThe trackback URL for this entry is: http://badcorporatelogo.spaces.live.com/blog/cns!43EB71B104A2D711!166.trak Weblogs that reference this entry
|
|
|