gpt4 book ai didi

msbuild - 当 net461 引用 netstandard2.0 时,VSTS 在 Visual Studio Build 中失败

转载 作者:行者123 更新时间:2023-12-02 01:07:03 24 4
gpt4 key购买 nike

我们正在将库项目从 net461 迁移到 netstandard2.0。一些库尚不支持 .NET Standard,因此托管应用程序正在运行 net461 并引用我们使用 netstandard2.0 的库。

这与 Visual Studio 15.3 在本地完美运行,一切都在其中运行和构建。

根据微软documentation带有 SDK 2.0 的 .NET Standard 实现了 4.6.1,我认为这就是它在本地工作的原因。

.NET Standard support

在 Visual Studio Online (VSTS) 中运行构建失败并出现多个错误,例如:

Package Microsoft.AspNetCore.Mvc 2.0.0 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package Microsoft.AspNetCore.Mvc 2.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)

我阅读了 github 上的讨论 herehere谈论类似问题是工具问题并添加了 .NET
Core Tool Installer
构建安装 Core 2.0 的任务,但仍然没有成功。

我需要做什么才能在 VSTS 中运行构建?

更新:

(将标题更改为 Visual Studio Build 而不是 MS Build)

找到这个线程 https://github.com/dotnet/standard/issues/454谈论需要更新的 VSTS。

我正在运行 VS Enterprise 15.4.1,VSTS Build is running version 15.3.5 today根据 github 上的问题,这就足够了。这更令人困惑。

最佳答案

通过使用 dotnet restoredotnet build 版本 2.*(预览版) 找到了解决方法,效果很好。

不使用 MS Build 或 Visual Studio 2017 构建,只需将构建任务替换为以下 dotnet 任务即可。

(如果您没有任何私有(private)提要,您甚至不需要 dotnet restore 命令,因为 dotnet build 会为您恢复包)。

长话短说;改用这个:

Working build tasks

关于msbuild - 当 net461 引用 netstandard2.0 时,VSTS 在 Visual Studio Build 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47072128/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com