Simulate 2018: Could not load file or assembly 'Autodesk.Navisworks.Controls'

Simulate 2018: Could not load file or assembly 'Autodesk.Navisworks.Controls'

Anonymous
Not applicable
2,410 Views
5 Replies
Message 1 of 6

Simulate 2018: Could not load file or assembly 'Autodesk.Navisworks.Controls'

Anonymous
Not applicable

Hi,

 

I have been working on multiple utilities developed based on Navisworks Sumulate 2016 .net APIs. everything works fine. Now I need to upgrade these utilities from Navisworks Simulate 2016 to 2018 and higher.

 

I changed the .NET API dlls reference path to Navisworks Simulate 2018 installation directory in my visual studio solution and I am referencing.Net framework 4.6 in my solution, but I am getting following error.

System.IO.FileNotFoundException: 'Could not load file or assembly 'Autodesk.Navisworks.Controls, Version=15.0.1314.36, Culture=neutral, PublicKeyToken=d85e58fa5af9b484' or one of its dependencies. The system cannot find the file specified.'

Error1.png

Error2.png

 

I tried upgrading sample application which is delivered by Autodesk for Navisworks Simulate 2016 .net API and I am getting same error.

 

Can you please shed some light on what I am missing here. Is anything modified from v2016 to v2018?

 

Regards,

Sravan

0 Likes
Accepted solutions (1)
2,411 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Accepted solution

This issue is resolved after upgrading to Navisworks Simulate 2018 Update 2.

Make sure to set "Copy to Local = True" for Autodesk.Navisworks.Resolver.dll, and "Copy to Local=False" on all remaining Navisworks dlls in your Visual Studio solution.

 

Thank you.

0 Likes
Message 3 of 6

Anonymous
Not applicable

i tried the above solution but still i am getting the same error.Do you have any idea or other way how did you fix this

0 Likes
Message 4 of 6

marc.whitburn
Participant
Participant

Versions 2017 and up use the assembly resolver.  Reference Autodesk.Navisworks.Resolver.dll and set its CopyLocal to true.  Set CopyLocal to false for all your other Navisworks assemblies.  In your code you can bind to the runtime with the resolver using the following:

 

String runtimeName = Resolver.TryBindToRuntime(RuntimeNames.Any);

 

You can also specify RuntimeNames.NavisworksManage or RuntimeNames.NavisworksSimulate if you want to use a specific runtime.

 

If you want to see a sample of how it works, take a look at the "Viewer" sample app in api\NET\examples\Basic Examples\CSharp\Viewer\ in the SDK.

Message 5 of 6

Anonymous
Not applicable

after adding Resolver reference and set local to true for the below code it is working fine

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Navisworksapplication = Autodesk.Navisworks.Api.Automation.NavisworksApplication;

namespace exe1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public void Button1_Click(object sender, EventArgs e)
{
Navisworksapplication NWApp = new Autodesk.Navisworks.Api.Automation.NavisworksApplication();
NWApp.Visible = true;

OpenFileDialog filename = new OpenFileDialog();

var fddd = (filename.ShowDialog() == DialogResult.OK);

string tt;
tt = "fdf";
if (fddd)
{
tt = filename.FileName;
}

NWApp.AppendFile(tt);

}
}
}

0 Likes
Message 6 of 6

btmsoftware
Advocate
Advocate

FYI,

 

I know it's an old post and resolved but that might help some other people in the future....

 

I add the same issue with Navisworks 2023 and I found out in my app.config that instead of the ,NET framework 4.8 which seems to be the version to use when compiling, you need to set to 4.5inthe startup section, as shown below

 

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>

 

My2 cents

0 Likes