Wednesday, 25 August 2010

Autodesk Revit 2011 with .NET Framework 4.0

I discovered yesterday that Autodesk Revit 2011 does not play nicely with .NET Framework v4.0
If you have an external command built with .NET v4.0 that utilizes the RevitApi.dll it will not run from witin revit, as Revit only supports up to framework v3.5
For something that is named for next year (there release cycle is April = Date.Now().Year() + 1)
It is not great especially since their whole UI seems to be based on WPF.
I have found a solution with the help of
To get my External Command to run i have had to change the Revit.exe.config file to include

<startup uselegacyv2runtimeactivationpolicy="true">

<supportedruntime sku=".NETFramework,Version=v4.0" version="v4.0">

<supportedruntime version="v2.0.50727">


just before the closing tag
This allows any of our external commands .NET v4.0 and .NET v3.5 to run
I have not had any issues as of yet with this change, but i am dreading publishing the Command and having to change the Revit.exe.config on our users computers.
Common Autodesk this is not ideal.
I am also using the new RevitAddinUtility.dll to setup the addin
the project that includes this also has to have the above snippet in its app.config file.

No comments: