我可以使某些组件的默认应用程序域使用卷影副本?副本、应用程序、组件

2023-09-02 23:46:17 作者:哪个乱世没有离别

为什么我想这样做一个简短的说明:

A short explanation of why I want to do this:

我忙着写一个插件的Autodesk Revit Architecture软件2010测试我的插件code是繁琐的极端,因为我必须重新启动欧特克为每个调试会话,手动加载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的跨preTER第二个插件。这样一来,我可以玩与Revit中提供的API。但最终,在code已被重写在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.

很简单,我想(与计算器的帮助不大):就加载DLL在新的AppDomain。唉,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?

推荐答案

我不知道你想要做什么,但也有一些去precated方法来打开影拷贝在当前的AppDomain。

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();