We talked about .NET Framework Target and Assembly References regarding Revit API 2012 previously and left a pending issue there.
Is there a way to work around the incompatibility issue between debugger and debuggee as detail follows?
“Microsoft Visual Studio
Error while trying to run project: Unable to start program ‘C:\Program Files\Autodesk\Revit Architecture 2012\Program\Revit.exe’.
The debugger’s protocol is incompatible with the debuggee.”
Yes, there is. Modifying the revit.exe.config is the way to go.
In the intact version of the revit.exe.config file, it forces addins to target at the .NET Framework Runtime version 4.0 too, the same as the Revit API 2012 is built upon. Here is a snippet of the file:
…
…
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Commenting out the supportedRuntime line like the following solves the issue.
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- supportedRuntime version="v4.0"/ -->
</startup>
Commenting out the supportedRuntime line in the file and saving it back will allow the addins built with 3.5 version of .NET Framework Runtime to load and run.
But when addins built really with the runtime version 4.0 in Visual Studio 2010 are trying to be loaded, some other error messages will come up and Revit will not recognize the assembly, and we have to change the supportedRuntime back to version 4.0 in the revit.ext.config in this situation.
So it is clear that Revit 2012 cannot load and run addins targeted at .NET Framework Runtime versions 3.5 and 4.0 side by side.
The Revit Addin Wizard (RevitAddinWizard) will target at the .NET Framework 4 automatically in case Revit version 2012 is selected and the Visual Studio 2010 is used to create the Revit addin projects in C#, VB.NET or even Managed C++/CLI.
If Visual Studio 2008 has to be used to develop addins for Revit 2012, please do not forget to make the above tweak to the revit.exe.config file manually if debugging is needed besides making other adjustments to the addin projects such as updating the Revit API assembly references, adding the new VendorId node to the Revit manifest file, and switching the RegenerationOption to Manual as addressed before.
Recent Comments