简体   繁体   English

Visual Studio将找不到引用

[英]Visual Studio won't find references

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. 这里的问题是Visual Studio(2005)抛出了很多错误,因为它找不到dll的引用。 This obviously won't let VS build the project. 这显然不会让VS构建项目。

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. 即使项目引用了dll所在的文件夹bin文件夹,一切工作在人员计算机上都能正常工作但不在我的计算机上。

How can I circumvent these problems and get VS to properly reference the dlls? 我如何规避这些问题并让VS正确引用dll?

The following printscreen shows the references screen for the project. 以下printscreen屏幕显示项目的参考屏幕。

在此输入图像描述

My guess is that your DLL uses a more recent .NET framework than your application does. 我的猜测是你的DLL使用的是比你的应用程序更新的.NET框架。

Check the properties for your DLL source (right-click on the DLL code in the solution explorer and choose Properties). 检查DLL源的属性(右键单击解决方案资源管理器中的DLL代码,然后选择“属性”)。 Go to Application - Target .NET framework and compare the version to the one the application itself uses (right-click on the project code). 转到Application - Target .NET framework并将版本与应用程序本身使用的版本进行比较(右键单击项目代码)。 Note: under your application properties check both the settings under Application - Target .NET framework AND under Publish - Prerequisites. 注意:在您的应用程序属性下,选中Application - Target .NET framework AND下的Publish - Prerequisites下的设置。

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. 对于它的价值,即使在更改了.vbproj文件并删除了许多关于硬编码值的行之后, 我最终检查了该项目,再次移除了对给定DLL的所有引用,然后使用GUI添加它。

Lesson learned, don't try to change out one DLL for a newer version without using VB2005 GUI. 获得的经验教训,如果不使用VB2005 GUI,请不要尝试更换一个较新版本的DLL。 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. 找到visual studio离开硬编码路径的位置将是非常耗时的。

WOOT!!!! WOOT !!!! Compile the DLL file to a lower version of the .NET framework, and it will fix the problem!!!! 将DLL文件编译为较低版本的.NET框架,它将解决问题!

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. 可能值得卸载您的项目并编辑它以检查它的外观和版本。

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. 我在Visual Studio 2008中打开的旧Visual Studio项目遇到了同样的问题。我尝试添加对项目的新引用,并获得了无法找到dll的永久性错误。 After the migration of the Project to Visual Studio 2010 I got the following error message when I tried to add a new reference: 将项目迁移到Visual Studio 2010后,当我尝试添加新引用时收到以下错误消息:

'mySample.dll' or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. 'mySample.dll'或其依赖项之一需要.NET Framework的更高版本,而不是项目中指定的版本。 You can change ... 你可以改变 ...

After changing the projects .NET Framework to a newer version everything works fine. 将项目.NET Framework更改为更新版本后,一切正常。

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. 在我的情况下,这是因为没有成功复制(下载)库:文件存在,但是0 kB。

干净了,删除了所有的DLL然后VS2008抱怨它找不到引用(Duh !!!)并且不会重建....幸运的是我有了旧版本的dll并将其替换为目录然后做了重建以取代他们......现在所有参考都可以,我们恢复正常......好老VS 2008

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM