案例 1
找到重複的 『PrunePackageReference』 專案。 拿掉重複的專案,或使用Update功能來確保還原行為一致。 重複的 『PrunePackageReference』 專案包括:X 1.0.0、X 2.0.0。
問題
有時候,新增 PrunePackageReference 專案時,您最終可能會為特定套件新增專案多次。
MSBuild 專案通常會匯入多個 .props 和 .targets 檔案,因此重複專案可能不在相同的檔案中,但可能位於匯入的檔案中,例如 Directory.Build.props、Directory.Packages.props或 Directory.Build.targets。
.NET SDK 會提供清單 PrunePackageReference,因此發生衝突的原因可能是因為您已指定 PrunePackageReference 或因為 .NET SDK的錯誤所造成。
溶液
拿掉重複的專案,使其只包含一次。