软件包创建者-需要依赖 [英] Package Creator - Require a Dependency

查看:81
本文介绍了软件包创建者-需要依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于程序包创建者来说,最好的方法是要么要求另一个程序包的依赖关系,即Forms Rendering程序包,要么安装所需的依赖关系。可以从Package Creator获得配置包,但是如果一个包中有许多配置项,这将显得乏味。

What is best practice for the Package Creator to either require a dependency of another package, i.e. the Forms Rendering package, or install the required dependency. The configuration packages are available from Package Creator but that appears tedious if a package has numerous config items.

推荐答案

Composite的当前版本C1软件包创建者(v.3.3)没有通过UI指定所需软件包的功能。我建议您为此注册功能请求并描述您的需求。您可以在 http://compositec1.codeplex.com/workitem/list/上使用创建新项基本

The current release of Composite C1 Package Creator (v.3.3) do not have features for specifying required packages via the UI. I suggest you register a feature request for this and describe your need. You can use 'Create New Item' on http://compositec1.codeplex.com/workitem/list/basic

编写自定义验证逻辑

具有某些C#开发您可以将该检查添加到软件包中。 C1 Package系统基于安装程序插件,可在安装前验证状态并执行安装工作。您可以编写这样的安装程序插件,并使其验证所需的C1软件包的存在,然后将您的插件与您的软件包关联。

With some C# development you can add this check to a package though. The C1 Package system is based on 'installer plug-ins' that validate state before install and do the install work. You can write such an 'installer plug-in' and make it validate the presence of a required C1 Package and then associate your plug-in with your package.


  1. 创建一个从
    Composite.Core.PackageSystem.PackageFragmentInstallers.BasePackageFragmentInstaller

重写Install()和Validate()-将您的验证放入Validate()并在验证失败时返回一个或多个PackageFragmentValidationResult。让Install()简单地返回。

Override Install() and Validate() - put your validation into Validate() and return one or more PackageFragmentValidationResult is your validation fails. Let Install() simply return.

在包install.xml文件中注册新的 fragment installer类-在根元素内添加这样的部分:

Register your new 'fragment installer' class in the packages install.xml file - add a section like this inside the root element:

< mi:PackageFragmentInstallerBinaries> < mi:添加路径=〜/ MyAssembly.dll /> < / mi:PackageFragmentInstallerBinaries>

其中的路径指向将程序集添加到zip时的程序集。

where path points to your assembly as you added it to the zip.

在现有的< PackageFragmentInstallers /> 元素内,向继承自 BasePackageFragmentInstaller 使用< mi:Add installerType = MyFragmentInstallers.MyValidator,MyFragmentInstallers // >>

Inside the existing <PackageFragmentInstallers /> element, add calls to your class inheriting from BasePackageFragmentInstaller by using an element like <mi:Add installerType="MyFragmentInstallers.MyValidator, MyFragmentInstallers"/>

这样做将使Composite C1在软件包安装过程中调用Validate()方法,并在返回任何验证消息时提醒用户。

Doing this will make Composite C1 call your Validate() method as part of the package install, and alert the user if any validation messages are returned.

确定是否已安装软件包

如果您知道软件包的ID,您可以使用 Composite.Core.PackageSystem.PackageManager.IsInstalled(Guid packageId)检查它是否已安装。

If you know the ID of a package, you can check if it has been installed using Composite.Core.PackageSystem.PackageManager.IsInstalled(Guid packageId).

这篇关于软件包创建者-需要依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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