Simple web cannot find dll.

I have created a simple web using Visual Studio 2008 and want to use a dll that I know is working. I have put the dll in the BIN folder and have a button that calls the dll ie

 Public Sub calc_npk_decide(ByRef temp_N As Double, ByRef temp_P As Double)
        runnpd(3000,298, 0.1, 40, temp_P, temp_N)

        If temp_N < 0 Then temp_N = 0
    End Sub

I get the error
Unable to load DLL 'PrimeDll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The dll is declared in a separate module as
 Declare Sub runnpd Lib "PrimeDll.dll" (ByVal SeasonYield As Double, _
                          ByVal SoilCst As Double, _
                          ByVal SoilKp As Double, _
                          ByVal EconGrainVal As Double, _
                          ByRef Rate1 As Double, _
                          ByRef Rate2 As Double)

This dll works fine in a standard windows application. It is a straight forward calculation and as far I know has no dependancies.
Who is Participating?
Sachintana DissanayakeConnect With a Mentor Senior Web DeveloperCommented:
Add the dll as the reference to the web project.

    First remove/delete the dll from the bin folder from solution explorer.
    Right click on the web project from solution explorer.
    Select "Add reference..." and click the Browse tab.
    Select the PrimeDll.dll from the file system.
    Build the web project, now you should be okey.
Place the dll in the debug folder instaed of bin (or release if you are building final version). Without a path specification the app will look for dll in the same folder as the app executable which is bin\debug when you press play in studio.
milkwoodAuthor Commented:
I don't appear to have a debug folder.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

milkwoodAuthor Commented:
In the build- configuration manager there is only the choice of debug, release is not an option
Make sure it is in the same folder as the asp file you are producing, is the asp file in the bin folder?
milkwoodAuthor Commented:
My directory setup is as follows

J:\Run_WebNpd                               //// main directory web
   (-) App_code
             - docalc.vb                         ///  some code
    (-) BIN
            --PrimeDll.Dll                         /// problem dll
    (-) Default.aspx
            -- Default.aspx.vb

I have tried putting the Primedll.dll i the main directory with no effect
milkwoodAuthor Commented:
Unfortunately when I try to add a reference to the DLL I get an error of
"A reference to PrimeDll.dll could not be added. This is not a COM component"

This dll was written in C++ some time ago using Visual Studio. I still the source somewhere so I suppose I could re-compile but I thought a dll was a dll and it works fine in windows apps
Sachintana DissanayakeSenior Web DeveloperCommented:
So, you have to create an .net compatible assembly using that COM dll.
Use tlbimp command line tool to COM dll to CLR (common language runtime) dll. Check other options as well.
    tlbimp PrimeDll.dll\1

Hope this helps, if not please attache the dll...
milkwoodAuthor Commented:
Tried the tlbimp and got
"The input file 'C:\Temp\PrimeDll.dll' is not a valid type library"

Experts-Exchange does not allow uploading dll. I can email it if you want to send your address to
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.