Azure DevOps 构建中的错误 - 您是否缺少程序集参考? [英] Errors in Azure DevOps build - are you missing an assembly reference?

查看:21
本文介绍了Azure DevOps 构建中的错误 - 您是否缺少程序集参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用 VSTS (Azure DevOps) 并且正在设置我的第一个构建(我之前一直在使用 TFS).我正在尝试构建一个面向 .NET Framework 4.6 的 .NET 应用程序.

I am using VSTS (Azure DevOps) for the first time and am setting up my first build (I have previously been using TFS). I'm trying to build a .NET application targeting .NET Framework 4.6.

但是,我遇到了与缺少命名空间和/或程序集相关的构建错误.

However I'm getting build errors relating to missing namespaces and / or assemblies.

错误 CS0246:找不到类型或命名空间名称OwinStartupAttribute"(您是否缺少 using 指令或程序集引用?)

错误 CS0234:命名空间System.Web"中不存在类型或命名空间名称Http"(您是否缺少程序集引用?)

错误 CS0234:命名空间Microsoft"中不存在类型或命名空间名称Azure"(您是否缺少程序集引用?)

这些问题似乎都是相关的,即 nuget 包在构建过程中没有得到恢复.

The issues all seem to be related i.e. the nuget packages aren't getting restored during the build process.

因此,我在构建步骤之前向管道添加了一个 Nuget restore 任务.

I've therefore added a Nuget restore task to the pipeline before my build step.

并在构建步骤中选中了恢复 Nuget 包选项.

And have checked the option Restore Nuget packages on the build step.

推荐答案

我有一些项目在解决这个问题的大型解决方案;他们有旧的packages.config"文件.要修复,在解决方案资源管理器中,右键单击 packages.config 文件并选择将 packages.config 迁移到 PackageReference.

I had some projects in a large solution with this problem; they had the old "packages.config" files. To fix, In Solution Explorer, right-click on a packages.config file and select Migrate packages.config to PackageReference.

文档.

这篇关于Azure DevOps 构建中的错误 - 您是否缺少程序集参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆