{
  "id": "dotnet/nuget-package-version-conflict",
  "signature": "error NU1107: Version conflict detected for 'PackageA'. Reference packages: PackageB 2.0.0 -> PackageA (>= 1.5.0), PackageC 3.0.0 -> PackageA (>= 2.0.0).",
  "signature_zh": "错误 NU1107: 检测到 'PackageA' 的版本冲突。引用包: PackageB 2.0.0 -> PackageA (>= 1.5.0), PackageC 3.0.0 -> PackageA (>= 2.0.0)。",
  "regex": "error NU1107: Version conflict detected for '.*'\\.",
  "domain": "dotnet",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "NuGet package version conflict occurs when different packages in the dependency graph require incompatible versions of the same package, causing the build to fail.",
  "root_cause_type": "generic",
  "root_cause_zh": "NuGet 包版本冲突发生在依赖关系图中不同包要求相同包的不兼容版本时，导致构建失败。",
  "versions": [
    {
      "version": "5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Manually editing the .csproj file to force a specific version of PackageA without considering transitive dependencies",
      "why_fails": "Forcing a version may break other packages that depend on a different version, leading to runtime errors or further conflicts.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing one of the conflicting packages entirely from the project",
      "why_fails": "Removing a package may remove required functionality, causing build errors or missing method exceptions.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Running 'dotnet restore --force' without resolving the version mismatch",
      "why_fails": "Restore only re-downloads packages; it does not resolve version conflicts unless package versions are explicitly aligned.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a binding redirect or use a PackageReference with a specific version in the project file. Example: <PackageReference Include=\"PackageA\" Version=\"2.0.0\" /> and ensure all dependent packages are updated to compatible versions.",
      "success_rate": 0.9,
      "how": "Add a binding redirect or use a PackageReference with a specific version in the project file. Example: <PackageReference Include=\"PackageA\" Version=\"2.0.0\" /> and ensure all dependent packages are updated to compatible versions.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the 'dotnet nuget why' command to analyze the dependency tree. Example: dotnet nuget why PackageA",
      "success_rate": 0.75,
      "how": "Use the 'dotnet nuget why' command to analyze the dependency tree. Example: dotnet nuget why PackageA",
      "condition": "",
      "sources": []
    },
    {
      "action": "Update all packages to their latest compatible versions using: dotnet list package --outdated then dotnet update package",
      "success_rate": 0.85,
      "how": "Update all packages to their latest compatible versions using: dotnet list package --outdated then dotnet update package",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在项目文件中添加绑定重定向或使用特定版本的 PackageReference。示例：<PackageReference Include=\"PackageA\" Version=\"2.0.0\" /> 并确保所有依赖包更新到兼容版本。",
    "使用 'dotnet nuget why' 命令分析依赖树。示例：dotnet nuget why PackageA",
    "将所有包更新到最新的兼容版本：dotnet list package --outdated 然后 dotnet update package"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1107",
  "official_doc_section": null,
  "error_code": "NU1107",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}