AfterBuild not respected for WebDeploy

johnny_reilly's Avatar


27 Jan, 2015 02:35 PM


I've hit a problem when it comes to using WebDeploy in a project of mine:

This project uses gulp to create a build folder which contains static assets (JS / CSS / fonts etc). To handle this the appveyor.yml contains the following section:

- cmd: >-
    nuget restore Proverb.sln

    npm install -g bower
    npm install -g gulp

    cd Proverb.Web

    bower install
    npm install


    cd ..

This creates the build folder under the Proverb.Web folder. (When built in Visual Studio the Task Runner Explorer runs the gulp task as part of the Visual Studio build - it is separately invoked here because Visual Studio is not performing the build in AppVeyor.)

Also in the appveyor.yml are the following build and deploy settings:

  project: Proverb.sln
  publish_wap: true
  verbosity: minimal

# snip

- provider: WebDeploy
    secure: NvzatElBACvT9rl9q93l4Ou1LdB7WvF4cAV61SyergZ20myLeUxsCfsUkgsGTcjC8Khw2jC0HrTdJsGrfwx2YCI90yYgC7xqDnGF4TLpnc0=
  website: proverb
    secure: hF4z+9jP+et7duuTVWcVBw==
    secure: dSc6RSokZrmvp0+a4tYUSJhsVUN+IasvnJ8LrQpQCoqUOIfYF5TbNK7E6MGGH1K7ao3UzrSUodQ18KJhhvsI9g==
  remove_files: true

Which push out the build to Azure websites here. Unfortunately this does not appear to be respecting the AfterBuild section of Proverb.Webs csproj:

  <Target Name="AfterBuild">
      <!-- what ever is in the build folder should be included in the project -->
      <Content Include="build\**\*.*" />

This includes the contents of the build folder after the build has taken place. However, when I look at what is being deployed I can see that the build folder is not being included by AppVeyor.

Any idea why that would be?

  1. Support Staff 1 Posted by Feodor Fitsner on 27 Jan, 2015 02:45 PM

    Feodor Fitsner's Avatar

    Hi Johnny,

    Have you tried the method described here:

    It worked pretty well on a few projects.

  2. Support Staff 2 Posted by Feodor Fitsner on 27 Jan, 2015 02:49 PM

    Feodor Fitsner's Avatar

    Also, we use BeforeBuild to publish and it works:

      <Target Name="BeforeBuild">
          <Content Include="site\**\*" />
  3. 3 Posted by johnny_reilly on 28 Jan, 2015 01:18 PM

    johnny_reilly's Avatar

    Thanks for the help Feodor - I'm using the first approach you suggested and it seems to work just fine.

    It's weird that AfterBuild doesn't work given it does when you publish directly from Visual Studio. Most strange.

    Unfortunately I can't use the BeforeBuild approach as that would break the TypeScript build. (Duplicate files would collide :-( )

    Currently I'm ignoring the JS files built from TypeScript as part of the build. I'm running the gulp release-build task before the actual build takes place which is not quite a reflection of how it works on my own machine. From the docs I think I could swap to a custom build script like this:

    # Full build of solution takes place
    msbuild Proverb.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
    # JavaScript files created from TypeScript are turned into build artefacts by Gulp
    gulp release-build
    # Everything that has been built gets packaged
    msbuild Proverb.Web\Proverb.Web.csproj /t:Package /

    Does that look about right?

  4. Support Staff 4 Posted by Feodor Fitsner on 28 Jan, 2015 03:50 PM

    Feodor Fitsner's Avatar

    Yeah, the script does look quite right to me.

  5. 5 Posted by johnny_reilly on 28 Jan, 2015 06:04 PM

    johnny_reilly's Avatar

    Nearly there - getting this error:

    Neither 'WebDeploy package', nor 'Web application', nor 'Zip archive' artifact was found that can be deployed using WebDeploy provider.

    Do I need to place the zip in a special location perhaps?

  6. Support Staff 6 Posted by Feodor Fitsner on 28 Jan, 2015 06:06 PM

    Feodor Fitsner's Avatar

    You should configure pushing artifact:

    Make sure you specify "WebDeployPackage" as its type.

  7. 7 Posted by johnny_reilly on 28 Jan, 2015 09:33 PM

    johnny_reilly's Avatar

    I think we're sorted!

  8. johnny_reilly closed this discussion on 29 Jan, 2015 09:24 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac