导入包含 Hierarchical=Yes 关系的解决方案时出错:索引或统计信息已存在

Error when importing solution containing relationship with Hierarchical=Yes: Index or statistics already exists

我无法导入包含设置为 Hierarchical=Yes 的关系的解决方案。如果我将关系更改为 Hierarchical=No 导入工作正常。

将仅包含在自定义关系上设置了 Hierarchical=Yes 的 Contact 实体的非托管解决方案导入目标环境时会出现此问题。日志中没有显示任何错误。

进一步的调试表明,在受影响的目标环境中无法将相同的关系更改为 Hierarchical=Yes,因为它失败了:

A SQL Server error occurred

服务器上的跟踪显示:

The operation failed because an index or statistics with name 'ndx_for_cascaderelationship_publisher_relationshipname' already exists on table 'ContactBase'.

我可以确认该索引确实已经存在于 table 中。我们自己没有在数据库中创建任何索引。

您可以通过以下方式解决此问题:

  1. 将受影响的关系设置为 可以在源环境中自定义:False(不要问 - Microsoft 以神秘的方式工作...)。
  2. 正在将解决方案导入目标环境。

即使您部署的是非托管解决方案,这仍然有效。