From e7df4793b2d6c17c22d8f457919f8f48a5df5683 Mon Sep 17 00:00:00 2001 From: Marcos Rocha Date: Tue, 13 Oct 2020 18:22:09 -0300 Subject: [PATCH] add webresource to solution --- .../SetXrmWebResourcesFromFolder.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/SetXrmWebResourcesFromFolder.cs b/MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/SetXrmWebResourcesFromFolder.cs index c75c864a..fc0c180e 100644 --- a/MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/SetXrmWebResourcesFromFolder.cs +++ b/MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/SetXrmWebResourcesFromFolder.cs @@ -1,4 +1,5 @@ using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk.Messages; using System; using System.Collections.Generic; using System.IO; @@ -126,7 +127,17 @@ where sol.SolutionId.Equals(solutionId) if (webResource.Content?.GetHashCode() != fileContent.GetHashCode()) { webResource.Content = fileContent; - context.UpdateObject(webResource); + //context.UpdateObject(webResource); + + // update web resource then add to a solution. + UpdateRequest update = new UpdateRequest + { + Target = webResource + }; + update.Parameters.Add("SolutionUniqueName", SolutionName); + + context.Execute(update); + // add id to publish xml if (Publish) importexportxml.Append($"{webResource.Id}");