# 错误 NU1101: 无法找到包 'PackageName'。在源 nuget.org、local-cache 中不存在具有此 ID 的包。

- **ID:** `dotnet/nuget-package-restore-failure`
- **领域:** dotnet
- **类别:** build_error
- **错误码:** `NU1101`
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

NuGet 包还原在任何配置的包源中都找不到指定的包，可能是由于拼写错误、包缺失或源配置错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| dotnet 6.0 | active | — | — |
| dotnet 8.0 | active | — | — |
| NuGet 6.0 | active | — | — |
| NuGet 6.8 | active | — | — |

## 解决方案

1. ```
   Verify the package name and version in the .csproj file. Use dotnet list package --outdated to check available versions.
   ```
2. ```
   Add the correct NuGet source (e.g., private feed) using dotnet nuget add source. Example:
   ```
3. ```
   If the package is internal, build and pack it first, then reference the local .nupkg file. Example:
   ```

## 无效尝试

- **** — If the package doesn't exist in the source, clearing cache won't help; it just re-downloads the same error. (80% 失败率)
- **** — May introduce untrusted packages or malware; doesn't solve the missing package issue. (95% 失败率)
- **** — NuGet restore may still try to fetch from configured sources and ignore local files if not properly referenced. (70% 失败率)
