2012-03-19 105 views
0

我们最近升级了网站项目,Visual Studio 2010中升级到Visual Studio 2010后 - 类型或命名空间名称xxxxxxxxx_ascx'不存在命名空间存在“ASP”

我现在得到这个错误,每当我尝试使用“允许此预编译的网站可更新”进行发布。

这工作以前使用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部分也突出显示了类名,因此可以找到它。

回答

3

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

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 

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

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

默认情况下它们被设置为在发生“真正”和错误:

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

这个解决方案帮了我。

1

这是网站模板的已知问题。解决方案是转换为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

你可以检查的情况下,这是发生了什么事,但与该网站模板,你很可能会特别是用户控制和外部项目/库再次运行到这个问题您参考。

相关问题