Visual Studio 2010中突然不能看空间? [英] Visual Studio 2010 suddenly can't see namespace?

查看:150
本文介绍了Visual Studio 2010中突然不能看空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C#的WinForms解决方案有两个项目。
一个DLL这是我工作的主要项目,可执行的WinForms我称之为沙盒,这样我可以编译/运行/调试DLL容易一气呵成。

My C# WinForms solution has two projects. A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.

我在.NET 4.0中工作了两个项目。

I'm working in .Net 4.0 for both projects.

一切工作正常,直到我加了一些貌似无辜code,并在DLL中的System.Web参考。
现在我的沙盒项目无法看到DLL项目的命名空间。我没有改变任何东西,我相信应该已经影响这一点。

Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL. Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.

如果我删除该项目引用从Sandbox引用和DLL重新添加,那么红强调全部消失和颜色编码回来为我所有类等;但只要我努力构建解决方案,整个事情就会崩溃一次。

If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.

在Sandbox的引用和视图对象浏览器当我右键单击该DLL项目,我可以看到在那里命名空间,所有的东西。

When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.

我有一种感觉,这可能是某种错误的?

I have a feeling this might be some sort of bug?

这是某种形式的VS2010的bug?我在几个月前有这个同样的问题,我只能通过一个全新的项目,并重新导入我的文件的时候修复它。但是这一次,我有一个bajillion文件,只会做,作为最后一招!

Is this some sort of VS2010 bug? I had this same issue a few months ago and I could only fix it at the time by making a whole new project and re-importing my files. This time, however, I have a bajillion files and will only do that as a last resort!

编辑:
panickedly经历和撤消我的变化,试图找出是什么原因造成的问题后,它似乎是这一行:

After panickedly going through and undoing all my changes, trying to find what caused the problems, it seems to be this line:

string url = "http://maps.google.com?q=" + HttpUtility.UrlEncode(address);

如果我注释掉这一行,然后我得到没有命名空间的错误和生成项目的罚款。我看不出什么毛病此行虽然。

If I comment out this line, then I get no namespace errors and the project builds fine. I can't see anything wrong with this line though.

推荐答案

我准备宣布这个VS2010中的一个bug,这已经被咬了太多的程序员。解决方法是简单的:项目+属性,应用程序选项卡,更改目标框架.NET框架4,而不是由默认选择客户端配置文件

I'm ready to declare this a bug in VS2010, this has bitten way too many programmers already. The fix is easy: Project + Properties, Application tab, change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.

的System.Web不包括在客户简档。其摆在首位此选项是相当愚蠢的,客户端配置文件是比.NET 4.0的完整版小只有15%。有它在默认情况下选中甚至愚蠢。但是,我离题。

System.Web is not included in the client profile. Having this option in the first place is quite silly, the client profile is only 15% smaller than the full version of .NET 4.0. Having it selected by default is even sillier. But I digress.

更新:仁慈这一切都得到了修复VS2012。这不再使客户机配置文件为新项目的默认。和客户端配置得到了在.NET 4.5,甩掉包袱彻底退役。

UPDATE: mercifully this all got fixed in VS2012. Which no longer makes the client profile the default for a new project. And the client profile got retired completely in .NET 4.5, good riddance.

这篇关于Visual Studio 2010中突然不能看空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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