Debugging with Visual Studio 2010 and RvtSamples.txt Update

Rod Howarth just published a description of a problem debugging a Revit 2011 add-in with Visual Studio 2010. He found a related thread on the Microsoft Connect Visual Studio discussion forum describing the same issue with Revit 2010 and presenting a solution for it:

The issue that you are encountering is that Visual Studio 2010 is launching Revit under the default debugger (v4.0) but since you are building a project against the 2.0 framework (3.5 runs on the CLR 2.0) in order to correctly debug your Revit plugin, Visual Studio must launch Revit under the 2.0 debugger, not the 4.0.

You can either launch Revit and manually attach to the Revit process with your Revit plugin open (the debugger will automatically attach with the correct engine once the process has already started), or you can add a <supportedRuntime> attribute to the <startup> section of the Revit.exe.config file that will allow Visual Studio to determine which debugger should be attached:

As Rod says, the workaround is to edit your Revit.exe.config file which is located in the same directory as Revit.exe and add the following just before the </configuration> part of it:

<startup>
<supportedRuntime version="v2.0.50727" />
</startup>

For more details, please refer to Rod's post.

RvtSamples.txt Update

In a separate thread, Rod also mentioned a problem loading the version of RvtSamples.txt included with the Revit 2011 SDK. This is the text file read by the RvtSamples SDK sample application (for 2010) to load all the other Revit SDK sample commands as well as potentially process include files to load an additional set of own personal commands. I ran into the same issues Rod describes, so I thought it worthwhile to publish my current version of RvtSamples.txt for Revit 2011 to save others the bother of having to explore what fixes need to be made.