continuous-integration - VSTS 构建中的混合目标

标签 continuous-integration .net-core azure-devops .net-4.6

我们有一个 aspnet-core 应用程序,它由多个 .net 标准 库、两个 aspnet-core mvc 应用程序组成,并且,特别的是, .net Framework 控制台应用程序。

这些都成功构建,无论是在 Visual Studio 的解决方案中,还是单独使用 msbuild/dotnet build 命令。

我们现在正在尝试使用 VSTS 实现持续集成/构建。

我们发现 aspnet-core Web 应用程序构建成功,但 .net Framework 控制台应用程序失败并出现多个错误消息,如下所示:

2017-12-24T07:20:26.4090447Z C:\Program 
Files\dotnet\sdk\2.0.3\Microsoft.Common.CurrentVersion.targets(1988,5): 
warning MSB3245: Could not resolve this reference. Could not locate the 
assembly "Xxx.Core, Version=1.1.0.0, Culture=neutral, 
processorArchitecture=MSIL". Check to make sure the assembly exists on disk. 
If this reference is required by your code, you may get compilation errors. 
[d:\a\1\s\WinApps\ListBuilder\ListBuilder.csproj]
C:\Program Files\dotnet\sdk\2.0.3\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\WinApps\TelemListBuilder\TelemListBuilder.csproj]

控制台应用程序遵循与 Web 应用程序相同的文件夹结构,但似乎无法找到任何引用的包。

我们的代理队列是托管VS2017

我们有两个 VSTS 任务:从 asp.net core 构建模板进行RestoreBuild

如果有必要,如果我们可以从构建中排除控制台应用程序,我们会很高兴。

最佳答案

由于存在通用.net Framework项目和.net core项目,并且您希望将它们一起构建,因此您需要使用Visual Studio Build任务

因此,删除.Net Core Restore.Net Core构建任务并添加NuGet Tool Installer (4.3.0),< strong>Nuget 恢复 和 Visual Studio Build 任务(Visual Studio 版本:最新或 Visual Studio 2017)

如果要在构建过程中生成部署包,可以指定 MSBuild 参数,如下所示:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)"

关于continuous-integration - VSTS 构建中的混合目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48059129/

相关文章:

ssh - 使用 SSH 在 Azure Pipeline 中 checkout git 子模块

azure-devops - "az pipelines runs artifact download"失败,错误为 "Artifact was found, but is of type ' 容器 '"

jenkins - 如何配置 Jenkins 在 Slave 离线时发送通知电子邮件?

angular - 从 Angular 8 升级到 9 后出现构建错误

c# - 为什么 net core 2.0 中的垃圾收集器不释放所有内存

azure - 从本地连接到 Azure Redis 时出现 Dapr 超时问题

azure-devops - VSTS 发布管理 : filter by branch on artifact source

.net - 更新 .NET 项目引用(在配置文件中)

jenkins - Docker - 从一个链接容器向另一个容器发出命令

ruby-on-rails - Travis CI + ruby​​ on Rails 包安装