Debugging in Visual Studio 2010 Express

Yesterday was the first day of the Revit API training in Munich.
As usual, I was able to learn something new.

Frank Neuberg of MAX BÖGL assembled and tested the following summary of information sources related to using Visual Studio 2010 and its Express version for creating and debugging a Revit add-in.

I’ve summarized some information sources to set up an integrated debugging process for class library projects together with Revit.exe (2011) in C# Visual Studio 2010 Express Edition:

Currently available information on the web/blogs:


  1. Debugging using Express Editions
    (July 06, 2006 by Kean Walmsley)

  2. Debugging external application
    (September 03, 2009 by Mike Cvelide)

  3. Visual Studio 2010 and the .NET Framework
    (July 20, 2010 by Jeremy Tammik)

  4. Debugging with Visual Studio 2010 and RvtSamples
    (April 14, 2010 by Jeremy Tammik)

  5. Visual Studio 2010 and Revit API debugging issues
    (April 15, 2010 by Rod Howarth)

Summary of changes to enable debugging class libraries with Revit.exe:

A. Edit the Revit.exe.config file (normally located in the Revit Program directory).
Add the following section (preferably at the end of the file):


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

B. Edit your C# project file (like ‘myCSProject.csproj’) manually and add the last lines specifying the StartAction and StartProgram tags to each PropertyGroup for which you want to enable debugging with Revit.exe:


<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug %28For Release build of Revit%29|AnyCPU' ">
  <OutputPath>binDebug</OutputPath>
  <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
  <BaseAddress>285212672</BaseAddress>
  <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
  <ConfigurationOverrideFile>
  </ConfigurationOverrideFile>
  <DefineConstants>DEBUG;TRACE</DefineConstants>
  <DocumentationFile>
  </DocumentationFile>
  <DebugSymbols>true</DebugSymbols>
  <FileAlignment>4096</FileAlignment>
  <Optimize>false</Optimize>
  <RegisterForComInterop>false</RegisterForComInterop>
  <RemoveIntegerChecks>false</RemoveIntegerChecks>
  <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
  <WarningLevel>4</WarningLevel>
  <DebugType>full</DebugType>
  <ErrorReport>prompt</ErrorReport>
  <UseVSHostingProcess>true</UseVSHostingProcess>
  <StartAction>Program</StartAction>
  <StartProgram>C:Program FilesRevit Architecture 2011ProgramRevit.exe</StartProgram>
</PropertyGroup>

C. Unfortunately the new entry for debugging with Revit.exe is not visible in the project property pallette > Tab: ‘Debugging’ within the C# IDE – EE, but it works anyway:

Visual Studio 2010 Express debgging tab

Many thanks to Frank for testing and documenting this for us!


Comments

15 responses to “Debugging in Visual Studio 2010 Express”

  1. Zhu XiaoMeng Avatar
    Zhu XiaoMeng

    Hi,Jeremy:
    1.How can i manipulate the tangents of a Hermite spline using API? The constructor only take control points in, I can’t find a way to manipulate the tangents, while I can access the read only property “Tangents”.
    2.How can I construct a curve to represent “parabolic catenary”?

  2. Dear Zhu XiaoMeng,
    Maybe the answer to both your questions is: use nurbs instead.
    I believe that a nurb spline is more powerful than the Hermite and is able to represent a catenary curve as well.
    Regarding the “parabolic catenary”, that sounds rather strange. As stated in Wikipedia, the catenary is mathematically quite different from the parabola:
    http://en.wikipedia.org/wiki/Catenary
    I do see a mention of the term “parabolic catenary” in
    http://www.2dcurves.com/exponential/exponentialhc.html
    As far as I can tell, a so-called “parabolic catenary” means exactly the same thing as “catenary”.
    Cheers, Jeremy.

  3. Dear Zhu XiaoMeng,
    I just received a further pointer to some material on the Hermite splines in the Revit API:
    The best description of Hermite Spline geometry is on page 21 of Scott’s handout from his 2009 AU class.
    http://au.autodesk.com/ama/images/media/AU09_SpeakerHandout_CP222-31.pdf
    I also presented that material here on the blog in
    http://thebuildingcoder.typepad.com/blog/2010/01/curves.html
    Cheers, Jeremy.

  4. Zhu Xiaomeng Avatar
    Zhu Xiaomeng

    Thank you for your reply.
    I really appreciate the things you provided especially the Wikipedia link.
    I’m now taking your advice and working on how to use nurbs instead. Oh, GOD, it’s really a hard work…
    I’ll come back for more helps!

  5. Vmmscertpro Avatar
    Vmmscertpro

    This is great stuff and thank you for posting.. I have a quick question on step B: How/where do you go to manually edit the C# project file?

  6. Dear Vmmscertpro,
    Thank you for your appreciation, it is a pleasure.
    Just search for the file with the extension csproj (or vbproj for a VB project) and open it in a text editor such as Notepad.
    Cheers, Jeremy.

  7. Hi Jeremy,
    I have problem while debugging. I’m using Visual C# 2010 Express with Revit Architecture 2011. I managed to do a debuging only at main class. But when it called other class, it ignore all the breakpoints. It seem that the application doesnt work properly. I already followed all the tips and trick that u mentioned in your blog.
    Thanks a lot for your attention.
    Abidah

  8. Dear Abidah,
    I am still using Visual Studio 2008 myself, so I cannot offer any first-hand advice. All I can point at is the information that you have probably already seen in
    http://thebuildingcoder.typepad.com/blog/2010/04/debugging-with-visual-studio-2010-and-rvtsamples.html
    http://thebuildingcoder.typepad.com/blog/2010/07/visual-studio-2010-and-the-net-framework.html
    http://thebuildingcoder.typepad.com/blog/2010/07/debugging-in-visual-studio-2010-express.html
    http://thebuildingcoder.typepad.com/blog/2010/07/linq-methods-and-visual-studio-tips.html
    Revit add-in projects for Visual Studio 2010 are provided in the following discussions:
    http://thebuildingcoder.typepad.com/blog/2010/09/access-to-curtain-grid-panels.html
    http://thebuildingcoder.typepad.com/blog/2010/12/modeless-door-lister-and-deleter.html
    You might be able to install and test those projects on your system and see whether they work for you, then analyse the difference to your solution which does not work properly.
    Cheers, Jeremy.

  9. Marc Roussel Avatar
    Marc Roussel

    Why am I unable to pass from debug to release in the configuration combobox. It’s always keeping Debug and the folder Release is never created. I even try by editing the project file, no success.

  10. Dear Marc,
    I have not the slightest idea. I entered the search string “debugging in visual studio 2010 express” in Google and it turned up a huge number of relevant-looking hits, so I would suggest researching some of those.
    Cheers, Jeremy.

  11. Philippe Avatar
    Philippe

    It seems breakpoints cannot be hit when running Express 2010 in debug using the approach you describe here, it was possible under Express 2008, so Microsoft may have took that away from us… Obviously debugging without breakpoints presents very little interest :(

  12. What do we have to debug in Visual Studio 2012 Express, and Revit 2012 or 2013?

  13. Dear Eric,
    It was nice to see you and discuss your various issues at DevLab.
    Is everything now resolved?
    Cheers, Jeremy.

  14. Neelima Avatar
    Neelima

    Dear Jeremy,
    I am not able to debug “HelloWorld” plugin.
    In Debug -> “Start External Command” option is missing in Visual Studio Express 2010 to add path for Revit.exe file.
    I am using Revit 2013.
    I am getting an error “No source available”.
    I created manifest file for Helloworld.cs proj.
    Please guide me how to debug this application.
    Thanks,
    Neelima

  15. Dear Neelima,
    Yes, that is expected.
    Please read the blog posts above on how to address this. That is what it is all about.
    There are lots of other resources as well, e.g.
    http://www.ninjatrader.com/support/forum/showthread.php?t=15671
    Simply google, e.g.
    http://lmgtfy.com/?q=visual+studio+express+debug
    Cheers, Jeremy.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading