RevitAPI: Compile Error – The type or namespace name ‘Autodesk’ could not be found (are you missing a using directive or an assembly reference?)

中文链接
By Aaron Lu

Sometimes we’ve got this kind of compile error when migrating our project from Revit 2014 to Revit 2015:

The type or namespace name ‘Autodesk’ could not be found (are you missing a using directive or an assembly reference?)

Even if the reference of RevitAPI.dll and RevitAPIUI.dll is correct. We can’t figure out what is the problem.

Here is the answer:

Revit is compiled with .NET 4.5, and if our VS project is built against .NET 4.0 or any version prior to .NET 4.5, VS can’t recognize the RevitAPI.dll and RevitAPIUI.dll, that’s why we got that comiple error.

to solve it, just set the “Target framework” to .NET 4.5 from property page of our VS project, like below:

.NET 4.5 Compile Error


Comments

One response to “RevitAPI: Compile Error – The type or namespace name ‘Autodesk’ could not be found (are you missing a using directive or an assembly reference?)”

  1. Thanks for writing such an informative blog.

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading