Search code examples
c#dllinteropinteropservices

How do I use an unregistered dll from c#?


I have a custom dll (not registered) that I need to access via c#. How do I do this without registering the DLL?

Edit: It is a C++ dll.


Solution

  • See Registration-Free COM Interop:

    Registration-free COM interop activates a component without using the Windows registry to store assembly information. Instead of registering a component on a computer during deployment, you create Win32-style manifest files at design time that contain information about binding and activation. These manifest files, rather than registry keys, direct the activation of an object.

    Using registration-free activation for your assemblies instead of registering them during deployment offers two advantages:

    • You can control which DLL version is activated when more than one version is installed on a computer.
    • End users can use XCOPY or FTP to copy your application to an appropriate directory on their computer. The application can then be run from that directory.