Krishna
Krishna

Reputation: 5

Could not load file or assembly 'accoremgd,Version=20.0.0.0, Culture=neutral, PublicKeyToken=null' one of its dependencies

I am beginner to AutoCAD customization in VB.net. I have added following references to my project. 1. accoremgd.dll 2. AcCui.dll 3. acmgd.dll 4. acdbmgd.dll

following is my code:

     Imports Autodesk.AutoCAD.ApplicationServices
     Imports Autodesk.AutoCAD.DatabaseServices
     Imports Autodesk.AutoCAD.Runtime
     Imports System.IO
     Imports Autodesk.AutoCAD.Interop
     Imports Autodesk.AutoCAD.Interop.Common
     Imports System.Runtime.InteropServices

    Public Class Form1

    Private Sub btnShow_Click(sender As Object, e As EventArgs) Handles btnShow.Click
    Dim str_path As String
    str_path = Application.DocumentManager.MdiActiveDocument.Name
    txtbox1.Text = str_path
End Sub
End Class

And I am getting following exception: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll

Additional information: Could not load file or assembly 'accoremgd, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

What to do? Thanks in advance :)

Upvotes: 0

Views: 4129

Answers (2)

Olaf
Olaf

Reputation: 76

In most of the cases I encountered this error it was one of ... its dependencies....

In this case you can add a handler to catch the AssemblyResolve event:

AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf AppDomain_AssemblyResolve

    Private Shared Function AppDomain_AssemblyResolve(sender As Object, e As ResolveEventArgs) As Reflection.Assembly
        Debug.WriteLine(e.Name)
        Return Nothing
    End Function

Then have a look at the output and see if there are assemblies missing.

Upvotes: 0

Augusto Goncalves
Augusto Goncalves

Reputation: 8574

If you are trying to use Ac****Mgd.dll references from a .EXE project (Windows Application), then it will not work. See this reply.

Upvotes: 3

Related Questions