ASP.NET网站的bin目录和引用 [英] ASP.NET Website's BIN directory and references

查看:487
本文介绍了ASP.NET网站的bin目录和引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下以下解决方案:


  • 网站ABC.com(而不是Web应用程序)

  • BLL(在一个单独的组件,业务逻辑层)

  • DTO(自己组装DTO对象)

  • DAL(在它自己的装配数据访问层为好)。


    1. 的BLL具有对DAL引用。

    2. 的BLL具有对DTO层参考。

    3. 本网站项目引用BLL。


当一个编译网站项目,下列DLL将出现在BIN目录:结果
BLL.dll结果
DTO.dll结果
DAL.dll

当一个人去preVIEW现场,发生错误有关不具有必要的组件参照......现在,如果网站上的项目一个正确的点击,添加引用,并明确引用添加缺少的组件,它将很好地工作。

在我看来,像ASP.NET拉引用的程序集被添加/在网站上引用的引用程序集。

为什么人需要明确的引用添加到引用的参考文献......?很抱歉,如果我不是这个写法正确,或者如果它混淆。


解决方案

刚刚测试此方案今天的项目我在。您应该只是罚款只是增加你的程序集Web.config中的:

 <编译调试=真正的>
  <&集会GT;
    <清/>
    <添加组件=mscorlib程序/>
    <添加组件=系统,版本= 2.0.0.0,文化=中性公钥= b77a5c561934e089/>
    <添加组件=System.Configuration,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
    <添加组件=System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
    <添加组件=System.Data这,版本= 2.0.0.0,文化=中性公钥= b77a5c561934e089/>    <添加组件=YourBLLLib,版本= 1.0.0.0,文化=中立,公钥=空/>
  < /组件>
< /编译>

此外,您的组件时,应当留在你的网站的根著名./bin文件夹。
GL!

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.

解决方案

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!

这篇关于ASP.NET网站的bin目录和引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆