本文介绍了找不到类型或命名空间名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C# 解决方案,其中包含 Visual Studio 2010 中的多个项目.一个是测试项目(我称之为PrjTest"),另一个是Windows Forms Application 项目(我称之为PrjForm").还有一个PrjForm引用的第三个项目,可以成功引用使用.

I have a C# solution with several projects in Visual Studio 2010.One is a test project (I'll call it "PrjTest"), the other is a Windows Forms Application project (I'll call it "PrjForm"). There is also a third project referenced by PrjForm, which it is able to reference and use successfully.

PrjForm 引用了 PrjTest,并且 PrjForm 有一个带有 using 语句的类:

PrjForm references PrjTest, and PrjForm has a class with a using statement:

using PrjTest;
  1. 已正确添加参考
  2. using 语句正确到位
  3. 拼写正确
  4. PrjTest 构建成功
  5. PrjForm 几乎可以构建,但在 using PrjTest; 行上中断并出现错误:
  1. Reference has been correctly added
  2. using statement is correctly in place
  3. Spelling is correct
  4. PrjTest builds successfully
  5. PrjForm almost builds, but breaks on the using PrjTest; line with the error:

找不到类型或命名空间名称PrjTest"(您是否缺少 using 指令或程序集引用?)

我尝试了以下方法来解决这个问题:

I've tried the following to resolve this:

  1. 移除了 Resharper(因为 Resharper 可以轻松识别引用的项目,我认为它可能值得一试)
  2. 删除并重新添加了引用和使用语句
  3. 从头开始重新创建 PrjForm
  4. PrjForm 当前位于 PrjTest 文件夹内,我尝试将其移动到外部文件夹
  5. 使用 VS 2010 的全新副本在另一台计算机上加载解决方案
  1. Removed Resharper (since Resharper had no trouble recognizing the referenced project, I thought it might be worth a shot)
  2. Removed and re-added the reference and using statement
  3. Recreated PrjForm from scratch
  4. PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder
  5. Loaded the solution on a different computer with a fresh copy of VS 2010

我已经做完功课,花了很长时间在网上寻找答案,但没有一个解决方案有帮助.

I have done my homework and spent far too long looking for an answer online, none of the solutions has helped yet.

我还能尝试什么?

推荐答案

参见 这个问题.

事实证明这是一个客户端分析问题.

Turns out this was a client profiling issue.

PrjForm 被设置为.Net Framework 4 Client Profile"我把它改成.Net Framework 4",现在我已经成功构建了.

PrjForm was set to ".Net Framework 4 Client Profile"I changed it to ".Net Framework 4", and now I have a successful build.

谢谢大家!我想这表明在网上搜索了这么多时间后,我在发布几分钟后找到了解决方案,我想诀窍是知道要问的正确问题..

Thanks everyone!I guess it figures that after all that time spent searching online, I find the solution minutes after posting, I guess the trick is knowing the right question to ask..

这篇关于找不到类型或命名空间名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-20 01:37