I’ve been hunting a missing dependency in my solution for almost two days. You’d think that should have been piece of cake – just go to the solution, and missing component, and that’s all you need to do. But, then, is it that simple?
Here is the story of one elusive relationship (all table names in this post have been adjusted to have a simple repro which is different from the original solution).
It all started like this:
(That’s nice how we can see solution import errors right away in the preview, isn’t it? No need to download anything)
Before I continue, let me clarify what’s in the solution.
There is a new “Contact Details” table, and there is new lookup column that’s been added to the out of the box Contact table. That lookup is referencing my new “Contact Details” table.
“Contact Details” are added to the solution with all subcomponents. For the contact table, I only have new lookup field added:
Although, looking at the Contact relationships, it seems that a corresponding relationship has also been added:
It’s exactly the relationship that gets listed under missing dependencies when I’m trying to import this solution to another environment.
Now keep in mind this is a stripped down version – I did not have it like this in the original solution. There were other tables, processes, etc. It took me a few hours of re-arranging solution components and looking at the xml files to arrive at the repro above, and, then, to finally figure out what went wrong.
And you know what the problem turned out to be? It’s the order in which those components are added to the solution.
The error happens when I do it this way:
- Add new custom table with all subcomponents first
- Then add Contact table and select new lookup column as the only subcomponent
I’m saying “the only subcomponent”, since, in this scenario, I can’t manually add relationship for that lookup to the Contact table. It does show up in the solution, but it’s not that I’m adding it intentionally:
Here, I’ just removed “Contact” table from the solution, and I’m trying to re-add it. I’ve already selected the lookup column, now I’m looking at the relationships, and I don’t see the one which would be missing on import (the name would start with ita_…):
Then let’s try doing it in the other order:
- Add Contact table, then choose lookup column, AND, also, choose that relationship from the list of subcomponents
- Then add “Contact Details” table with all subcomponents
Surprisingly, the relationship is showing up on the list:
And here is my updated solution:
Would you even know it’s been updated just by looking at it?
But, when importing this version, the outcome is quite different:
Now we are talking!
As usual in such cases, I’m not sure if this was intended behavior, or if this is a possible omission/bug. But, as long as we know how it works, we can avoid spending two more days next time playing hide and seek with those subcomponents
Hi Alex,
This is very useful. Thanks.
By any chance can you share the diff of the two solutions?
In my opinion, this is a bug that you could report to MS, as the order of adding things should not matter to the resultant solution.
Cheers