找不到类型或命名空间名称“GetAdminMasterPage”

时间:2013-08-10 16:23:38

标签: c# asp.net

我一直在测试示例代码http://mywsat.codeplex.com/并尝试将项目移动到我已经构建的现有项目中。

我已将所有文件和文件夹复制到我的项目中,但对于包含: GetAdminMasterPage

的所有网页,我多次重复以下错误

The type or namespace name 'GetAdminMasterPage' could not be found (are you missing a using directive or an assembly reference?)

其中一个页面背后的示例代码是

using System;

public partial class admin_admin_edit_css : GetAdminMasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

我认为这意味着GetAdminMasterPage是继承的?已复制所有文件夹和类,GetAdminMasterPage.cs位于App_Code / class / GetAdminMasterPage.cs中。上面的代码与MyWSAT中的代码完全相同,但没有给出错误。

我还复制了Web.config文件,但没有修复错误。

请您就如何解决这个问题提出建议?

更新:

如果我复制所有文件,那么在项目中包含一切正常。一旦我选择文件夹/文件并选择“包含在项目中”,我就会收到错误。

Image1:复制的文件,显示所有文件 - 构建和运行没有错误 enter image description here

Image2:复制的文件,显示所有文件,包含在项目中 - 提供错误the type or namespace name 'GetAdminMasterPage' could not be found (are you missing a using directive or an assembly reference?) enter image description here

1 个答案:

答案 0 :(得分:1)

你已经复制了没关系,但是你仍然必须在这个GetAdminMasterPage类的文件中包含命名空间。看看它定义在哪个命名空间中,然后在

之后包含它。
using System;
//using GetAdminMasterPage - class namespace

它在App_Code/class/GetAdminMasterPage.cs中的位置是正确的,但请参阅定义它的命名空间