未在 Visual Studio 2010 中加载的引用 DLL [英] Reference DLLs not loading in Visual Studio 2010

查看:22
本文介绍了未在 Visual Studio 2010 中加载的引用 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 VS2010 中处理 C# 4.0 项目,需要使用一些较旧的 DLL,其中包含在 VS2008 上的 C# 3.5 中创建的控件.当我第一次将 DLL 添加到引用时,我能够通过智能感知看到命名空间并创建一个控件的实例,但是当我去构建时,它给了我以下错误:

I'm working on a C# 4.0 project in VS2010 and needed to use some older DLLs containing controls that were created in C# 3.5 on VS2008. When I first add the DLLs to the references, I was able to see the namespace via intellisense and create an instance of one of the controls, but when I go to build, it gives me the following error:

The type or namespace name 'BCA' could not be found (are you missing a using directive or an assembly reference?)

而且我确实已经有一个用于该命名空间的 using 指令,现在用红色下划线标出,表明 VS 找不到它.现在,intellisense 根本不会选择该命名空间.

And I do have a using directive for that namespace already, which is now underlined in red, showing that VS cannot find it. And now, intellisense won't pick up that namespace at all.

我什至尝试将控件添加到工具箱(有效),但是当我将它们拖到 GUI 时,它说它无法找到 DLL 引用,即使它显然知道它在哪里.

I even tried added the controls to the toolbox (which worked) but then when I drag them to the GUI, it says that it cannot locate the DLL reference, even though it obviously knows where it is.

我什至尝试将目标框架更改为 3.5,但结果仍然相同.

I even tried changing the target framework to 3.5, but still with the same results.

关于为什么会发生这种情况的任何想法?

Any thoughts as to why this could be happening?

编辑 - 我注意到在 VS 输出的 csc.exe 参数中,它没有我尝试使用的 DLL 的任何/reference 条目.当我在 VS2008 中创建相同的基本项目时,这些条目存在.另外,我可以在 VS2010 中成功引用 DLL 项目中的 DLL... 似乎只是不起作用的 WinForms 项目.

Edit - I've notice that in the csc.exe arguments that VS outputs, it does not have any /reference entries for the DLLs I'm trying to use. When I create the same basic project in VS2008, those entries exist. Also, I can successfully reference the DLLs in a DLL project in VS2010... it seems to just be WinForms projects that don't work.

推荐答案

事实证明,这与 VS2010 默认为 .NET 4 客户端配置文件有关,我将其更改为它构建的常规配置文件很好.浪费了一天...

Turns out that it was something to do with VS2010 defaulting to the .NET 4 client profile, as soon as I changed it to the regular profile it built fine. There's a day wasted...

这篇关于未在 Visual Studio 2010 中加载的引用 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆