Dynamics 365 solution error - Components are missing, import the managed solution with these Components (Active)!

Importing managed solution is more of an art than a science #HoskWisdom

Sometimes importing a managed solution without getting an unhelpful dependency error can feel like skiing down a black run blindfolded, on one leg and with the sun in your eyes. Even though I have experienced different errors whilst, there is always a new one to baffle me.

You can get error exporting solutions — Dynamics 365 — Error when exporting a solution

There is definitely a full time role on the Dynamics 365 team to come up with new and interesting errors and create cryptic error messages which don’t help identify what the problem is.

Solution import error

I was importing a managed solution on a new environment. I have installed the Microsoft solutions and other managed 3rd party solution that my custom managed solution depends on.

Then this error pops up

“The import of the solution HoskSolutionName failed. The following components are missing in your system and are not included in the solution. Import the managed solutions that contains these components (Active) and then try importing this solution again.”

Microsoft then gives me a url to a different error — Import of solution fails due to missing components

Frustratingly there was no log file or any other details. The screen then shows half of the entities saying those components are missing. Yes I know they are missing I am trying to import them.

The error message is saying I can’t import those entities because the solution depends on those entities.

So Microsoft are saying, somewhere in the 40 entities of your solution, there is a dependency issue. It’s like your child losing your car keys on the beach and saying it’s somewhere in the sand.

Remove dependencies

As this was a fresh instance and I know Microsoft back up the Dynamics 365 instance every hour for the last week, I edit the solution file.

If you remove the dependencies from a solution file, you can import it and the import will error and tell you what the problem is (e.g. if you are missing some dependencies)

I then get this error

Failed to create entity with logical name new_entityname and object type code -1. Exception:
Microsoft.Crm.CrmException: Entity Display Collection Name for id: d31c2b64-b6f8–4f64–9962-b019dcb596fe, objectcolumn:
LocalizedCollectionName and labelTypeCode: Entity not specified at Microsoft.Crm.Metadata.LocalizedLabelHelper.ValidateLabelCollectionContents(LabelCollection labelCollection, Guid objectId, String objectColumnName, LabelTypeCode labelTypeCode, String parameterName, ISqlExecutionContext context, Boolean throwIfCollectionIsNullOrEmpty) at Microsoft.Crm.Metadata.EntityService.ValidateEntityNameAndLabels(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ISqlExecutionContext sqlContext) at Microsoft.Crm.Metadata.EntityService.ValidateForCreate(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ExecutionContext context) at Microsoft.Crm.Metadata.EntityService.<>c__DisplayClass75_0.<CreateInternal>b__0() at Microsoft.Crm.SqlTelemetryHelper.LogSqlTimes(Action action, String operationName) at Microsoft.Crm.Metadata.EntityService.CreateInternal(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ExecutionContext context) at Microsoft.Crm.Metadata.EntityService.<>c__DisplayClass27_1.<CreateInternalHelper>b__3() at Microsoft.Crm.SqlTelemetryHelper.LogSqlTimes(Action action, String operationName) at Microsoft.Crm.Metadata.EntityService.CreateInternalHelper(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ExecutionContext context)

Another error I have never seen and have no idea what it means (the entity isn’t really called new_entityname :-))

I went to the entity to see if it would give me any clues. What I found was the include metadata checkbox was not checked (Dynamics 365 — What does Include entity metadata do?). So maybe this error is complaining there is no metadata.

I add tick the metadata flag, ALM the process and create a new managed solution. I try importing this with the dependencies in place and it fails.

I take off the dependencies and then 40 minutes later it has successfully imported, leaving me totally confused why Dynamics 365 was complaining.

I am worried that there is something not right. I bump up the version and import again. This time the standard import is working until 20 minutes and then it throws a dependency error for some missing relationships.

I add the relationships and try again. This time it works. If the first error had given me some information I could have resolved the problems in an hour, instead of 5 hours.

I delete the managed solution and the import my new managed solution and it works after fixing my dependencies issues.

To take my frustration to comic levels, Dynamics decided to log me out of all 20 of my tabs!!!

Conclusion

Don’t let solution errors beat you. You need to push past the obscure errors Dynamics 365 throws up and look in the errors that are causing the problem (Dynamics 365 error messages point you in the right direction). There is usually a reason for solution errors, it takes time to find them.

The most effective way to avoid dependency errors is to have a ALM/Devops process (Dynamics 365 and ALM/DevOps Information to get you started) in place and release often, this way you find the problems in a small changeset, which is quicker and easier. It stops you wasting your life doing a manual task which you can automate

picture from here