VS2010拒绝编译一个命名空间,表示它不存在 [英] VS2010 refuses to compile a namespace, says it doesn't exist

查看:282
本文介绍了VS2010拒绝编译一个命名空间,表示它不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我转到我的项目从进入Win XP的另一台计算机上赢得7安装完成后,我意识到,东西在我APP_ code文件夹,名为像mydata.web.utils命名空间中,有一个名为像WebConstants类(为公共类和公共职能)。

I transferred my project into another computer from Win XP to Win 7. After installation, I realized that something in my App_code folder, called like mydata.web.utils namespace, has a class called like WebConstants (which is public class and public functions).

现在在像global.asax中的地区,它告诉我WebConstants不会在这种情况下存在

now in areas like global.asax, it tells me "WebConstants does not exist in this context"

虽然我有:

<%@ Import Namespace="mydata.web.utils" %>

和webconstants.cs有:

And webconstants.cs has:

namespace mydata.web.utils
{
  public class WebConstants
  {
   public static String APPLICATION_VERSION = "version";
  ........
  }
}

在webconstants.cs没有语法错误或编译器错误

No syntax errors or compiler errors in webconstants.cs

但其他地方一样,它说:什么是'网络'。??

But everywhere else, it's saying "what is 'web'"??

如果我从web.utils命名空间重命名为只是网,还是同样的问题。如果我重新命名web.utils到WEZ - 那么编译器错误消失

If I rename the namespace from "web.utils" to just "web", still same problem. If I rename "web.utils" to "wez"--then the compiler errors go away.

但我不能这样做,因为那时我不得不改变这一切了这个项目,这是一个大量的工作。

But I cannot do this, because then I'd have to change it all over the project, which is a ton of work.

我也注意到在建输出没有APP_ code项目被编译。也许是因为它是一个ASP.net文件夹,我不能肯定。那是正常的吗?

I also notice in the "build output" that there is no App_code being compiled in the project. Maybe because it's an ASP.net folder, I'm not certain. Is that normal?

它是如何同出一源$ C ​​$ C,相同的视觉工作室,产生在WinXP的电脑在Win7错误和没有错误?

How is it that the same source code, same visual studio, produces errors in win7 and no errors in the winXP computer?

推荐答案

右键单击该文件webcontants.cs并转到属性。检查以确保生成操作设置为编译。它可以设置为内容,在这种情况下VS不会把它捡起来。

Right click on the webcontants.cs file and go to Properties. Check to be sure 'Build Action' is set to 'Compile'. It may be set to 'Content', in which case VS wouldn't pick it up.

这篇关于VS2010拒绝编译一个命名空间,表示它不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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