We can get the Dynamics 365 CE components by exporting the solutions. This solution is a compressed folder that contains multiple common XML and other files. The storing of this solution folder or files in the source repository is not much help as these XML files include all the entities/customization in a common file.
These files can be helpful to view the changes/updates in each entity/component and store each entity/component in a separate file instead of putting in a common single file while storing in source control.
So, Microsoft provided a tool “SolutionPackager” that can reversibly decompose a Dataverse compressed solution file into multiple XML files and other files. So that these files can be easily managed by a source control system. The SolutionPackager tool can be used with any source control system. After a solution .zip file has been extracted to a folder, simply add and submit the files to your source control system. These files can then be synchronized on another computer where they can be packed into a new identical solution .zip file.
Here we can follow the below steps to create/store/modify the Dynamics 365 components in a source control system (eg. Azure DevOps Repos).
A. Create a solution
The following procedure identifies the typical steps used when first creating a solution and adding to a source repository.
1. In an organization, create a solution and then add or create components as necessary.
2. When you are ready to check in, export the unmanaged solution.
The format of a compressed solution file will be different based on its type, either managed or unmanaged. The SolutionPackager can process compressed solution files of either type. However, the tool can’t convert one type to another.
3. Install the SolutionPackager tool –it is included in “Microsoft.CrmSdk.CoreTools” NuGet package (Steps to download tools).
4. Using the SolutionPackager tool, extract the solution into component files.
a) In the project, using the package manager console, go to the folder where solutionPackager tools exe file exists.
b) Run SolutionPackager.exe command with the following arguments:
Command structure to extract the solution:
.\SolutionPackager.exe /action:Extract /zipfile:”solutionzip” /folder “extractedFilefolder”
solutionzip: Required. The path and name of a solution .zip file. When extracting, the file must exist and will be read from. When packing, the file is replaced.
extractedFilefolder: Required. The path to a folder. When extracting, this folder is created and populated with component files.
e.g. Command for Extract
5. From those extracted component files, add the necessary files to source control.
6. Submit these changes to source control. For the first time, you need to create the needed folders in DevOps Repos (as in extracted folders) and add extracted files into these folders.
B. Modify a solution
The following procedure identifies the typical steps used when modifying an existing solution.
1. Synchronize or get the latest solution component file sources.
2. Using the SolutionPackager tool, pack component files into an unmanaged solution .zip file.
Command structure to pack component files:
.\SolutionPackager.exe /action:Pack/zipfile:”solutionzip” /folder “extractedFilefolder”
solutionzip: Required. The path and name of a solution .zip file. When packing, the file will be either created or updated.
extractedFilefolder: Required. The path to a folder. When packing, this folder must already exist. It can contain previously extracted component files.
e.g. Command for Pack
3. Import the unmanaged solution file (created in the above step) into an organization.
4. Customize and edit the solution as necessary.
5. When you are ready to check the changes into source control, do the following.
a) Export the unmanaged solution.
b) Using the SolutionPackager tool, extract the exported solution into component files.
c) Synchronize or get the latest sources from source control.
d) Reconcile if any conflicts exist.
e) Submit the changes to source control.
Steps 2 and 3 must be done before further customizations occur in the development organization. Within step 5, step b must be completed before step c.
Once you managed solutions file in source control, you will be able to utilize features of DevOps, as extracted files are user friendly. You can view in below screenshot, we can compare/view the history of components.
You can refer to the below links for more details –
The “SolutionPackager” tool reversibly decompose a Dataverse compressed solution file into multiple XML files and other files so that these files can be easily managed by any source control system.