问题描述
在我的 ASP.NET 应用程序中,我试图添加另一个目录以将其中的 DLL 进行阴影复制.
我发现允许 m 执行此操作的唯一方法是 AppDomain.CurrentDomain.SetShadowCopyPath
.
然而,这个方法被标记为Obsolete
.MSDN有这个说法
SetShadowCopyPath(String path) 消息:AppDomain.SetShadowCopyPath 已被弃用.请调查 AppDomainSetup.ShadowCopyDirectories 的使用情况.
但是,AppDomainSetup.ShadowCopyDirectories
属性在我为其设置值时似乎不会改变.
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = "mydirectory;bin";字符串测试 = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories;//返回 bin,这是原始目录
是否有不改变的理由?是否有解决办法?
路径必须是绝对的 - 我会在 Application_Start (1) 中尽早设置.
(1) -AssemblyResolve 事件在编译期间未触发aspx 页面的动态程序集
In my ASP.NET app, I'm attempting to add another directory to be have the DLLs in it shadow copied.
The only method I found that will allow m to do this is AppDomain.CurrentDomain.SetShadowCopyPath
.
However, this method is marked as Obsolete
. MSDN has this to say about it
However, the AppDomainSetup.ShadowCopyDirectories
property doesn't seem to change whenever I set a value to it.
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = "mydirectory;bin";
string test = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories; // returns bin, which was the original directory
Is there a reason that it won't change and is there a work around?
The paths need to be absolute - and I would set this early on in Application_Start (1).
(1) -AssemblyResolve event is not firing during compilation of a dynamic assembly for an aspx page
这篇关于将目录添加到 ASP.NET 卷影副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!