简体   繁体   English

如何将我的dll组织到ASP.NET中bin目录下的多个文件夹中?

[英]How can I organize my dll's into multiple folders under the bin directory in ASP.NET?

How can I take several dll's in my bin folder for my ASP.NET application organize them into seperate folders and leave them under the bin directory so that they still are readily accesible to the application as if they were in the root of the bin? 我如何在我的bin文件夹中为我的ASP.NET应用程序取几个dll将它们组织成单独的文件夹并将它们留在bin目录下,这样它们仍然可以像应对程序的根目录一样容易访问应用程序? I want to reduce the monstrous list of dlls and group them into folders related to their core purpose. 我想减少可怕的dll列表并将它们分组到与其核心目的相关的文件夹中。

You can make your application probe other directories for loading assemblies by using the web.config file and specifying a <probing> element. 您可以使用web.config文件并指定<probing>元素,使应用程序探测其他目录以加载程序集。 I'm unclear as to whether or not this works now with website type projects, as it did not several years ago. 我不清楚这是否适用于网站类型的项目,就像几年前一样。 It should, however, work with Web Application type projects. 但是,它应该与Web应用程序类型项目一起使用。

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <probing privatePath="bin\subdir"/>
    </assemblyBinding>
   </runtime>
   <system.web>
      ....
       ....
   </system.web>
</configuration> 

Don't do that. 不要那样做。 Even if it works, it will not be understood by anyone else. 即使它有效,也不会被其他任何人理解。

If you're bothered by the number of assemblies in the bin folder, then don't look there. 如果您对bin文件夹中的程序集数量感到困扰,那么不要看那里。

There was an article Moving the Code-Behind Assemblies/DLLs to a different folder than /BIN with ASP.NET 1.1 有一篇文章将代码隐藏的程序集/ DLL移动到与ASP.NET 1.1不同的/ BIN文件夹

I suppose the approach with using assemblyBinding Element for runtime can work for .NET 2.0 too 我认为使用assemblyBinding Element for runtime的方法也适用于.NET 2.0

But I agree that it is not recommended... 但我同意不建议......

Are you trying to organize the dlls generated by the app after compilation or the 3rd party and external dlls used by your app? 您是否尝试在编译后组织应用程序生成的dll或应用程序使用的第三方和外部dll?

If it is the latter and you are not doing so already you can organize these into any hierarchy you choose outside the app (but inside the solution). 如果是后者而您尚未这样做,则可以将这些组织到您在应用程序外部选择的任何层次结构中(但在解决方案内)。 You can then reference the dlls from there. 然后你可以从那里引用dll。

Trying to organize the asp.net compiler generated files feels like swimming upstream. 尝试组织asp.net编译器生成的文件感觉就像游泳上游。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM