为 ASP.NET Core Devextreme 项目设置 VSTS 持续集成 (CI)

Setup VSTS Continuous Integration (CI) for ASP.NET Core Devextreme project

我尝试在 VSTS 中为使用 Devextreme 开发的 ASP.NET 核心项目设置持续集成 (CI)。

我检查了项目中的 NuGet.config 文件,devextreme-controls-netcore 似乎是从本地机器引用的。

NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="devextreme-controls-netcore" value="C:\Program Files (x86)\DevExpress 17.1\DevExtreme\System\DevExtreme\Bin\AspNetCore" />
  </packageSources>
</configuration>

我已经在 VSTS 中为这个项目创建了一个构建定义并排队了一个构建。我在恢复包时遇到错误。

来自 VS 的日志文件:

2017-11-17T11:26:33.0089440Z ##[section]Starting: Restore
2017-11-17T11:26:33.0279221Z ==============================================================================
2017-11-17T11:26:33.0279221Z Task         : .NET Core
2017-11-17T11:26:33.0279221Z Description  : Build, test and publish using dotnet core command-line.
2017-11-17T11:26:33.0279221Z Version      : 1.0.2
2017-11-17T11:26:33.0279221Z Author       : Microsoft Corporation
2017-11-17T11:26:33.0279221Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2017-11-17T11:26:33.0279221Z ==============================================================================
2017-11-17T11:26:34.6038344Z [command]"C:\Program Files\dotnet\dotnet.exe" restore d:\a\s\DevExtremeAspNetCoreApp\DevExtremeAspNetCoreApp.csproj
2017-11-17T11:26:42.2434595Z   Restoring packages for d:\a\s\DevExtremeAspNetCoreApp\DevExtremeAspNetCoreApp.csproj...
2017-11-17T11:26:42.2434595Z   Restoring packages for d:\a\s\DevExtremeAspNetCoreApp\DevExtremeAspNetCoreApp.csproj...
2017-11-17T11:26:42.2434595Z C:\Program Files\dotnet\sdk.0.2\NuGet.targets(102,5): **error : The local source 'C:\Program Files (x86)\DevExpress 17.1\DevExtreme\System\DevExtreme\Bin\AspNetCore' doesn't exist.** [d:\a\s\DevExtremeAspNetCoreApp\DevExtremeAspNetCoreApp.csproj]
2017-11-17T11:26:42.6496133Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2017-11-17T11:26:42.6496133Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\s\DevExtremeAspNetCoreApp\DevExtremeAspNetCoreApp.csproj
2017-11-17T11:26:42.6536144Z ##[section]Finishing: Restore

如何构建 devextreme-controls-netcore 是 VSTS 以设置 CI。

请提出解决此问题的解决方案。

您正在引用本地路径 (C:\Program Files (x86)\DevExpress 17.1\DevExtreme\System\DevExtreme\Bin\AspNetCore)。如果您的构建代理上不存在该路径,构建将失败。

最好的解决方案是在 VSTS 中设置一个包提要,将您的包上传到该提要,然后更新您的项目以从私有包提要中提取包。

首先,基于此线程:DevExtreme.AspNet.Core is not available in NuGet repository,核心包发布在他们的私有 NuGet 存储库 (https://nuget.devexpress.com/{feed-authorization-key}/api) 上,因此您可以从该私有 NuGet 存储库检索包,如果您有授权密钥。

其次,您可以将相关包(在C:\Program Files (x86)\DevExpress 17.1\DevExtreme\System\DevExtreme\Bin\AspNetCore中)添加到源代码管理中,然后将其映射到构建代理(Get source)并更改NuGet.config中的值。

另一种方法是如丹尼尔所说,将其上传到您的 VSTS 包提要。

我创建了一个 nuget.config 并在 VSTS 构建步骤 "nuget restore" 中选择了它。 示例:

<configuration>
          <packageRestore>
            <add key="enabled" value="True" />
            <add key="automatic" value="True" />
          </packageRestore>
          <activePackageSource>
            <add key="All" value="(Aggregate source)" />
          </activePackageSource>
          <packageSources>
            <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
            <add key="DevExpress package source" value="https://nuget.devexpress.com/{yourKeyHere}/api" />
          </packageSources>
        </configuration>