Brandon Parker
Brandon Parker

Reputation: 803

VSTS Build with Gulp-Generated Files

I currently have a VSTS build that takes in a Visual Studio solution and builds it (C#) with the following build parameters:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:UseMerge=true /p:PrecompileBeforePublish=true /p:SingleAssemblyName=AppCode"

I also have various Gulp tasks that take in my front-end files and manipulate them (lint, minify, bundle, etc.) as part of this build. The problem is that the zip that is created from the solution build step doesn't include these distribution files (or any file that's not included in the solution.)

In general it's a bad idea to check in distribution files, you need to generate them as part of the production build. Can anyone point me in the right direction of how to get these files to generate (the build is working for this step) -AND- get them included as part of the zip file generated as part of the solution build?

Upvotes: 2

Views: 646

Answers (1)

Marina Liu
Marina Liu

Reputation: 38096

To include Gulp-Generated Files into web application package zip file, you can get the web application package files into another directory (such as $(build.binariesdirectory)) and after execute all the Gulp tasks, you can add the Gulp-Generated Files into $(build.binariesdirectory). Then zip files from $(build.binariesdirectory) and publish the artifacts.

Detail settings as below:

  1. In VS Build task, change MSBuild arrguments as:

    /p:OutDir="$(build.binariesdirectory)\\"
    
  2. Add a task (PowerShell task or Copy Files task etc) to copy the Gulp-Generated Files to $(build.binariesdirectory).

  3. Add an Archive Files task to zip files from $(build.binariesdirectory) to $(Build.ArtifactStagingDirectory) as below example:

    enter image description here

Now the zip file not only contains the package files of the web application, but also contains the Gulp-Generated Files.

Upvotes: 1

Related Questions