Revit API

Reply
Member
RevitApprentice
Posts: 4
Registered: ‎07-21-2011
Message 1 of 4 (454 Views)

Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

454 Views, 3 Replies
07-21-2011 01:34 AM

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?



Contributor
MattSiebert
Posts: 13
Registered: ‎01-09-2011
Message 2 of 4 (450 Views)

Re: Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

07-21-2011 03:47 PM in reply to: RevitApprentice

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.

Member
RevitApprentice
Posts: 4
Registered: ‎07-21-2011
Message 3 of 4 (444 Views)

Re: Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

07-22-2011 12:03 AM in reply to: MattSiebert

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

Active Member
padraig.oleary
Posts: 10
Registered: ‎08-02-2011
Message 4 of 4 (254 Views)

Re: Problem with Unit Testing Revit 2012 addin in Visual Studio 2010

12-21-2011 02:58 AM in reply to: RevitApprentice

Hey Guys,

 

I am having the same problem. 

 

Any update?? Has anyone solved this issue? 

 

Its very difficult to unit test Revit. 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube