Azure CI 使用备用 nuget 提要

Azure CI using alternative nuget feed

我正在尝试让 Azure 检查包的替代 nuget 源以及默认源。

我已将我的 CI 配置为在我签入源代码管理时自动部署到 azure webapp。

我的解决方案使用了一些 nuget 包,这些包目前仅在 Azure 的夜间订阅源上提供。我更改了我的 nuget.targets 文件,如下所示,以包含 nightlies 提要和默认的 nuget 提要。

<ItemGroup Condition=" '$(PackageSources)' == '' ">
    <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
    <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
    <PackageSource Include="http://www.myget.org/F/azure-appservice/api/v2/" />
    <PackageSource Include="https://api.nuget.org/v3/index.json" />
</ItemGroup>

然而,当我签入失败时,查看 Azure 中的 Activity 日志,我可以看到它找不到夜间包裹,因为它没有在 http://www.myget.org/F/azure-appservice/api/v2/ 提要中查找

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild.0\bin'.
Feeds used:
  C:\DWASFiles\Sites\#1<REDACTED>__43ae\LocalAppData\NuGet\Cache
  D:\local\UserProfile\.nuget\packages\
  https://api.nuget.org/v3/index.json

Restoring NuGet package Microsoft.Azure.WebJobs.1.1.2-alpha-10245.
Restoring NuGet package Microsoft.Azure.WebJobs.Extensions.1.0.2-alpha-10232.
Restoring NuGet package Microsoft.Azure.WebJobs.Core.1.1.2-alpha-10245.
WARNING: Unable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions'.
WARNING: Unable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs'.
WARNING: Unable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs.Core'.
Restoring NuGet package Microsoft.Azure.WebJobs.Extensions.SendGrid.1.0.2-alpha-10232.
WARNING: Unable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions.SendGrid'.
Unable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions.SendGrid'.
Unable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs.Core'.
Unable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs'.
Unable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions'.
Failed exitCode=1, command=nuget restore "D:\home\site\repository\<REDACTED>.sln"
An error has occurred during web site deployment.
Unable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions.SendGrid'.\r\nUnable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs.Core'.\r\nUnable to find version '1.1.2-alpha-10245' of package 'Microsoft.Azure.WebJobs'.\r\nUnable to find version '1.0.2-alpha-10232' of package 'Microsoft.Azure.WebJobs.Extensions'.\r\nC:\Program Files (x86)\SiteExtensions\Kudu.50316.2137\bin\scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

有人知道如何配置吗?

根据 matthews 的回复 https://github.com/Azure/azure-webjobs-sdk/issues/663

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
    <packageRestore>
        <!--Allow NuGet to download missing packages -->
        <add key="enabled" value="True" />
        <!-- Automatically check for missing packages during build in Visual Studio -->
        <add key="automatic" value="True" />
    </packageRestore>
    <packageSources>
        <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
        <add key="azure_app_service" value="https://www.myget.org/F/azure-appservice/api/v2" />
        <!--<add key="buildTools" value="https://www.myget.org/F/30de4ee06dd54956a82013fa17a3accb/" />-->
    </packageSources>
</configuration>