Solved – corrupted index in a managed solution

In my last article, I mentioned that we got stuck with a corrupted index in a managed solution. The reason the index became corrupted was that the width of the index we defined was exceeding the maximum with of an index within SQL Server. The hard lesson we learned that we should create small keys in which the size of all fields do not exceed 900 bytes (link).

On the development server we could repair the situation by dropping the keys we defined. On the target environments on which we deployed the solution the faulty key could not be deleted. In fact we were not able to update the managed solution. We got stuck.

We requested Microsoft to alter the created indexes, making the keys smaller. After a couple of requests (one request per environment) the indexes were made smaller (in case of an on premise environment we would have done the index repair ourselves). The environments were ready to be fixed…


From there on, we did the following steps per environment to get rid of the indexes in the managed solutions.

  1. Alter the solution on the development environment, by removing the keys we defined.
  2. Make a managed export of the altered solution.
  3. Copy the exported managed solution and rename it.
  4. Open the renamed solution file, and alter the unique name of the solution in the solution.xml.
  5. Import the altered and renamed solution in the target environment.
  6. Drop the orginal solution from the target environment.
  7. Import the managed solution (created in step 2).
  8. Drop the altered and renamed soluton in the target environment.

This looks like a large number of steps. In fact it is. But it is the only way we could drop the corrupted index on the target environment, preserving all data!

The trick is by installing the renamed solution (step 5) we preserved the data (same published). By uninstalling the original solution, we dropped all modifications made by that solution (including the corrupted index). Because the renamed solution contains the same entities, the data is kept in the new entities 🙂

Repeating the action by installing the altered solition (step 2) over the solution made in step 5, the data will be preserved in the entities defined in the altered solution. By removing the renamed solution, the system reverts back in the state where it should be.

Case closed!