How to deploy Orchard to Windows Azure using Team Foundation Service TFS

How to Deploy Orchard to Windows Azure using Team Foundation Service TFS and Visual Studio 2012 is quite easy (once you know how ūüėČ If you want to know more about Orchard, I can refer you to this book¬†and Team Foundation Server is nicely explained in Professional Team Foundation Server 2012.

Of course you can also use Visual Studio Team Foundation Server 2012instead of the hosted Microsoft Service.

We assume that:

  • you have a Orchard project that you can publish manually to Windows Azure
  • the TFS workspace¬†folder is C:TFS
  • the project name is Miglia
  • you have an account on Microsoft Team Foundation Service

These are the step on how to deploy Orchard to Windows Azure using Team Foundation Service

Make a modification to the CopyModulesAndThemes.proj

Without some changes to the CopyModulesAndThemes project, I got the error:

error MSB3021: Unable to copy file xxxx to yyyy. Access to the path yyyy is denied.

In the CopyModulesAndThemes.proj file change


Check in the project files

  • Copy the Orchard project files¬†to your TFS local project map (C:TFSMIGLIA)
  • Start Visual Studio 2012 as administrator
  • Connect to the Team Foundation Service
  • In the TFS Team Explorer click “Create a New Team Project
  • Fill in the project name (Miglia in this case)
  • After the creation has finished go to Visual Studio and click ‘Connect to a Team Project’
  • Select the project you’ve just created
  • Go to¬†the Source Control Explorer
  • Click on the project name
  • click “Add Items to Folder” and select all Orchard files and maps
  • click Next
  • You must include the library DLL’s now:
    • click Excluded item (approx. 10.443)
    • sort on destination folder
    • click the first file in $/Miglia/lib
    • scroll to the last file in $/Miglia/lib
    • hold the shift key and select the last files (you must have approx 135 files selected)
    • click Include Items
    • click Finish
    • the files will be added now
  • Go to Pending changes in the Team Explorer
  • enter a comment (e.g. Orchard Source files)
  • click Check in (aprox. 6252 items)

Connect TFS project to Windows Azure service

You have to create a Cloud Service so you can connect this service to TFS.

  • Open the Orchard.Azure.sln solution file in VS 2012
  • rightclick on Orchard.Azure.CloudService
  • publish the service and wait for it to finish
  • to go the Windows Azure Managementportal
  • click on the service that you have just created
  • click on ‘Set up TFS publishing”
  • enter the URL of your Team Foundation Service project.
  • click authorize now
  • click accept
  • select the right project and click ‚ąö

Create the Build Definition and start the Build process

  • In Visual Studio go to Team Explorer -> Build
  • rightclick the Build Definition miglia_CD (in my case miglia)
  • edit Build Definition
  • Enable the build definition (click Enabled)
  • click process
  • Set Solution To Build to Orchard.Azure.sln (in $Miglia/src/Orchard.Azure)
  • close and save the settings
  • rightclick the build in the Team Explorer
  • click Queue New Build to start building
  • after 20-30 minutes your Cloud Service is fully deployed to Windows Azure.

And this is how to Deploy Orchard to Windows Azure using Team Foundation Service

6 thoughts on “How to deploy Orchard to Windows Azure using Team Foundation Service TFS

  1. Thank you for this post. It really helped me out with figuring out how to build orchard on tfs. However, I am getting following DeploymentException after it builds successfully –
    Exception Message: An error was encountered when processing operation ‘Delete Directory’ on ‘Dependencies’.
    (type DeploymentException)
    I am wondering if you’d happen to have any idea regarding this issue.

    • Hi Ravi,

      That does not ring a bell.
      Can you give me some details on the TFS environment your using and on what environment do you deploy your Orchard project?

      Kind regard,


      • Hi Robert,
        I decided not to use cloud service and rather deploy orchard to web site instance on azure. I guess it is pretty easy to get that setup from gallery. However if I want to set up tfs publishing from source to website, do you know if the steps will be similar or is there some build parameters that will need to be configured? Thanks again for your input.

        • Hi Ravi,

          Were you able to deploy Orchard on azure website with tfs build? If yes, can you post the steps taken to accomplish the same? I am also looking the steps involved to deploy is on azure site.

          I have tried to deploy it on azure site but without success. I am been looking for the steps for a while now but haven’t found it anywhere yet.

          Any help in this regard is highly appreciated.



  2. Did you have to modify your Orchard.Azure.Web project to include the Modules, Core and Theme directories?

    I’ve gone through this walkthrough a few times and those directories always seem to be missing from the package that gets deployed to my cloud service. Maybe this is part of your #1 assumption (“you have a Orchard project that you can publish manually to Windows Azure”) that I need to get right first?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>