簡體   English   中英

Azure Devops 找不到恢復的 nuget 包

[英]Azure Devops not finding restored nuget packages

我為 C# 項目創建了一個構建管道。

我引用了不同的 nuget 包,如實體框架和位於提要中的一些自己的包。

本地整個解決方案正在構建和運行,沒有問題。

同樣在構建管道中,nuget restore 正在運行。 但是構建失敗,因為它找不到 nuget 包。

這發生在像實體框架這樣的公共包上,也發生在我腳下的包上。

nuget 版本:

  • 檢測到 NuGet 版本 4.1.0.2450 / 4.1.0

我嘗試了構建版本、構建代理或創建了自己的 nuget.config 文件。

我還卸載了 nuget 包,刪除了所有引用並重新安裝了每個包

例如:

##[error]paybla.Repository.EntityFramework\RepositoryBase.cs(3,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
RepositoryBase.cs(3,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(3,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
UnitOfWorkBase.cs(3,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(4,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
UnitOfWorkBase.cs(4,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(5,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
UnitOfWorkBase.cs(5,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(6,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
UnitOfWorkBase.cs(6,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\RepositoryBase.cs(11,26): Error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
RepositoryBase.cs(11,26): error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(15,26): Error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
UnitOfWorkBase.cs(15,26): error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
##[error]paybla.Repository.EntityFramework\UnitOfWorkBase.cs(157,19): Error CS0246: The type or namespace name 'IDbSet<>' could not be found (are you missing a using directive or an assembly reference?)
UnitOfWorkBase.cs(157,19): error CS0246: The type or namespace name 'IDbSet<>' could not be found (are you missing a using directive or an assembly reference?) [d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj]
Done Building Project "d:\a\3\s\paybla.Repository.EntityFramework\paybla.Repository.EntityFramework.csproj" (default targets) -- FAILED.

請嘗試檢查您是否已將 \\packages 文件夾添加到源代碼管理中,如果是,您可以從源代碼管理中刪除整個包文件夾,看看它是否可以解決問題。

可能與您的情況無關,但有時(特別是當允許 R# 引用丟失的包時)csproj 文件可能包含對本地驅動器上程序集的引用 - 像這樣

<ItemGroup>
  <Reference Include="name">
    <HintPath>../../your/local/path</HintPath>
  </Reference>
</ItemGroup>

刪除所有這些節點並通過 nuget ui 手動添加包在我的情況下有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM