【问题标题】:Mixed targets in VSTS buildVSTS 构建中的混合目标
【发布时间】:2018-01-02 10:18:23
【问题描述】:

我们有一个aspnet-core 应用程序,它由几个.net standard 库、两个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 应用程序相同的文件夹结构,但似乎无法找到任何引用的包。

我们的代理队列是Hosted VS2017

我们有两个 VSTS 任务:RestoreBuild 来自 asp.net core 构建模板。

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

【问题讨论】:

  • 还原任务是 .net 核心还原任务还是“普通”NuGet 还原任务?
  • 它们是来自asp.net core 构建模板的dotnet core 任务。我们将尝试添加“正常”的 nuget 还原任务。您是否希望 dotnet core 构建任务与框架控制台应用程序一起使用?
  • 是的,它支持核心工具中不存在的 packages.config
  • 经典项目也使用visual studio构建
  • 你解决了这个问题吗?

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


【解决方案1】:

由于有通用的 .net framework 项目和 .net core 项目,并且您想将它们一起构建,您需要使用 Visual Studio Build task

因此,删除 .Net Core Restore.Net Core 构建任务 并添加 NuGet Tool Installer (4.3.0),Nuget restore 和 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)"

【讨论】:

    猜你喜欢
    • 2018-10-05
    • 2018-01-20
    • 2018-03-07
    • 2018-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    相关资源
    最近更新 更多