繁体   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