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

久未见 提交于 2019-11-29 13:11:43

问题


I have set up a website on Azure to deploy through a Bitbucket repository. The process fails when it tries to install nuget packages which are stored on a private nuget server, not nuget.org. Is there a way to specify where to restore the nuget packages from so that Azure can restore these packages?


回答1:


You can add a custom NuGet.config file at the same level as your .SLN file.

You can then make the following modifications (assuming that your private feed requires authentication, create a set of credentials which only are used for this site):

<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>

When you deploy via Kudu, this should allow the build process to discover your private feed, authenticate & restore your packages.

If you do not require authentication against your private feed, remove the <packageSourceCredentials> element.



来源:https://stackoverflow.com/questions/28884875/deploying-bitbucket-to-azure-web-site-add-private-nuget-package-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!