繁体   English   中英

升级到Visual Studio 2010之后-类型或名称空间名称'xxxxxxxxx_ascx'在名称空间'ASP'中不存在

[英]After upgrading to Visual Studio 2010 - The type or namespace name 'xxxxxxxxx_ascx' does not exist in the namespace 'ASP'

我们最近将网站项目升级到了Visual Studio 2010。

现在,每当尝试发布带有“允许此预编译站点为可更新站点”的网站时,都会出现此错误。

以前使用Visual Studio 2008可以正常工作,所以我不确定为什么现在不工作。

The type or namespace name 'xxxxxxxxx_ascx' does not exist in the namespace 'ASP' 
(are you     missing an assembly reference?)

导致错误的行都在做这种事情。

ASP.content_Controls_Info_ascx infoControl = new ASP.content_Controls_Info_ascx();
infoControl.Stages =  query.ToList();
PlaceHolder1.Controls.Add(infoControl);

我还没有升级其他任何东西,所以点网框架仍然是3.5

该站点可以正常运行,并且发布作品无需检查“允许此预编译的站点可更新”。 代码的content_Controls_Info_ascx部分还突出显示了类名,以便找到它。

.sln文件中,找到与您的Web站点项目相关的部分。 看起来像这样:

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "YourWebProject", "..\WEB\YourWebProject", "{A3774FE1-AA19-4A0F-94C9-FA58084B2429}"
    ProjectSection(WebsiteProperties) = preProject
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
        ProjectReferences = "..."
        Debug.AspNetCompiler.VirtualPath = "/YourWebProject"
        Debug.AspNetCompiler.PhysicalPath = "..\WEB\YourWebProject\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\YourWebProject\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "false"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/YourWebProject"
        Release.AspNetCompiler.PhysicalPath = "..\WEB\YourWebProject\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\YourWebProject\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = "true"
        Release.AspNetCompiler.FixedNames = "false"
        Release.AspNetCompiler.Debug = "False"
        VWDPort = "2487"
    EndProjectSection
EndProject

并将以下属性设置为“ false ”(我使用记事本编辑.sln文件):

  • Debug.AspNetCompiler.Updateable =“
  • Release.AspNetCompiler.Updateable =“ false

默认情况下,它们设置为“ true ”并发生错误:

类型或名称空间名称“ xxxxxxxxx_ascx”在名称空间“ ASP”中不存在(您是否缺少程序集引用?)

这个解决方案对我有帮助。

这是网站模板的已知问题。 解决方案是将其转换为Web应用程序项目。 更多信息:

http://codersbarn.com/post/2008/06/01/ASPNET-Web-Site-versus-Web-Application-Project.aspx

http://www.west-wind.com/weblog/posts/2005/Sep/12/Understanding-Page-Inheritance-in-ASPNET-20

您可以检查引用,以防万一,但是使用网站模板,尤其是用户控件和外部项目/库,您很可能会再次遇到此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM