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
115 stars 54 forks source link

Copy Solution Components not transferring all components #219

Open wnbittle opened 3 years ago

wnbittle commented 3 years ago

Has anyone else experienced the case where not all components are copied from the source solution to the target? We're having this issue in one environment but not another. No errors or warnings emitted, just some fields missing for example.

wnbittle commented 3 years ago

Small update on this issue:

Scenario: We have a solution and a patch for that solution in the same environment We want to copy all components from both the parent solution and the patch to another solution

Problem: Not all components are copied, namely entity related components

Investigation: It appears that this only happens for entities and only happens when the same entity is in both the solution and the patch. What I believe is happening is that when it attempts to copy the components from the first solution, everything is fine. But when it copies the components from the second solution, it sees that the entity already exists in the solution and moves on - not realizing that the subcomponents of the entity could be different.

WaelHamze commented 3 years ago

@wnbittle what is the state of the entity in the source and target solution? (i.e. full versus sub components) for your scenario?

wnbittle commented 3 years ago

@WaelHamze both solutions contain the entity with only certain sub components added (i.e full in neither). So imagine solution A contains Account with only new_field1 and solution B contains Account with only new_field2.

wnbittle commented 3 years ago

@WaelHamze We've been doing more testing and we think you may be correct about the 'Include all components' setting. We recently had the following scenario:

  1. Entity A in main solution
  2. Entity A NOT in patch solution
  3. After copying the main solution - not all components of Entity A were copied
  4. It appears that entity A has the 'Include all components' setting checked

The only thing I can think of is that at one point the solution contained the entity with only what was needed. Later, someone came back in and checked the "Include all components" checkbox. This puts the entity in a state where copying the components only copies what was originally included?

wnbittle commented 3 years ago

@WaelHamze sorry for the spam - more updates on this. We're pretty confident it's the "Include all components" setting now. Every entity that has this checked is having issues with copying. Some copy 6 fields, some copy 0 fields, and so on. We wrote a custom tool using the AddSolutionComponentRequest SDK message and have the same result.

We're going to try to detect the "Include all components" DoNotIncludeSubcomponents flag and set it during the request in our custom solution to see if that solves our problem.

WaelHamze commented 3 years ago

@wnbittle that for sharing. Let me know how it does perhaps we can make some changes to the task if needed.

Out of interest, in what scenario do you use the copy components task?

wnbittle commented 3 years ago

@WaelHamze np. Update - it's definitely the "Include all components" setting that's the problem. In our custom solution we set this flag on the entity when we copy the component over if it's set in the source solution which fixed our problem.

Our scenario is automatic dependency checking. We have a solution segmentation strategy that splits our components between many solutions (in this case by component type). We're also using patches for development, then rolling them up before deployment. To avoid missing dependencies, which halt the deployment and force us to re-export and re-build solutions, we copy all components from the solutions and their patches into a single temporary solution, export it, then run the Missing Solution Components task on the solution. This outputs a nice JSON report of what components may be missing that we pass on to the dev team.