milkwood
asked on
Simple asp.net 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.
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.
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.
ASKER
I don't appear to have a debug folder.
ASKER
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?
ASKER
My directory setup is as follows
J:\Run_WebNpd //// main directory web
(-) App_code
- docalc.vb /// some code
App_Data
(-) BIN
--PrimeDll.Dll /// problem dll
(-) Default.aspx
-- Default.aspx.vb
web.config
I have tried putting the Primedll.dll i the main directory with no effect
J:\Run_WebNpd //// main directory web
(-) App_code
- docalc.vb /// some code
App_Data
(-) BIN
--PrimeDll.Dll /// problem dll
(-) Default.aspx
-- Default.aspx.vb
web.config
I have tried putting the Primedll.dll i the main directory with no effect
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
"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
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...
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...
ASKER
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 mikeATknack.com.au
"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 mikeATknack.com.au