add a .dll to support third party code

Discussion in 'Visual Studio' started by jekain314, Apr 16, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a third-party.dll (MapTools.dll) that I want to add to my website. It is a managed code wrapper to some unmanaged C-code (shapelib.dll). When I putboth .dlls in my /bin folder and add "using MapTools" namespace in my C# codebehindand run the code from my local server all works OK. However, when I copy the site to DASP, i get the error


    Unable to load DLL 'shapelib.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)


    Do I need to add in an "assembly"using the web.config file in order for DASP to find the .dll?


    ---Jim
     
  2. You do need an assembly reference in your web.config then reflect it in your code.
    Didn't an example come with the library?
     
  3. The "MapTools.dll" is the COM C# wrapper that then calls the unmanaged code shapelib.dll. All seems to work just fine on my local server using the standard Visual Studio 2008 execution. Seems this suggests that it SHOULD work on the DASP setup if i can get the directives correct -- but then maybe not!!


    I can simulate the error on my local server by just removing the shapelib.dll code from the /bin file.


    When I try to do "Add Reference" from the VS2008 website menu -- I can add the MapTools.dll -- but when I try to add the shapelib.dll it says the the shapelib.dll isnt a COM object.


    I thought that was what the wrapper was all about -- to allow using the unmanaged code from pre-.net VS versions.


    ---Jim
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    This error usually means that the wrapper / InterOp can't find the COM dll on the server. I don't think 'shapelib.dll' is a standard Windows DLL.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    In order for this to work, the unmanaged dll must be installed (registered) on the server. In this case, this dll is not part of Windows, and thus is not installed.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. any idea how to cause the unmanaged code to become registered on the DASP server --- seems just putting it in the /bin folder doesnt do it.


    when i try to add a second "register" line


    <%@ Register TagPrefix="MapTools" Namespace="MapTools" Assembly="MapTools"%>


    <%@ Register TagPrefix="shapelib" Namespace="shapelib" Assembly="shapelib"%>

    i get a compile error
    Error1Could not load file or assembly 'shapelib' or one of its dependencies. The module was expected to contain an assembly manifest.C:\webProjects\GVOps4\GVStaff\ROIs.aspx4

    however,it seems that if i can get this to work on my local server it should work on the DASP server!
    ---Jim
     


  7. Hi,
    That isinteresting, but only if...
    It worked locally without installing anything in the Global Assembly Cache?
    http://msdn2.microsoft.com/en-us/library/yf1d93sz(VS.80).aspx


    If you can provide a link to the package you downloaded I can take a look for you.
    I searchedjust now and could only find local .NET projects using this, none using it on the web.
    But I did see a lot of public PHP and Apache web projects using it.
    Salute,
    Mark
     
  8. here is the location of the shapelib C# wrapper ....


    http://lists.maptools.org/pipermail/shapelib/attachments/20050808/f7faae1d/MapToolsArchive-0001.zip


    There is some code for netTest and assembly --- but I did not use it. Maybe that's my problem.


    I just plucked the MapTools.dll and shapelib.dll and stuck them in the /bin folder of my webappand everything just worked until i uploaded to DASP.


    I also looked for the gacutil and couldnt find it. I looked in the c:/windows/assembly on my machineand the shapelib.dll nor MapTools.dlls are there.





    If you just unzip the above file and put the two necessary .dlls into a /bin and then in some C#


    using MapTools;


    IntPtr hShp;


    string filename = "anything";


    hShp = ShapeLib.SHPOpen(shpName, "rb");


    I bet you can simulate my error.


    ---Jim
     
  9. most thankful for your efforts --- i'm also posting on the shapelib forum and asp.net --- maybe they will spring something ...


    ---Jim
     
  10. <STRIKE>I'll take a look soon bro, time to give my, young, kids baths right now. [​IMG]



    I've done all I can with it and think I can see why you got it to work locally.
    The .NET project with the class they provided is for .NET Windows Form apps.
    Unless you can find a way, as Bruce already pointed out, I don't see it possible at this point.
    You would need to get it working as a signed assembly in your web.config
    The examples they provided do not apply to an ASP.NET site but instead to .NET framework dev in Windows.
    I may be mistaken but this is my current conclusion.[​IMG]
    Salute,
    Mark


    Post Edited (wisemx) : 4/20/2008 12:53:48 AM GMT
     
  11. http://forums.asp.net/t/939729.aspx

    there is some great help for my problemon the ASP.net forum above--- seems the unmanaged (native) .dll mustbe in the PATH for the webserver. apparently only the managed code from the /bin is copied into the PATH during the CLR of the webserver. On the local server the /bin is in the PATH. Do you know how i can force my shapelib.dll to occur in the PATH list?

    ---jim
     
  12. You'll have to create a Support Ticket for that bro.
    Salute,
    Mark
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page