简体   繁体   English

ASP.net Bin目录--dll加载

[英]ASP.net Bin directory - dll loading

I need to use a dll in my asp.net application. 我需要在我的asp.net应用程序中使用dll。 How do I load a dll not from a bin directory? 如何从bin目录加载DLL?

Perhaps I should mention that the application is a mixture of asp code and asp.net code. 也许我应该提一下,该应用程序是asp代码和asp.net代码的混合。 so, when I develop it on my machine, I place a dll in the bin directory, but after I move the code to the live environment, I don't want to have a separate bin directory for every piece that's using asp.net. 所以,当我在我的机器上开发它时,我将一个dll放在bin目录中,但是在我将代码移动到实时环境之后,我不希望为使用asp.net的每个部分都有一个单独的bin目录。

All I am moving is .aspx and .aspx.cs files. 我正在移动的是.aspx和.aspx.cs文件。 Is there a way to load a dll NOT FROM /bin (specify it with "using" statement)? 有没有办法加载一个DLL NOT FROM / bin(用“using”语句指定)? Looks like it automatically looks in the /bin.... 看起来它会自动查找/ bin ....

You can either place the DLL in the bin folder of the root of your application, or install it to the Global Assembly Cache (GAC) using gacutil (which requires the assembly to be strong-named and signed). 您可以将DLL放在应用程序根目录的bin文件夹中,也可以使用gacutil将其安装到全局程序集缓存(GAC) (这需要对程序集进行强名称和签名)。

I would just keep it in the bin. 我会把它放在垃圾箱里。

.net app looks in the /bin of the project, and the GAC (Global Assembly Cache) where you put system shared DLL-s. .net app查看项目的/ bin,以及放置系统共享DLL-s的GAC(全局程序集缓存)。

If your app is one .net app (configured in IIS as one app), but you have aspx files in subfolders, they should see the root /bin folder. 如果您的应用程序是一个.net应用程序(在IIS中配置为一个应用程序),但您在子文件夹中有aspx文件,则应该看到root / bin文件夹。 i'd stick with keeping dlls in /bin, if that isn't several tenths of bins (which would mean that you have a problem with your app organization). 如果不是十分之二的垃圾箱(这意味着您的应用程序组织有问题),我会坚持将垃圾箱保存在/ bin中。

Simply add the other dll's directories to your path environment variable. 只需将其他dll的目录添加到路径环境变量中。 Must restart asp.net process / visual studio for the change to take effect. 必须重启asp.net进程/ visual studio才能使更改生效。 Worked for me. 为我工作。

GAC and bin are the only usual options. GAC和bin是唯一常用的选项。

You might also be able to configure your other folder as an additional bin folder , but I wouldn't hold my breath — this is from 1.1 and you still need to be within the same vdir as the main application. 您也可以将其他文件夹配置为附加的bin文件夹 ,但我不会屏住呼吸 - 这是来自1.1,您仍然需要与主应用程序在同一个vdir中。

that's the thing: because it's poorly organized (its a mix of asp and asp.net) it's certainly NOT configured properly....I think it's best to have "10 thousands bins" for now. 事情是这样的:因为它的组织性很差(它是asp和asp.net的混合体),它肯定没有正确配置....我认为现在最好有“10千箱”。

Thanks guys! 多谢你们!

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

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