none
Creating DLL - OLE problem RRS feed

  • Question

  • Hello,
     I fighting for last 2 days with followed problem and cannot find solution.
    I would like to create DLL library for using in MS Dynamics NAV. There is a problem, that in NAV is not possible use .NET dlls. So I have one .NET dll library a.dll and one DLL as wrapper over this .NET b.dll - a.dll is in C# and b.dll is in Visual Basic.  From b.dll Im calling methods from a.dll. The final builded dll I registered with regasm.exe b.dll /tlb:b.tlb. After this registration I can see it as registered object and can view all methods for it - then I can attach it to NAV and use it.
    The problem is, that it is working only on development computer, on the rest its not working and ends it with error Cannot create OLE or Automation server. I found out, that the problem is, that even if I register the b.dll file in other directory, it allways takes from bin folder of my project and in the fact this foilder doesnt exists on other pc`s.
    So I think that Im doing something bad in my dll file, but cannot find what. The code for the VB dll is:

    Imports

     

    System.Runtime.InteropServices
    Imports System.Math
    Namespace bc
    <ClassInterface(ClassInterfaceType.AutoDual)>
    Public Class sbc

     

    Public Function kod(ByVal cislo As String)
    .. some code
    end Function
    End Class
    End
    Namespace

    I set it as Register for Interop.

    Has somebody experience with this kind of problem? Thanks a lot

    Friday, June 12, 2009 12:26 PM

Answers

  • You will have to strong-name the assemblies and register them in the GAC.  Did you do this on the target machine?  Keeping it in its own folder is possible too, but you'll then have to use the /codebase argument for Regasm.exe.  You will however have a problem if the assembly has dependencies on other assemblies which appears to be your case.

    Hans Passant.
    Friday, June 12, 2009 1:33 PM
    Moderator
  • I found soluiton, how to add strong name to dll without source codes as http://www.zilberbaum.com/Blog/index.php/2008/12/23/how-to-add-a-strong-name-to-an-existing-dll-that-you-dont-have-the-source-files-to/ thanks for effort.
    • Marked as answer by vep1 Monday, June 15, 2009 7:07 AM
    Monday, June 15, 2009 7:07 AM

All replies

  • You will have to strong-name the assemblies and register them in the GAC.  Did you do this on the target machine?  Keeping it in its own folder is possible too, but you'll then have to use the /codebase argument for Regasm.exe.  You will however have a problem if the assembly has dependencies on other assemblies which appears to be your case.

    Hans Passant.
    Friday, June 12, 2009 1:33 PM
    Moderator
  • Hello Hans,
     I assigned strong name for my project and recompiled it, than I registered it to system and it works in case, that Im not using another referenced dll. When Im using another referenced dll, it throws error by compiling as Unable to emit assembly: the refrenced library has no strong name. The problem is, that I cannot find the source codes for refrenced library. Is there any other way how to sign the strong name to the refernced dll without source codes? Or some other hint?

    thanks
    Monday, June 15, 2009 5:22 AM
  • I found soluiton, how to add strong name to dll without source codes as http://www.zilberbaum.com/Blog/index.php/2008/12/23/how-to-add-a-strong-name-to-an-existing-dll-that-you-dont-have-the-source-files-to/ thanks for effort.
    • Marked as answer by vep1 Monday, June 15, 2009 7:07 AM
    Monday, June 15, 2009 7:07 AM