本文介绍了Web应用程序编译错误 - ASP.NET参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在的Web应用程序本地工作精细活,有什么我目前正在与正在编制我的Web应用程序与Visual Studio选项玩弄添加Web部署项目,让所有的code后面被编译成DLL的。

还有一个特殊的生成错误,我不能摆脱掉

50错误类型或命名空间名称'usercontrols_calendarcell_ascx'在命名空间'ASP'不存在(是否缺少程序集引用吗?)C:\\ page.ascx.cs 30 1 test_deploy

和code的实际线路如下:

 保护ASP.usercontrols_calendarcell_ascx [] calendarCells;


解决方案

这个问题来自于一个事实,即命名空间ASP是一个伪的命名空间,编译时不能被引用。

我找到的解决方案是真正当前命名空间集成到用户控件定义。我适应了元素的名称命名约定,但我不知道你使用的命名空间什么。因此,我只是把它命名为Project.NameSpace。


  1. 在calendarcell.ascx文件:

    <%@控制语言=C#AutoEventWireup =真$ C $的CFile =calendarcell.ascx.cs继承=Project.NameSpace.usercontrols_calendarcell%>结果


  2. 在calendarcell.ascx.cs文件:

    命名空间Project.NameSpace结果
    {结果
    公共部分类usercontrols_calendarcell:System.Web.UI.UserControl结果
    {


  3. 在page.ascx.cs文件:

    使用Project.NameSpace;


希望这有助于。在我的情况做了完美的伎俩。

My current web app works fine locally and on live, what i am currently playing around with is compiling my Web App with the Visual Studio Option "Add Web Deployment Project" so all the code behind is compiled into DLL's.

There's is one particular build error i can not get rid off

Error 50 The type or namespace name 'usercontrols_calendarcell_ascx' does not exist in the namespace 'ASP' (are you missing an assembly reference?) c:\page.ascx.cs 30 1 test_deploy

And the actual line of code is as follows :

protected ASP.usercontrols_calendarcell_ascx[] calendarCells;
解决方案

The problem comes from the fact that the namespace ASP is a 'pseudo' namespace, which can't be referenced when compiling.

The solution I found was to actually integrate the current namespace into the usercontrol definition. I adapted the names of the elements to your naming conventions, but I don't know anything about the namespace you used. Therefore I just named it 'Project.NameSpace'.

  1. In the calendarcell.ascx file:

    <%@ Control Language="C#" AutoEventWireup="true" Codefile="calendarcell.ascx.cs" Inherits="Project.NameSpace.usercontrols_calendarcell" %>

  2. In the calendarcell.ascx.cs file:

    namespace Project.NameSpace
    {
    public partial class usercontrols_calendarcell : System.Web.UI.UserControl
    {

  3. In the page.ascx.cs file:

    using Project.NameSpace;

Hope this helps. In my case it did the trick perfectly.

这篇关于Web应用程序编译错误 - ASP.NET参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 01:27