WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
117 stars 56 forks source link

MSCRM Pack Solution - Not able to package as Managed or Both. #90

Closed MustaqueEhiya closed 5 years ago

MustaqueEhiya commented 5 years ago

Hi,

I am trying to use the CRM pack solution to package the XML files. Unmanaged option is working fine, but other options - (Managed and Both) throw the below errors.

Please let me know how to fix the below: log_7_50.zip

Packing D:\a\2\s\ADO_Src\MMA.Solution\MustaqueSolution\MustaqueSolution to D:\a\2\s\ADO_Src\MMA.Solution\MustaqueSolution.zip and D:\a\2\s\ADO_Src\MMA.Solution\MustaqueSolution_managed.zip

Solution package type did not match requested type. Command line argument: Unmanaged Package type: Both SolutionPackager: Exception thrown: System.ArgumentException: Solution package type did not match requested type. Command line argument: Unmanaged Package type: Both at Microsoft.Crm.Tools.SolutionPackager.Helper.LoadSolutionInformation(Stream solutionXml, Context context) at Microsoft.Crm.Tools.SolutionPackager.DiskReader.Load() at Microsoft.Crm.Tools.SolutionPackager.SolutionPackager.Run(IPackageReader reader, IPackageWriter writer) at Microsoft.Crm.Tools.SolutionPackager.SolutionPackager.Run() at Microsoft.Crm.Tools.SolutionPackager.Program.Main(String[] args), returning error code '1' CrmSvcUtil Runtime = 00:00:01.2889593 SolutionPackager exit code: 1

[error]Packing Solution failed. Check logs for more information

[section]Finishing: MSCRM Pack Solution - Managed

MustaqueEhiya commented 5 years ago

I tried to package the Extracted folder using solutionpackager tool and it also threw similar error.

Packing C:\Users\MEHIYA\source\Workspaces\PLR\ADO_Src\MMA.Solution\MustaqueSolution\MustaqueSolution to C:\Users\MEHIYA\source\Workspaces\PLR\ADO_Src\MMA.Solution\MustaqueSolution\ADOOutput\MustaqueSolution2.zip

Solution package type did not match requested type. Command line argument: Unmanaged Package type: Managed CrmSvcUtil Runtime = 00:00:00.1025690

Below is the script I tried: .\SolutionPackager.exe /action:Pack /packagetype:Managed /folder:"C:\Users\MEHIYA\source\Workspaces\PLR\ADO_Src\MMA.Solution\MustaqueSolution\MustaqueSolution" /zipfile:"C:\Users\MEHIYA\source\Workspaces\PLR\ADO_Src\MMA.Solution\MustaqueSolution\ADOOutput\MustaqueSolution_Managed.zip" /errorlevel:verbose

RonnyVDS commented 5 years ago

Are you trying to convert a unmanaged to managed solution? Because the Solution Package can't do this.

MustaqueEhiya commented 5 years ago

@RonnyVDS - The solution in Dev environment is a unmanaged solution. I exported and extracted the XML files and checked into Source Control.

  1. Using the solutionpackager, I packed the extracted XML files into unmanaged solution and deployed in Test.
  2. Once it is qualified, I am using the solutionpackager to pack the XML files from Source control again to a Managed solution to install in my UAT environment. During this process, I am getting the error.
MustaqueEhiya commented 5 years ago

Hi All,

I was going through the MS docs and it says

" The only way to convert solution files to a different type, for example from unmanaged to managed, is by importing the unmanaged solution .zip file into a Microsoft Dynamics 365 server and then exporting the solution as a managed solution."

In that case, I would like to understand the purpose of the SolutionPackager commandline parameter "/packagetype: {Unmanaged|Managed|Both}" when I use the "/action:Pack".

MS Doc states: "When packing and Both is specified, managed and unmanaged solution .zip files will be produced from one folder. "

Thanks.

RonnyVDS commented 5 years ago

I think those options only work when exporting from a environment. Where the source is a Dynamics environment , not when the source are the already created XML files. (or directory in this case)

WaelHamze commented 5 years ago

@MustaqueEhiya I think you need to export both managed and unmanaged from CRM instance and use both to Unpack

Then you have the flexibility to use whichever one you want when you pack and deploy.

cathalnoonan commented 4 years ago

@MustaqueEhiya

Can you try putting "Both" inside the <Managed> node of the unpacked solution.xml file

It will look like this

image

I had a similar problem when using the solution packager in the command line, and this fixed the errors

wajihqidwai commented 4 years ago

@MustaqueEhiya

Can you try putting "Both" inside the <Managed> node of the unpacked solution.xml file

It will look like this

image

I had a similar problem when using the solution packager in the command line, and this fixed the errors

very helpful

JohnYu500 commented 3 years ago

@MustaqueEhiya

Can you try putting "Both" inside the <Managed> node of the unpacked solution.xml file

It will look like this

image

I had a similar problem when using the solution packager in the command line, and this fixed the errors

This worked! Thank you!