将目录添加到 ASP.NET 卷影副本
在我的 ASP.NET 应用程序中,我尝试添加另一个目录以对其中的 DLL 进行影子复制。
我发现允许 m 执行此操作的唯一方法是AppDomain.CurrentDomain.SetShadowCopyPath。
但是,此方法被标记为已过时
。 MSDN对此有这样的说法
<块引用>SetShadowCopyPath(String path) 消息:AppDomain.SetShadowCopyPath 已被弃用。请调查 AppDomainSetup.ShadowCopyDirectories 的使用。
但是,每当我为其设置值时,AppDomainSetup.ShadowCopyDirectories
属性似乎都没有改变。
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = "mydirectory;bin";
string test = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories; // returns bin, which was the original directory
是否有原因导致它不会改变并且有解决方法吗?
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
SetShadowCopyPath(String path) Message: AppDomain.SetShadowCopyPath has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
路径必须是绝对路径 - 我会在 Application_Start (1) 中尽早设置。
(1) -
AssemblyResolve 事件在编译期间不会触发aspx 页面的动态程序集
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