472,093 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,093 software developers and data experts.

dll from another project in visual studio 2005

Hi

I am making a project in VB.net visual studio 2005, and i want to use a .dll file from another project which has been made in visual studio 2003.

When i try adding a reference to this dll from VB.net 2005, i get an error "A reference to ..\xyz.dll cannot be added. Please make sure that the file is accessible, and it is a valid assembly or COM component"

Can we add a normal .dll or is it that it has to be a COM component???

Need help urgently.

Thanks
Jun 4 '07 #1
8 9750
debasisdas
8,127 Expert 4TB
Hi
devilbrat
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.
It will help Experts in the forum in solving/underestanding your problem in a better way.
Jun 4 '07 #2
i am right clicking on the project in Solution explore, and trying to add a reference. In the reference window, under the browse tab, i try to add a reference to my dll. I have also copied that dll into the project directory. But when i select the dll and click on ok i get a message box saying"A reference to the dll could not be added. Make sure the file is accessible, and it is a valid assembly or COM component"

The dll was made in VC++ 6.0

Does vb.net not support simple dlls?? or am i doing something wrong??
Jun 4 '07 #3
kenobewan
4,871 Expert 4TB
I believe you need to open it in 2005 to convert, so better off using a COM. HTH.
Jun 4 '07 #4
Frinavale
9,735 Expert Mod 8TB
i am right clicking on the project in Solution explore, and trying to add a reference. In the reference window, under the browse tab, i try to add a reference to my dll. I have also copied that dll into the project directory. But when i select the dll and click on ok i get a message box saying"A reference to the dll could not be added. Make sure the file is accessible, and it is a valid assembly or COM component"

The dll was made in VC++ 6.0

Does vb.net not support simple dlls?? or am i doing something wrong??
I've had no problems using a VB6 DLL in my project.
Is this a web application that you're working with?

It sounds like you have a permissions problem. I'd suggest moving the DLL to a folder where permissions are set to allow your program to use the DLL..then re-referencing the DLL into your project.

I've had problems in the past where my web user account was not given permissions to use the DLL...it wouldn't work properly until I moved it to a directory that gave my program permissions to use it.

Cheers!

-Frinny
Jun 4 '07 #5
Motoma
3,237 Expert 2GB
Most likely it is a native binary DLL, as opposed to a .NET assembly or COM object. You can only add .NET assemblies or COM object as references. If you want to reference a COM object, it should first be registered on the machine.

If you want to include a native DLL, you will have to use the DllImport keyword and include the DLL file in the same directory, or in one of the directories in your PATH.
Jun 4 '07 #6
ya its a native dll, i have used dll import command, and have added the dll in my project folder. After i publish the project, it works perfectly fine on my PC. but when i install the setup on another machine, then after running the project, it gives a dll not found exception.The published setup does contain the dll but its path is somehow not found on the other PC. im giving a relative path for the dll.
Jun 5 '07 #7
Motoma
3,237 Expert 2GB
ya its a native dll, i have used dll import command, and have added the dll in my project folder. After i publish the project, it works perfectly fine on my PC. but when i install the setup on another machine, then after running the project, it gives a dll not found exception.The published setup does contain the dll but its path is somehow not found on the other PC. im giving a relative path for the dll.
I think you can just use the DLL name if you put it in the same directory as the EXE, or if you put it in one of the standard folders (I.E. the PATH system variables: windows\system32 ...etc).
Jun 5 '07 #8
Bum
19
Sometimes when it says "file not found", it's not the dll that's missing, but a component that makes up the dll. Look at the dlls dependencies using someting like DLLExplorer. The dlls dependencies are on your pc, but not the client's. Hope this helps.
Feb 12 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by mcwooq | last post: by
reply views Thread by Manikandan | last post: by
2 posts views Thread by Norman Diamond | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.