我可以让默认的 AppDomain 使用某些程序集的卷影副本吗? [英] Can I make the default AppDomain use shadow copies of certain assemblies?

查看:23
本文介绍了我可以让默认的 AppDomain 使用某些程序集的卷影副本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为什么要这样做的简短说明:

A short explanation of why I want to do this:

我正忙于为 Autodesk Revit Architecture 2010 编写插件.测试我的插件代码非常麻烦,因为我必须为每个调试会话重新启动 Autodesk,手动加载 Revit 项目,单击加载项"选项卡,然后启动我的插件.这只是花费了太长时间.

I am busy writing a plugin for Autodesk Revit Architecture 2010. Testing my plugin code is extremly cumbersome, as I have to restart Autodesk for each debug session, manually load a Revit project, click on the Add-Ins tab and then start my plugin. This is just taking too long.

我编写了第二个插件来托管 IronPython 解释器.这样,我就可以使用 Revit 提供的 API.但最终,代码必须用 C# 重写 - 并进行调试.

I have written a second plugin that hosts an IronPython interpreter. This way, I can play around with the API provided by Revit. But eventually, the code has to be rewritten in C# - and debugged.

很简单,我想:只需从 IronPython 脚本加载插件 DLL 并运行它.这确实有效,但是一旦加载,我就无法在 Visual Studio 中重新编译,因为 DLL 现在已加载到 Revits AppDomain 中.

Easy, I thought: Just load the plugins DLL from the IronPython script and exercise it. This does work, but once loaded, I cannot recompile in Visual Studio, as the DLL is now loaded in Revits AppDomain.

很简单,我想(在 StackOverflow 的帮助下):只需在新的 AppDomain 中加载 DLL.唉,RevitAPI 对象无法编组到另一个 AppDomain,因为它们不扩展 MarshalByRefObject.

Easy, I thought (with a little help from StackOverflow): Just load the DLL in a new AppDomain. Alas, the RevitAPI objects can't be marshaled to another AppDomain, as they don't extend MarshalByRefObject.

我想我可能会使用卷影副本.ASP.NET 似乎正在这样做.但是阅读 MSDN 上的文档,我似乎只能在创建 AppDomain 时指定这一点.

I think I might be onto something with shadow copies. ASP.NET seems to be doing this. But reading the documentation on MSDN, it seems I can only specify this when creating an AppDomain.

我可以为当前(默认)AppDomain 更改此设置吗?我可以强制它使用来自特定目录的 DLL 的卷影副本吗?

Can I change this for the current (default) AppDomain? Can I force it to use shadow copies of DLLs from a specific directory?

推荐答案

我不知道您要做什么,但有一些已弃用的方法可以在当前 AppDomain 上打开 ShadowCopy.

I don't know what you are trying to do but there are some deprecated methods to turn on ShadowCopy on the current AppDomain.

AppDomain.CurrentDomain.SetCachePath(@"C:\Cache");
AppDomain.CurrentDomain.SetShadowCopyPath(AppDomain.CurrentDomain.BaseDirectory);
AppDomain.CurrentDomain.SetShadowCopyFiles();

这篇关于我可以让默认的 AppDomain 使用某些程序集的卷影副本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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