Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

3 REPLIES 3
Reply
Message 1 of 4
RevitApprentice
757 Views, 3 Replies

Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

I am trying to create unit test in VS2010 for Revit addin that I developed. Problem is when I create unit test for a method and then run that test, I get this message:

Test method TestProject1.SimpleTestCommandTest.ExecuteTest threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'RevitAPIUI.dll' or one of its dependencies. The specified module could not be found.

RevitAPIUI.dll is properly added to references of Revit addin project, and also in references of test project.

Any idea what should I do to fix this?

3 REPLIES 3
Message 2 of 4

I ran into a similar issue a while ago when I was trying to use reflection to list some of Revit's enums.

 

I didn't really need to get this working so I eventually gave up, but before I did I added a handler for the AssemblyResolve event to try to find the issue.  It turns out that the issue was caused by the Revit assemblies' dependency on the Visual C++ Runtime.

 

It seems the solution is to ensure the VC++ Runtime is loaded into the process in order to satisfy Revit's dependencies, simply referencing the VC++ assemblies won't help you as the runtime needs to be loaded a specific way.  I had other time constraints so I gave up after this and I didn't look into how to load the runtime properly.

 

I hope this helps.

Message 3 of 4

Hi, Matt. Thank you for your answer. I'll try doing what you suggested. Hopefully, it will give results.

Message 4 of 4

Hey Guys,

 

I am having the same problem. 

 

Any update?? Has anyone solved this issue? 

 

Its very difficult to unit test Revit. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community