Visual Studio 2010 is now officially out, and it is great! Some excellent new features, the new look is great, and you can drag code windows to different monitors!
I have installed it and have started working on my Revit API tools with it. Straight away I came across a stumbling block. My API code threw an error, but it was not caught in the debugger, and none of my breakpoints were not hit. After some investigation, it seemed that Visual Studio was not attaching to the Revit.exe process as it should. I tried manually attaching to the Revit.exe process and that seemed to work, but this is a bit of a pain, why doesn’t it automatically attach?
I Googled it, and to my surprise, I found a Microsoft Connect support request about this made by a fellow Revit API developer ‘mikecvelide’. He was using Revit 2010 and found the debugger did not attach either. You can see the thread HERE. Microsoft did some investigation and it seems the problem is Visual Studio 2010 is using the .NET 4.0 debugger even though its a 3.5 or 2.0 application (I don’t believe Revit 2011 supports .NET 4.0 applications).
The workaround is this, edit your Revit.exe.config file which is located in the same directory as the Revit.exe and add:
<supportedRuntime version="v2.0.50727" />
Just before the </configuration> part of it. You should then be able to debug fine in Visual Studio 2010.
Note, v.2.0.50727 is the version I have installed, but you can check C:\Windows\Microsoft.NET\Framework for what the last few digits of your v2.0 folder is (even if you are developing for .NET 3.5 you still need to put in the 2.0 version number)