Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

c# - 找不到类型或命名空间名称[重复](The type or namespace name could not be found [duplicate])

This question already has an answer here:

(这个问题在这里已有答案:)

I have a C# solution with several projects in Visual Studio 2010 .

(我有一个C#解决方案,在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 ").

(一个是测试项目(我将其称为“ PrjTest ”),另一个是Windows Forms Application项目(我称之为“ PrjForm ”)。)

There is also a third project referenced by PrjForm, which it is able to reference and use successfully.

(还有一个由PrjForm引用的第三个项目,它能够成功引用和使用。)

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

(PrjForm引用PrjTestPrjForm有一个带有using语句的类:)

using PrjTest;
  1. Reference has been correctly added

    (参考已正确添加)

  2. using statement is correctly in place

    (using语句正确到位)

  3. Spelling is correct

    (拼写是正确的)

  4. PrjTest builds successfully

    (PrjTest构建成功)

  5. PrjForm almost builds, but breaks on the using PrjTest;

    (PrjForm几乎构建,但打破了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?)

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

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)

    (删除了Resharper(因为Resharper在识别引用的项目时没有遇到任何麻烦,我认为它可能值得一试))

  2. Removed and re-added the reference and using statement

    (删除并重新添加了引用和using语句)

  3. Recreated PrjForm from scratch

    (从头开始重新创建PrjForm)

  4. PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder

    (PrjForm目前驻留在PrjTest文件夹中,我尝试将其移动到外部文件夹)

  5. Loaded the solution on a different computer with a fresh copy of VS 2010

    (使用VS 2010的新副本在另一台计算机上加载解决方案)

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

(我做完了我的功课,花了很长时间在线寻找答案,但没有一个解决方案有帮助。)

What else could I try?

(我还能尝试什么?)

  ask by Anders translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

(PrjForm设置为“.Net Framework 4 Client Profile”我将其更改为“.Net Framework 4”,现在我已成功构建。)

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

(我想它认为,经过在线搜索所花费的所有时间后,我发现解决方案发布后的几分钟,我想诀窍是知道正确的问题要问...)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...