不能将项目用作库引用

时间:2015-12-09 10:17:18

标签: c# asp.net

我有一个名为ProfileManager的ASP.NET Web窗体应用程序。在这个应用程序中,我有类名为ProfileManager.Entity,ProfileManager.DAL等的类

我从另一个ASP.NET Web窗体应用程序引用该项目的dll。

在第二个应用程序的代码中,我正在写这样的行

using ProfileManager.Entity;
using ProfileManager.DAL;

但是Visual Studio为上面的行提供了以下错误

找不到类型或命名空间名称“ProfileManager”(您是否缺少using指令或程序集引用?

我附上截图来解释。

enter image description here

enter image description here

我将ProfileManager项目的名称以及所有名称空间更改为ProfileManagerLibrary。但我仍然得到同样的错误。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

您需要将ProfileManager编译为一种类型的库,而不是一种应用程序。将其编译为ASP.NET Web应用程序意味着它只能从Web服务器运行,不能用作库引用。