none
WPF 插件模式中,AddIns.store 这个文件是什么时候在Addins 目录下面创建的呢? RRS feed

  • 问题

  • WPF 插件模式中,AddIns.store 这个文件是什么时候在Addins 目录下面创建的呢?

    不创建能行吗?

    2014年10月29日 2:48

答案

  • 你好,

    首先我建议你参阅一下这个MSDN文档去理解一下你提到的addinstore的作用:http://msdn.microsoft.com/en-us/library/bb384188(v=vs.110).aspx

    “Host applications can discover add-ins that are available to them. Discovery consists of two tasks:

    Registering information about all add-ins and pipeline segments into cache files.

    Finding add-ins for a specified host view of the add-in by searching the cache.

    Depending on the application, the host typically discovers add-ins at startup, when a document is loaded, or upon a user request. The AddInStore class provides methods to perform these tasks”

    这里说明了HostAdd-ins的机制,这个机制包括了两个步骤,第一个是吧add-ins相关信息和pipeline segments注册到cache文件中,第二个则是通过查找cache找到需要的add-ins

    那么重点就是这个Cache,参照以下文档:

    “The result of calling the registration methods are two cache files:

    PipelineSegments.store

    This file is located in the root directory of the pipeline directory structure.

    AddIns.store

    This file is located in the directory that contains one or more add-in subdirectories. This directory can be within the pipeline directory structure or at another location”

    你所提到的Addins.store就是两个cache文件中的一个。

    所以现在我们来看你的问题,

    第一个,什么时候创建,在文档里你可以看到这样一句“The methods used for registration take a string variable that represents the pipeline root path, or a value from the PipelineStoreLocation enumeration. They create new cache files if these files have not been previously created. 所以我觉得可以理解为该文件在你调用方法注册的时候会被创建。

    第二个,不创建能行么?这里让Host程序能够识别的机制就是从Cache里面找到合适的Add-ins,所以为了实现这个机制,我们需要这个目录存在。

    附上一些参考的文章:

    AddinStore Class: http://msdn.microsoft.com/en-us/library/vstudio/system.addin.hosting.addinstore(v=vs.90)

    Pipeline Development Requirements: http://msdn.microsoft.com/en-us/library/bb384240(v=vs.110).aspx

    Regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 JUNZHANG 2014年11月6日 7:08
    2014年10月30日 9:34
    版主