none
WebJobs continuous deployment from VS Online Build RRS feed

  • Question

  • I have used the new VS 2013 Update 3 features to add two WebJobs to my Azure Website project, and am trying to get these webjobs deployed with the website. I'm using Visual Studio Online with hosted build, in Continuous Integration mode.

    The Website builds and deploys fine, but the webjobs are not deployed with it automatically as I expected. As I understand it, I don't have to do anything extra, the build process should read the webjobs-list.json (in the website project) and the webjobs-publish-settings.json (in the webjob projects) and use the values in these files to copy the webjob builds in the correct App_Data\ folder after the build finishes. 

    Is that correct? Or do I have to manually add an AfterBuild step in the csproj files of the webjobs, or put a webjobs.props file somewhere to tell msbuild how to deploy these?


    • Edited by MaartenS Friday, August 15, 2014 12:51 AM
    Friday, August 15, 2014 12:50 AM

Answers

  • And make sure you add it to the csproj as well. Here is an example of what the full change looks like.
    • Marked as answer by MaartenS Monday, September 22, 2014 10:12 AM
    Tuesday, August 26, 2014 5:24 PM
    Moderator

All replies

  • Hi,

    As we know, the azure website will redeply when we check in the pending changes in Continuous Integration mode, with the release of the azure SDK 2.4, we can select Microsoft Azure Webjob template, however, I don't know whether the webjob will automatically deploy to azure website, I will install the latest azure SDK to test, and will update here. If you solve this issue, welcome to share your solution.

    Best Regards,

    Jambor


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, August 15, 2014 8:36 AM
    Moderator
  • I've been able to work around the problem by installing the "old" version for webjob deployment, using this LigerShark WebJobsVs extension. This add a set of build targets and a "WebJobs.xml" into the website project, now a VS Online build deploys the two webjobs succesfully with the Azure Website.

    However, I think there are now two deployment processes in the solution, of which only one (the "old" one) works. There is the (new) webjobs-list.json file and the (old) WebJobs.xml file, containing the exact same configuration data. There is the ligershark.webjobs.targets msbuild targets, and the Microsoft.Web.WebJobs.Publish.1.0.0\tools\webjobs.targets, containing almost the same instructions. It is clear that the LigerShark deployment is a predecessor of the Microsoft Webjobs Publish package, but somehow the new deployment does not work. I'm no msbuild guru and can't figure out what is wrong with it, I think it's broken and should be easy to reproduce (create website, add webjob, push to VS Online, setup source control publishing to Azure website, start build -> no webjob)

    Friday, August 15, 2014 9:55 PM
  • Maarten,

    Have you posted this question to the VSO forum at http://social.msdn.microsoft.com/Forums/windowsazure/en-US/home?forum=TFService?


    Jim Cheshire | Microsoft

    Tuesday, August 19, 2014 4:05 PM
    Moderator
  • Some related information here, though it doesn't directly relate to VSO.

    Assuming you have control over the msbuild command line that VSO uses to build the project (you probably do, but I'm not a VSO expert), I think you'll be able to fix it by adding this to the command line:

    /p:_DestinationType=AzureWebSite
    First, make sure you update the WebJobs publish NuGet package, as a new version was released yesterday with fixes.


    Tuesday, August 19, 2014 4:53 PM
    Moderator
  • You are correct in that the WebJobsVs Extension was a precursor to the current Update 3-inclusive WebJobs tooling. The new tooling essentially deprecates the prototype extension. We also just announced a small update to the NuGet package we use to perform some of the WebJob publishing functionality. The blog post for this update, which went out yesterday (August 18) is here: http://azure.microsoft.com/blog/2014/08/18/enabling-command-line-or-continuous-delivery-of-azure-webjobs/

    Please try updating the NuGet package and let us know if that resolves this issue. 

    Tuesday, August 19, 2014 9:29 PM
  • I can't get a continuous deployment to Azure to work with Visual Studio Online (git) for a standalone console webjob using WebJobs.Publish 1.0.1.

    If I publish as webjob from Visual Studio, it works fine, but if I try to do a continuous deployment build from Visual Studio Online using git, it copies it to my Azure deployment as a web site, not into the App_data\jobs\continuous directory.

    What am I missing?  Let me know if you need any clarifications.  Thanks.

    Tuesday, August 26, 2014 1:39 AM
  • A fix for this will soon come.

    For now you can add the following file to your "Properties" directory of your WebJob and Website.

    Filename: webjobs.props

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <CopyAllFilesToSingleFolderForPackageDependsOn>
          $(CopyAllFilesToSingleFolderForPackageDependsOn);
          AddWebJobFilesToPublish;
        </CopyAllFilesToSingleFolderForPackageDependsOn>
        <_DestinationType>AzureWebSite</_DestinationType>
      </PropertyGroup>
    </Project>
     
    

    Tuesday, August 26, 2014 5:19 PM
  • And make sure you add it to the csproj as well. Here is an example of what the full change looks like.
    • Marked as answer by MaartenS Monday, September 22, 2014 10:12 AM
    Tuesday, August 26, 2014 5:24 PM
    Moderator
  • Thanks, I finally managed to get it working.

    I followed all of the above instructions:

    - update-package Microsoft.Web.WebJobs.Publish 
    - Added webjobs.props file to the website and all webjobs
    - Add /p:_DestinationType=AzureWebSite as a parameter in the build process template under MSBuild arguments

    But initially this still did not work. Then, using the example code from David, I manually edited all of our csproj files so that they reflected the example as closely as possible. For instance, my csproj had this setting, which I removed:

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        ...
        <ExcludeApp_Data>true</ExcludeApp_Data>
        <PublishDatabases>false</PublishDatabases>
        <FilesToIncludeForPublish>OnlyFilesToRunTheApp</FilesToIncludeForPublish>
    </PropertyGroup>

    In the process, I also switched from msbuild integrated package restore to automatic package restore, but I think this is unrelated to fixing the deployment.

    With these csproj changes, the webjobs were finally deployed with the website by TFS build.

    Anyway, thanks for helping with an example!


    • Edited by MaartenS Monday, September 22, 2014 10:47 AM
    Monday, September 22, 2014 10:25 AM
  • Just wanted to chime in--David's fix fixed it for me. After I used the menu command to setup an existing project as a webjob, I updated the Nuget package and added the webprops files to both the site and the job and included them in the csproj's. Then I committed and the webjob showed up! I didn't have to do anything extra. Thanks guys!

    Kamran A

    Wednesday, October 1, 2014 3:24 PM
  • I'm getting everything to build and deploy nicely using the webjobs.publish package and after adding the webjob.props...but only when i run this locally. When trying to run from my ci server i'm getting the following build error message

    packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.wap.targets(166,7): error MSB4036: The "GetFileSkips" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\12.0\bin"

    It seems i may need an update on my build server, I'm just not sure what that update might be. This plan is one of 20 or more already using msbuild 12 on this server, however this is the only plan with the webjobs targets file.

    ** update ** 

    I ran vs update 4 which has the build tools update (or other) the ci server needed. 

    Chris


    • Edited by ChrisKirby Friday, November 21, 2014 11:16 PM
    Friday, November 21, 2014 10:01 PM
  • I'm having the same issue and have tried everything written in this thread without any progress. How did vs update 4 help you exactly, isn't the build being done on the ci server?

    Anyhow, if something else has come up concering this issue I'm all ears.

    EDIT: To clarify, I get the "GetFileSkips" error when deploying from a CI server (TeamCity).

    EDIT 2: The webjob is actually deployed correctly (the files are added to azure), however the error occurs later in the MSBuild step:

    C:\BuildAgent2\work\b8e63f4b82f2a94d\packages\Microsoft.Web.WebJobs.Publish.1.0.1\tools\webjobs.wap.targets(172,7): error MSB4036: The "GetFileSkips" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory. [C:\BuildAgent2\work\b8e63f4b82f2a94d\MonitorWeb\Monitor.Web.csproj.teamcity]

    • Edited by Corpra Thursday, April 16, 2015 1:21 PM
    Thursday, April 16, 2015 9:31 AM
  • @Corpra I did a short write up on this here http://chriskirby.net/deploy-your-webjob-projects-with-your-azure-website-using-continuous-delivery/ which may help. Someone in the comments mentions being up and running on TeamCity successfully. 

    Chris

    Thursday, April 16, 2015 2:26 PM
  • I have been trying to get this to work with version 1.0.3 of the Microsoft WebJobs Publish Nuget package, Visual Studio Online (Git), and the GitContinousDeploymentTemplate with no luck. I have added the webjob.props file to both the website and the WebJob project itself. 

    I get no errors or warnings related to deploying either the website or the WebJob. However, nothing gets deployed either with the job existing or not.

    Any ideas???

    Monday, July 6, 2015 3:09 PM
  • Hi @GopherStateDev,  It might be a problem with msbuild $(outdir) parameter.

    The issue which we faced is $(outdir) is being set in TFS build process.   Hence, the Webjobs were being built directly to output directory rather than app_data folder of our web application.  To fix this issue, the following changes are made

    First of all, output location of the build definition has been changed to “As Configured”.  Initially it was having “Single Folder”.


    Secondly, created a custom MSBuild project to copy the files in local bin directory to TFS Build directory.  

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="PackageVersion" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
      <Target Name="PackageVersion">
        <PropertyGroup>
          <PackageVersionDir>$(TF_BUILD_BINARIESDIRECTORY)\$(Configuration)\Version\</PackageVersionDir>
          <SourcesDir>$(TF_BUILD_SOURCESDIRECTORY)</SourcesDir>
        </PropertyGroup>
        <Message Text="Sources Dir: $(SourcesDir)"/>
        <Message Text="Package Version Dir: $(PackageVersionDir)"/>
        <Message Text="TF_BUILD_BUILDDIRECTORY: $(TF_BUILD_BUILDDIRECTORY)" />
        <Message Text="TF_BUILD_DROPLOCATION: $(TF_BUILD_DROPLOCATION)" />
        <Message Text="TF_BUILD_SOURCESDIRECTORY: $(TF_BUILD_SOURCESDIRECTORY)" />
        <Message Text="TF_BUILD_BINARIESDIRECTORY: $(TF_BUILD_BINARIESDIRECTORY)" />
        <Message Text="Configuration: $(Configuration)" />
        <Message Text="Platform: $(Platform)" />
    
        <ItemGroup Condition="'$(SourcesDir)' != ''">
          <PackagesFiles Include="$(SourcesDir)\src\Profile.ApiApp\bin\_PublishedWebsites\Profile.ApiApp_Package\*.*" Exclude="$(PackageVersionDir)"/>
        </ItemGroup>
    
        <ItemGroup Condition="'$(SourcesDir)' != ''">
          <BinariesFiles Include="$(SourcesDir)\src\Profile.ApiApp\bin\$(Configuration)\**\*.*" Exclude="$(SourcesDir)\src\Profile.ApiApp\bin\_PublishedWebsites\**\*.*"/>
        </ItemGroup>
    
        <Message Text="Copying Packages" />
        <Message Text="@(PackageFiles)" />
    
        <Copy SourceFiles="@(PackagesFiles)"
              OverwriteReadOnlyFiles="true"
              DestinationFiles="@(PackagesFiles->'$(PackageVersionDir)\Profile.ApiApp_Package\%(Filename)%(Extension)')" />
    
        <Message Text="Copying Binaries" />
        <Message Text="@(BinariesFiles)" />
    
        <Copy SourceFiles="@(BinariesFiles)"
              OverwriteReadOnlyFiles="true"
              DestinationFiles="@(BinariesFiles->'$(TF_BUILD_BINARIESDIRECTORY)\%(RecursiveDir)%(Filename)%(Extension)')" />
    
        <ItemGroup>
          <ConfigsFiles Include="$(SourcesDir)\EnvConfig\**\*"></ConfigsFiles>
        </ItemGroup>
        <Copy SourceFiles="@(ConfigsFiles)"
          OverwriteReadOnlyFiles="true"
          DestinationFolder="$(PackageVersionDir)Deployment" />
      </Target>
    </Project>

    Ref: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3027ce80-8e0e-4227-b137-7fae524f4c15/azure-websites-build-package-with-webjobs-in-hosted-build-controller?forum=windowsazurewebsitespreview


    Ramji Piramanayagam, Development Consultant (Kloud Solutions)


    • Edited by Ramji P Tuesday, August 25, 2015 2:02 AM
    Tuesday, August 25, 2015 2:00 AM