默认的aspx无法访问其他项目中的类

时间:2013-11-02 21:48:08

标签: c# asp.net

我创建了一个名为TestWeb的新Asp Web应用程序项目。我还创建了另一个类库应用程序来包含模型类并调用此模型。在TestWeb中,我添加了对Model的引用,可以在该项目的bin文件夹中看到.dll文件。但是当在TestWeb中的default.aspx文件夹中时,我无法访问Model命名空间。这让我疯了。我做错了什么。

我注意到的一件事是我的about页面可以访问命名空间但是default.aspx不能

由于

1 个答案:

答案 0 :(得分:1)

我能够在这些步骤中获得类似的功能:

1. Create Solution "MySolution"
2. Add a WebSite or Web Application project to "MySolution" named "MyWeb"
3. Add a Class Library Project To "MySolution" named "MyLibrary"
4. Select "MyWeb" project in the Solution Explorer and select the references node
5. Click Add Reference
6. Select the Solution List View Item on the right hand side
    NOTE : You should see "MyLibrary" as a selection
7. Select "MyLibrary"
8. Open "MyWeb" Default.aspx -> cs or vb file.
9. Add using MyLibrary.ClassName

我能够引用和实例化“MyLibrary”类就好了。如果您将代码添加到“MyLibrary”,您可能需要重建它,以便intellisense立即获取更改。

相关问题