Could not load file or assembly 'Interop.SQLDMO RRS feed

  • Question

  • I have a .NET component that references the SQLMO component.

    When I reference this component directly [at c ompile time -- i.e it is in my REFERENCES List], I have no problem creating it.

    However when I load the assembly via Assembly.Load() then run the appropriate constructor I get the error:
         Could not load file or assembly 'Interop.SQLDMO...'

    Now if I reference SQLDMO in the starting Assembly [the one as .EXE] it all works.    I would like to avoid having to do this.  

    Can I bind to the SQLDMO at run time?

    A few other things:
    64bit -- However compiled for x86


    Brent Rogers I.S.P.
    • Moved by Leo Liu - MSFT Tuesday, July 26, 2011 7:39 AM Off-Topic (From:Visual C# General)
    Tuesday, July 19, 2011 5:49 PM

All replies

  • Do you have a code segment that we can try to compile?


    Wednesday, July 20, 2011 8:02 AM
  • .NET Component
    It References SQLDMO

    using System;
    using System.Collections.Generic;
    using System.Text;
    using SQLDMO;
    namespace MyNameSpace
    	public class MyClass
    		protected SQLDMO.SQLServerClass	MyServer;
    		protected SQLDMO._Database		MyDatabase;
    		String MyConnectString;
    		public MyClass()
    			MyServer = new SQLServerClass();

    Calling Component:

    // MyAName has been set such that it identifes the correct
    // assembly
    MyAssembly = Assembly.Load(MyAName);
    myType = MyAssembly.GetType( "MyNameSpace.MyClass" );
    myConstruct = myType.GetConstructor(Type.EmptyTypes);

    The EXE component, just calls the method in the calling component.

    I get the Could not load file or assembly 'Interop.SQLDMO' error when I attempt the constructor invoke [ MyClass() ].

    However the debugger will not step into the constructor code.

    If the EXE component references the SQLDMO object, then everything works fine.

    This all seemed to work fine on my 32bit WIN7 machine and VS2008.

    Brent Rogers I.S.P.
    Wednesday, July 20, 2011 12:06 PM
  • Hi Brent,

    The appropriate forum for you to get better support on your issue is the Common Language Runtime Forum, please post there to get speciallized support.
    I will move your thread into the Off-Topic Forum shortly. Thanks for your understanding.

    Have a nice day,
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 25, 2011 9:26 AM