简体   繁体   English

Azure Devops 找不到恢复的 nuget 包

[英]Azure Devops not finding restored nuget packages

I created a build pipeline for a C# project.我为 C# 项目创建了一个构建管道。

I referenced different nuget packages like Entity Framework and some own packages that are located in a feed.我引用了不同的 nuget 包,如实体框架和位于提要中的一些自己的包。

Local the whole solution is building and running without problems.本地整个解决方案正在构建和运行,没有问题。

Also in the build pipeline the nuget restore is working.同样在构建管道中,nuget restore 正在运行。 But the build is failing because it cant find the nuget packages.但是构建失败,因为它找不到 nuget 包。

This is happening with public packages like Entity Framework and also with the packages from my feet.这发生在像实体框架这样的公共包上,也发生在我脚下的包上。

The nuget Version: nuget 版本:

  • Detected NuGet version 4.1.0.2450 / 4.1.0检测到 NuGet 版本 4.1.0.2450 / 4.1.0

I played around with build versions, build agents or created my own nuget.config file.我尝试了构建版本、构建代理或创建了自己的 nuget.config 文件。

I also uninstalled nuget package, removed all references and reinstalled every package我还卸载了 nuget 包,删除了所有引用并重新安装了每个包

For example:例如:

##[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 文件夹添加到源代码管理中,如果是,您可以从源代码管理中删除整个包文件夹,看看它是否可以解决问题。

Possibly unrelated to your case, but sometimes (in particular, when allowing R# to reference missing package) csproj file may contain reference to assembly on local drive - something like this可能与您的情况无关,但有时(特别是当允许 R# 引用丢失的包时)csproj 文件可能包含对本地驱动器上程序集的引用 - 像这样

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

Removing all such nodes and manually adding packages via nuget ui helped in my case删除所有这些节点并通过 nuget ui 手动添加包在我的情况下有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM