Visual Studio won't find references

2019-07-05 02:39发布

问题:

I'm working with some application handed over by another person in which I must document the requirements, build and deploy processes.

The problem here is that Visual Studio (2005) is throwing a lot of errors since it can't find the references for the dlls. This obviously won't let VS build the project.

Everything works fine on the persons computer but not on mine, even though the project references the same folder where the dlls are, the bin folder.

How can I circumvent these problems and get VS to properly reference the dlls?

The following printscreen shows the references screen for the project.

回答1:

My guess is that your DLL uses a more recent .NET framework than your application does.

Check the properties for your DLL source (right-click on the DLL code in the solution explorer and choose Properties). Go to Application - Target .NET framework and compare the version to the one the application itself uses (right-click on the project code). Note: under your application properties check both the settings under Application - Target .NET framework AND under Publish - Prerequisites.



回答2:

For what it's worth, even after changing the .vbproj file and removing many lines about hard coded values, I eventually checked out the project again removed all references to the given DLL and then added it using the GUI.

Lesson learned, don't try to change out one DLL for a newer version without using VB2005 GUI. The easiest solution will probably be to transfer everything to another project. It will be incredibly time consuming to find where visual studio has left the hard coded path at.

WOOT!!!! Compile the DLL file to a lower version of the .NET framework, and it will fix the problem!!!!



回答3:

The paths in the project file cannot be the same or the assemblies referenced have a different version.

It might be worth unloading your project and the editing it to inspect where it's looking and for what version.



回答4:

I had the same problem with an older Visual Studio Project that I opened in Visual Studio 2008. I tried to add new references to the project and got permanent errors that the dll's cannot be found. After the migration of the Project to Visual Studio 2010 I got the following error message when I tried to add a new reference:

'mySample.dll' or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change ...

After changing the projects .NET Framework to a newer version everything works fine.



回答5:

Good suggestions in other answers. In my case, it was because the libraries weren't copied (downloaded) successfully: the files existed, but were 0 kB.



回答6:

Did a clean, which removed all the DLL's and then VS2008 complained it couldn't find the references (Duh!!!) and wouldn't rebuild....luckily I had and old version of the dll's and replaced them in the directory AND THEN did a rebuild to replace them...all references are now OK and we're back to normal....good old VS 2008