Azure Websites offer the capability to deploy from source control, such as Bitbucket or GitHub, instead of you building a deployment package or doing a web publish.
The way that works is that Bitbucket, for example, will send a push notification to your Azure Website whenever a commit is being pushed to it. This will make Azure pull the missing changesets and trigger a build. To make this build possible, it performs a NuGet package restore (if your solution is configured in such a way, that is).
This way of deploying has the added benefit of a build service test for your repository: If you’ve forgotten to check in relevant files, your deployment on Azure Websites will fail because the build will break. You don’t get this verification when building a deployment package with files present in your local workspace.
While this is a pretty handy and fast way of deploying, it does not work out of the box if you’re using NuGet package feeds that are not accessible for that build service.
There are some possible solutions for that:
- Host your NuGet packages in a publicly available location
- Direct link these assemblies with copylocal=true instead of using the package structure
- Copy them using FTP
You might not want to host your custom packages publicly (1) or circumvent the entire idea of NuGet in the first place just to enable this source code deployment scenario (2)
At Tekaris, we are using custom NuGet packages in a private feed hosted within our own infrastructure, so we chose option 3. Of course, it helps that these packages seldom change.
How’s this working? First, go to the management portal at https://manage.windowsazure.com and navigate to your website’s quick start page.
Then download the publish profile. Open this file in a text editor and look for FTP host, user and password information.
Use this information to open a FTP connection and navigate to /site/repository/packages
Now simply copy all these missing packages from your local workspace (where they have been used for building your app) to this package directory. Azure will not clean this directory when you do a new commit/deploy, so as long as you don’t need newer versions of them, this is a one-time operation.
Hope that helps,