类型或命名空间名称找不到 [英] The type or namespace name could not be found

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

问题描述

我在 Visual Studio 2010中有几个项目 C#解决方案
一个是测试项目(我称之为 PrjTest 的),另一种是 Windows窗体应用程序项目(我称之为 PrjForm 的)。也有通过PrjForm,它是能够引用并成功地使用所引用的第三个项目

PrjForm 的引用 PrjTest PrjForm 的有一个使用声明一个类

 使用PrjTest;


  1. 参考已正确添加

  2. 使用语句正确就位

  3. 的拼写是否正确

  4. PrjTest成功生成

  5. PrjForm建立差不多,但断使用PrjTest; 与错误行:

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

我试过下面来解决此问题:


  1. 删除ReSharper的(因为ReSharper的没有任何麻烦,承认引用的项目,我想这可能是值得一试)

  2. 删除并重新添加了引用和using语句

  3. 重新PrjForm从头

  4. PrjForm当前所在的PrjTest文件夹内,我试图将其移动到外部文件夹

  5. 加载不同的计算机上该解决方案使用的全新副本VS 2010

我已经做了我的功课,花了很多时间寻找一个答案在网上,没有任何解决方案帮助呢。

还有我该怎么办?


解决方案

请参见这个问题

原来这是一个客户端分析问题。

PrjForm被设置为NET框架4客户端配置文件
我把它改成.Net框架4,现在我有一个成功的构建。

谢谢大家!
我想它的数字,经过所有花费的时间上网查询,我发现张贴后的溶液分钟,我猜诀窍是知道正确的问题要问。

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 references PrjTest, and PrjForm has a class with a using statement:

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:

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

I've tried the following to resolve this:

  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, no solution has helped yet.

What else could I try?

解决方案

See this question.

Turns out this was a client profiling issue.

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..

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

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