Snixtor
Snixtor

Reputation: 4307

Visual Studio, ASP.NET 4.5, Bower, Gulp, VSTS and Azure Deploy, end-to-end

I'm working on an ASP.NET 4.5 web project (not ASP.NET Core/5), and am committed to taking on board the NPM, Gulp, Bower, etc. way of working. Where I'm coming a bit unstuck though, is the intersection of these new tools with VSTS (TFS Online) and Azure build + deploy.

Here's what I've got:

The challenge I'm facing is that not all of the results of NPM, Bower and Gulp tasks are having an effect on the Azure Web App Deployment task. I expect the reason for this is that the Web Deploy Package being created by the build task and being used by the Azure Web App Deployment task isn't making allowances for all the changes being made by NPM, Bower and Gulp.

For example, Bower dependencies will be brought down to the bower_components folder, and I'll use bower-installer in a Gulp task to copy a sub-set of those files to a lib folder. But because that lib folder (and the files within it) aren't included in the Visual Studio project file, the build step won't add them to the deployment package.

I can think of a few ways to resolve this, but I'm not particularly thrilled by any of them. Most of them feel like "swimming upstream" or have other downsides, which leaves me wondering if I'm missing something. Options:

  1. "Include" the output NPM, Bower and Gulp in the Visual Studio project. E.g. include the bower_components and lib folder. I feel this undoes a lot of the benefit of package management though, because I'll have explicit inclusions. It also doesn't sit well with me to have what are effectively build outputs (Gulp task results for example) included in the project, which is meant to represent source.
  2. Jump through hoops to get the web deploy package to selectively include extra files, like described here. This definitely feels like swimming upstream. I've also been down this path in past projects for different reasons and it wasn't a walk in the park.
  3. Use some other deployment technique. This answer talks about using a custom Kudu deployment script. But this seems a bit more bespoke than I'd have expected would be required. I was also immediately struck with a roadblock when clicking "Download deployment script" on my web apps Kudu page with an error "Operation only supported if not using a custom deployment script".

Is there an elegant alternative that I'm not seeing? Do I just have to bite the bullet and take on one of the options I've laid out above?

And incidentally, is this a smoother experience with ASP.NET Core/5? Because given the push towards NPM, Grunt, Gulp, Bower, etc., I'm surprised how awkward it's proving to be in ASP.NET 4.5 at least.

Upvotes: 2

Views: 470

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

You can also use Copy Files task and FTP Uploader task to deploy your web app via Azure FTP Deploy. With this publish method, you can control which files/folders to be published to Azure from the build definition.

Upvotes: 1

Related Questions