.NET

Reply
Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 1 of 7 (328 Views)
Accepted Solution

Referenced third party DLL throws Exception on other Machines .

328 Views, 6 Replies
02-27-2013 09:59 PM

Hi,

 

I created a lib folder in my projects folder and then with 'Add Reference' added the reference to my project. It works well for me.

 

But when I executed this DLL in another system it throws an Exception "Cannot load the file or..........."

 

Exception file attached.

Note in the error message it says 'Could not load file or assembly DocumentFormat.OpenXml' (bloh blah blah) or one of its dependencies  

 

In other words, you must look at that assembly (DocumentFormat.OpenXml) and see what additional assemblies it is dependent on (e.g, what assemblies does it reference, other than the standard framework assemblies), and you must also include those dependent assemblies in your project output folder, if they are not already there.

 

One common cause of this problem is a dependent assembly that's installed into the Global Assembly Cache, which will not be copied to the project folder. In that case you need to ensure that any such assemblies are installed on the target system as well.

Moderator
Alexander.Rivilis
Posts: 1,417
Registered: ‎04-09-2008
Message 2 of 7 (301 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 05:56 AM in reply to: newautocad123

It is look like AutoCAD can not find DocumentFormat.OpenXml.dll


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 3 of 7 (283 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 08:19 PM in reply to: newautocad123

yes the error message  says that the same, specified file could not be found. But I have added the reference for the same and it works well on my system.

 

My query is how can I get the file included for other machines, so that the dll executes without exception. Is there any other way? The dll also could not be registered in any system.

 

Thanks.

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 4 of 7 (276 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 08:51 PM in reply to: newautocad123

Any dependent assemblies used by your assembly, directly or indirectly, must be in the same folder as your plugin's main assembly, or must be in the same folder where acad.exe is located.

 

You don't mention how you 'executed' the DLL, but you should test it using NETLOAD, in addition to any other means of loading, such as AutoCAD's Auto-loader, and by registering the assembly for demand-loading in the registry. 

 

Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 5 of 7 (272 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 09:26 PM in reply to: DiningPhilosopher

I added the external third party dll in the projects folder.

The DLL I created was loaded with NETLOAD. When it goes to command which uses the functions from the external, throws exception.

 

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 6 of 7 (262 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 09:48 PM in reply to: newautocad123

Note in the error message it says 'Could not load file or assembly DocumentFormat.OpenXml' (bloh blah blah) or one of its dependencies  

 

In other words, you must look at that assembly (DocumentFormat.OpenXml) and see what additional assemblies it is dependent on (e.g, what assemblies does it reference, other than the standard framework assemblies), and you must also include those dependent assemblies in your project output folder, if they are not already there.

 

One common cause of this problem is a dependent assembly that's installed into the Global Assembly Cache, which will not be copied to the project folder. In that case you need to ensure that any such assemblies are installed on the target system as well.

Valued Contributor
newautocad123
Posts: 58
Registered: ‎09-03-2012
Message 7 of 7 (259 Views)

Re: Referenced third party DLL throws Exception on other Machines .

02-28-2013 09:58 PM in reply to: DiningPhilosopher

Installed the  assemblies to the target system also. It works well.

 

Thanks.

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.