简体   繁体   English

Dynamics CRM / Dynamics 365以编程方式应用解决方案升级

[英]Dynamics CRM/Dynamics 365 Apply solution upgrade programmatically

There is a set of rules that should be applied while moving solutions from one instance to another, so there is an idea to use a custom tool that will make all changes, export and import solutions to another instance. 在将解决方案从一个实例移动到另一个实例时,应遵循一组规则,因此有一个想法是使用自定义工具,该工具将进行所有更改,将解决方案导出和导入到另一个实例。 The question is next: 接下来的问题是:

How could "solution upgrade applying" be implemented with C#? 如何使用C#实施“应用解决方案升级”?

Importing "as holding" easily could be done by setting (CRM 2016 SDK) 可以通过设置轻松导入“保留”(CRM 2016 SDK)

 var import = new ImportSolutionRequest();
 import.HoldingSolution = true;

this allows to have a holding solution in a target environment, but after some tests we still can't "Apply" this upgrade for the previously installed solution. 这样就可以在目标环境中拥有一个保持解决方案,但是经过一些测试,我们仍然无法对先前安装的解决方案“应用”此升级。

Thank you in advance. 先感谢您。

After you have imported the holding solution you can upgrade it using a DeleteAndPromoteRequest . 导入保留解决方案后,可以使用DeleteAndPromoteRequest对其进行升级。

A basic example: 一个基本的例子:

public Guid UpgradeSolution(string solutionUniqueName, IOrganizationService service)
{
    var request = new DeleteAndPromoteRequest
    {
        UniqueName = solutionUniqueName
    };

    var response = (DeleteAndPromoteResponse)service.Execute(request);
    return response.SolutionId;
}

In the DeleteAndPromoteResponse the SolutionId property holds the Guid of the promoted solution. DeleteAndPromoteResponseSolutionId属性包含升级解决方案的Guid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM