Search code examples
c#apiautodeskautodesk-navisworks

System.IO.FileNotFoundException was unhandled - Autodesk Navisworks API


I am referring to Nw_Single_Doc_With_View (written in C# .NET) in Navisworks 2016 API Training Labs.

I have added the Autodesk references DLL and set both of them as false in "Copy Local" property. Autodesk API Reference Manual has specified to set "Copy Local" property to false in DLL.

enter image description here

When I try to run the project, I got an error message saying:

System.IO.FileNotFoundException was unhandled Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll Additional information: Could not load file or assembly 'Autodesk.Navisworks.Controls, Version=14.0.1298.75, Culture=neutral, PublicKeyToken=d85e58fa5af9b484' or one of its dependencies. The system cannot find the file specified.

And when I try to view "Viewer.cs" [Design] page,I got an error message saying as followed:

Severity Code Description Project File Line Suppression State Message Could not find type 'Autodesk.Navisworks.Api.Controls.DocumentControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU. 0
Message Could not find type 'Autodesk.Navisworks.Api.Controls.ViewControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU. 0
Message The variable 'viewControl' is either undeclared or was never assigned. C:\Users\Joe\Autodesk\Navisworks_2016_API_Training_Labs\Indivudual labs\Nw_Single_Doc_With_View\Viewer.Designer.cs 150

I have attached several screenshots and sample project for your reference.

a) Sample project: Navisworks_2016_API_Training_Labs.zip

b) DLL Locations for Navisworks: How I add Navisworks DLL

c) .NET Frameworks enter image description here

d) Autodesk API Manual: Autodesk API Reference Manual

For your info, my computer is a Windows 7 64 bit.

Could you tell me why I got this error and how can I solve it? Thank you

P/S: I have posted my question in Autodesk Navisworks forum here but there is no response so far.


Solution

  • I have solved my problem. Basically, you need to have a valid Navisworks licence on your computer. Then you can run the project smoothly.

    Previously I was using trial version of Navisworks and I got the error message saying "System.IO.FileNotFoundException was unhandled".