System.IO.FileNotFoundException

System.IO.FileNotFoundException

oheynes
Explorer Explorer
2,772 Views
6 Replies
Message 1 of 7

System.IO.FileNotFoundException

oheynes
Explorer
Explorer

Hi,

 

I am getting the following error:

 

System.IO.FileNotFoundException: 'Could not load file or assembly 'Autodesk.Navisworks.Api.dll' or one of its dependencies. The specified module could not be found.'

 

I am using VS 2017 and have referenced

 

Autodesk.Navisworks.Api.dll

Autodesk.Navisworks.Automation.dll

Autodesk.Navisworks.Controls.dll

Autodesk.Navisworks.Resolver.dll

 

In the VS project in the Navisworks Manage folder, all reference are set to copy local. This is an x64 build, 2018 API, .NET 4.5.2.

 

Can anyone shed some light on this error? Are there extra files I need to copy to the output directory?

 

Thanks,

 

Oli

0 Likes
2,773 Views
6 Replies
Replies (6)
Message 2 of 7

oheynes
Explorer
Explorer

Hi,

 

Any chance I could get some support for this error?

 

Oli

0 Likes
Message 3 of 7

ulski1
Collaborator
Collaborator

perhaps the problem is you are trying to create a standalone 3dviewer using navisworks as the graphics engine? you can not reference navisworks dlls into a standalone exe application. Did you download the sdk http://usa.autodesk.com/adsk/servlet/index?id=15024694&siteID=123112 ?  Look at the sample solution after installing the sdk C:\Program Files\Autodesk\Navisworks Simulate 2018\api\NET\examples. Also look at the zip file Navisworks 2016 API Training Labs found on the website.

br

Ulrik

0 Likes
Message 4 of 7

oheynes
Explorer
Explorer

Hi,

 

Thanks for replying but it is still not working...

 

I have got the Viewer example working fine, but copying and pasting the same code into my WPF app gives the error.

 

I have referenced the following dlls in the Navisworks Manage folder, in exactly the same way as the Viewer example:

 

Autodesk.Navisworks.Api

Autodesk.Navisworks.ComApi

Autodesk.Navisworks.Controls

Autodesk.Navisworks.Interop.ComApi

Autodesk.Navisworks.Resolver

 

Even with a clean WPF app it does not work. I have attached an example.

 

 

 

0 Likes
Message 5 of 7

xiaodong_liang
Autodesk Support
Autodesk Support

Hi @oheynes,

 

There is a WPF sample in SDK: \api\NET\examples\Basic Examples\CSharp\WPF. It is working. I believe one comment in the App.xaml.cs should have explained why the issue happened with your sample:

 

            // The "Navisworks.Autodesk.Resolver" assembly should be included in your installation.

            // Other Navisworks.Autodesk.*" assemblies will be resolved at runtime,

            // and thus should not be included.

            // Autodesk.Navisworks.Controls controls usage inside the VS Designer is deprecated, and instead they should be created dynamically.

 

i.e. you will need to explicitly ask resolver to resolve the related assemblies, instead of only adding them to references.  In the past, we set CopyLocal = false. WPF sample can load the relate assemblies on runtime, but now we need resolver.

 

 

Message 6 of 7

gustavo_sanches7ZZVWX
Observer
Observer

hi everyone, i am using naviswork 2024, and i am having the same problem. I tried everything it was discussed here. but nothing worked. Any other suggestion?

0 Likes
Message 7 of 7

jabowabo
Mentor
Mentor

@gustavo_sanches7ZZVWX wrote:

hi everyone, i am using naviswork 2024, and i am having the same problem. I tried everything it was discussed here. but nothing worked. Any other suggestion?


 

I've found that Copy Local must be set to 'True' for Autodesk.Navisworks.Automation.dll to load. Not sure why.

0 Likes