将 Bitbucket 部署到 Azure 网站:添加私有 nuget 包服务器

Deploying Bitbucket to Azure Web Site: add private nuget package server

我已经在 Azure 上建立了一个网站,通过 Bitbucket 存储库进行部署。该过程在尝试安装存储在私有 nuget 服务器而非 nuget.org 上的 nuget 包时失败。有没有一种方法可以指定从何处还原 nuget 包,以便 Azure 可以还原这些包?

您可以在与 .SLN 文件相同的级别添加 custom NuGet.config 文件。

然后您可以进行以下修改(假设您的私人供稿需要身份验证,创建一组仅用于此站点的凭据):

<activePackageSource>
  <add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
  <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  <add key="custom_package_source" value="https://custom_package_source/nuget/v1/FeedService.svc/" />
</packageSources>
<disabledPackageSources />
<packageSourceCredentials>
  <custom_package_source>
    <add key="Username" value="CustomUsername" />
    <add key="ClearTextPassword" value="CustomPassword" />
  </custom_package_source>
</packageSourceCredentials>

当您通过 Kudu 部署时,这应该允许构建过程发现您的私人提要、验证和恢复您的包。

如果您不需要对您的私人供稿进行身份验证,请删除 <packageSourceCredentials> 元素。