ASP.NET网站的BIN目录和引用

发布于 2024-07-11 17:04:28 字数 538 浏览 5 评论 0原文

想象一下以下解决方案:

  • 网站 ABC.com(不是 Web 应用程序)
  • BLL(单独程序集中的业务逻辑层)
  • DTO(其自己的程序集中的 dto 对象)
  • DAL(也在其自己的程序集中的数据访问层)。< /p>

    1. BLL 引用了 DAL。
    2. BLL 引用了 DTO 层。
    3. 网站项目引用了 BLL。

编译网站工程时,BIN目录下会出现以下DLL:
BLL.dll
DTO.dll
DAL.dll

当人们去预览网站时,会发生由于没有必要的程序集引用而发生的错误...现在,如果右键单击网站项目,添加引用,并显式添加对缺少的程序集的引用,它将起作用美好的。

在我看来,ASP.NET 会提取网站中添加/引用的引用程序集的引用程序集。

为什么需要添加对引用的引用的显式引用...? 抱歉,如果我的措辞不正确或者令人困惑。

Imagine the following solution:

  • Website ABC.com (not Web Application)
  • BLL (business logic layer in a seperate assembly)
  • DTO (dto objects in their own assembly)
  • DAL (data access layer in it's own assembly as well).

    1. The BLL has a reference to the DAL.
    2. The BLL has a reference to the DTO layer.
    3. The Website project references the BLL.

When one compiles the website project, the following DLLs will appear in the BIN directory:
BLL.dll
DTO.dll
DAL.dll

When one goes to preview the site, an error occurs about not having the necessary assembly references... Now if one right clicks on the website project, Add Reference, and explicitly add the reference to the missing assemblies, it will work fine.

It seems to me like ASP.NET pulls the referenced assemblies of the referenced assembly being added/referenced in the website.

Why does one need to add explicit references to the references of the references... ? Sorry if I'm not wording this correctly or if it confusing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

往日情怀 2024-07-18 17:04:28

我认为问题可能与使用网站项目(而不是 Web 应用程序)有关。 我一时记不清了,但与 Web 应用程序项目相反,网站项目的编译方式有些奇怪。

I think the problem may have to do with using a web site project, as oppossed to a Web Application. I can't remember off the top of my head, but there's something funky about the way web site projects are compiled, as oppossed to web application projects.

じ违心 2024-07-18 17:04:28

这是关于您的问题编译和部署的好文章。

它与运行时编译的“WebSites”有关。 希望以上文章能够解答您的问题。

Here is a good article on your question Compilation and Deployment.

It has something to do with "WebSites" being compile at runtime. Hopefully the above article will answer your question.

旧情勿念 2024-07-18 17:04:28

今天刚刚为我正在进行的项目测试了这个场景。 您只需将程序集添加到 Web.config 中即可,如下所示:

<compilation debug="true">
  <assemblies>
    <clear/>
    <add assembly="mscorlib"/>
    <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

    <add assembly="YourBLLLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  </assemblies>
</compilation>

此外,您的程序集应保留在网站根目录下著名的 ./bin 文件夹中。
GL!

Just tested this scenario today for the project I'm on. You should be just fine just adding your assembly in Web.config as:

<compilation debug="true">
  <assemblies>
    <clear/>
    <add assembly="mscorlib"/>
    <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

    <add assembly="YourBLLLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  </assemblies>
</compilation>

Also your assemblies should stay in the famous ./bin folder of your web site's root.
GL!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文