Asp.Net APP_ code类为重点Visual Studio中的“未声明',但无论如何编译 [英] Asp.Net App_Code classes are highlighted as 'is not declared' in Visual Studio, but compiles anyway

查看:146
本文介绍了Asp.Net APP_ code类为重点Visual Studio中的“未声明',但无论如何编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了VB.Net ASP.Net网站(不是Web应用程序)可疑的血统。

I've inherited a VB.Net ASP.Net Website (not a Web Application) of questionable lineage.

在编辑在Visual Studio:当住在APP_ code类('APP_ code \\ EditClass.vb')引用类('APP_ code \\ RefClass.vb')的也住在APP_ code,Visual Studio将标志着一个蓝色的波浪线和错误类的引用:名称'RefClass不宣

While editing in Visual Studio: when a class ('App_Code\EditClass.vb') that lives in App_Code references a class ('App_Code\RefClass.vb') that also lives in App_Code, Visual Studio marks the class reference with a blue squiggle and error: Name 'RefClass' is not declared.

智能感知也没有工作的这些引用。

Intellisense is also not working on these references.

我从生活在APP_ code类数百个这样的错误。不过,一切都编译就好了,和作品。

I have hundreds of these errors from the classes that live in App_Code. However, everything compiles just fine, and works.

如果RefClass在页面(webpage.aspx.vb)后面一个正常的网页code引用,我没有得到蓝色的波浪线或错误,但IntelliSense不上类工作。

If RefClass is referenced in a normal webpage code behind page (webpage.aspx.vb), I don't get the blue squiggle or the error, but Intellisense doesn't work on the class.

我该如何摆脱这些幻象的错误,并获得智能感知的工作?

How do I get rid of these phantom errors, and get Intellisense working?

推荐答案

看起来问题出在目录结构。该网站是在C:\\ Site.com \\ httpdocs资料,所有这下正常ASP.Net目录。因此,APP_ code是在C:\\ Site.com \\的httpdocs \\ APP_ code

It looks like the problem is the directory structure. The website is in C:\Site.com\Httpdocs, with all the normal ASP.Net directories under this. So, App_Code was at C:\Site.com\Httpdocs\App_Code.

由于该网站是在VS位于C打开:\\ Site.com,额外的水平降低到APP_ code混淆了它

As the website was opened in VS at C:\Site.com, the extra level down to App_Code was confusing it.

更改VS打开网站到C:\\ Site.com \\ httpdocs资料解决了这一问题。

Changing the VS 'Open Website' to C:\Site.com\Httpdocs fixed the problem.

嗯,继承的乐趣...

Ah, the joys of inheritance...

这篇关于Asp.Net APP_ code类为重点Visual Studio中的“未声明',但无论如何编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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