• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012
    Accepted Solution

    Referenced third party DLL throws Exception on other Machines .

    165 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.

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012

    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.

    Please use plain text.
    Valued Mentor
    Posts: 306
    Registered: ‎05-06-2012

    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. 

     

    Please use plain text.
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012

    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.

     

    Please use plain text.
    Valued Mentor
    Posts: 306
    Registered: ‎05-06-2012

    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.

    Please use plain text.
    Valued Contributor
    Posts: 58
    Registered: ‎09-03-2012

    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.

    Please use plain text.