locked
Continuous Integration Deploying Wrong Project From Solution RRS feed

  • Question

  • I have a solution that has a mvc website (WebApplication1) that is dependent on another project in the solution (WebAppCore). The source is hosted in git on Visual Studio Online. I configured a Continuous Integration. Everything builds fine but when the deployment occurs, it deploys WebAppCore. As I understand it, that's the expected behavior since that's the first project in the solution. I want it to deploy WebApplication1.

    My research has found that the proposed solution is to go to the azure website configure page and add an app setting of Project and give it the repo root relative path of the project I want deployed. In my case that was:

    Project: WebApplication1\WebApplication1\WebApplication1.csproj

    The setting doesn't seem to work. I've tried many other combinations of the path to the project and none seem to work.

    Here are more details:

    • Visual Studio 2013
    • Visual Studio Online using a Git repository
    • Hosted git Build Process
    • Template is GitContinuousDeploymentTemplate.12.xaml

    In the template Process settings:

    • Build\Projects set to the solution
    • Deployment\Windows Azure Deployment Environment is my azure website.

    Troubleshooting 1 Since these are all test projects, when I remove WebAppCore, WebApplication1 is now the only project in the solution and that deploys fine.

    Troubleshooting 2 Even though it's not the fix I want, I decided to attempt using a .deployment file placed in the root of the repo.  That did not have any effect.

    Troubleshooting 3 I've tried doing live debugging from Kudu and even after setting logging to verbose, nothing is coming back in the stream.  I'm concerned I'm missing something very fundamental.


    • Moved by David Ebbo Thursday, February 27, 2014 8:05 AM The TFS Deployment forum has the experts in this area.
    • Edited by John M Wood Monday, August 4, 2014 4:53 PM Invalidating cache
    Thursday, February 27, 2014 12:06 AM

Answers

  • Currently build definitions which do a CI  from VSO to Azure will deploy the first web application alphabetically in that solution.  If you have a specific web application you want to deploy you will need to create a solution with only that web application in it. The setup wizard from the azure portal does it's best to set everything up for you based on simple conventions of only 1 solution in your team project and only 1 website in your solution.  This is something we expect to address in the future in order to provide users with more flexibility and control.


    Trevor Hancock (Microsoft)
    Please remember to "Mark As Answer" the replies that help.

    Thursday, February 27, 2014 8:39 PM

All replies

  • Currently build definitions which do a CI  from VSO to Azure will deploy the first web application alphabetically in that solution.  If you have a specific web application you want to deploy you will need to create a solution with only that web application in it. The setup wizard from the azure portal does it's best to set everything up for you based on simple conventions of only 1 solution in your team project and only 1 website in your solution.  This is something we expect to address in the future in order to provide users with more flexibility and control.


    Trevor Hancock (Microsoft)
    Please remember to "Mark As Answer" the replies that help.

    Thursday, February 27, 2014 8:39 PM
  • Thank you for the response Trevor.

    I'm not sure your suggestion that my solution have only one project in it is a good one as one project is dependent on another.

    Am I able to treat VSO as "just another external git repo" and get it to work that way?

    Thursday, February 27, 2014 10:21 PM
  • I have just unmarked this as the answer as it doesn't appear to be the case that the project that appears first in the solution is the one that gets deployed.  I say this because I have tested this more thoroughly in a real world scenario and the wrong project is repeatedly deployed.  It does NOT appear to have anything to do with the name because I have one scenario with the correct project to be deployed being first in alpha order and another last in alpha order.  In both cases, the wrong project was deployed.

    Can anyone please confirm what exactly determines which project gets deployed?

    Wednesday, April 2, 2014 12:54 AM
  • I came up with a workaround that I think should work for you. Wrote a blog post about it here:

    http://peter.orneholm.com/post/84647111808/deploy-to-multiple-azure-websites-with-visual-studio

    TD;DR: Create multiple solution configurations and only build the project you want to deploy. Then associate the build with the correct build config.
    Saturday, May 3, 2014 8:30 PM
  • Hi Peter,

    I read your blog post.  I think your solution is a clever one.  However, for my situation, it doesn't work.  The reason being is that the two projects in my solution have a dependency.  In other words, project 1 depends on project 2 (project 2 does NOT depend on project 1 though).  I need to deploy project 1.  So if I follow your suggestion, which in short is to not build project 2, then project 1 will not be able to build.  If you feel I'm misunderstanding something, please let me know.

    Thanks

    Monday, May 5, 2014 6:09 PM
  • I have now re-marked Trevor's original response as the answer.  We renamed projects using underscores "_" at the beginning of the name and this had unpredictable results.  It appears that Visual Studio sees an underscore as first in alphabetical order where as the deployment part of the build process doesn't see it that way.  Sorry, not sure what else to say.  But if you're just using good ole letters in your project name, you should be able to successfully deploy your project if you follow Trevor's answer.

    Sorry if my marking/unmarking of the answer caused anyone any unnecessary pain.


    Monday, May 19, 2014 9:48 PM
  • In my situation Azure does not pick the first project in alphabetical order.

    My projects are: 

    src/Project.Backend
    src/Project.Commons
    src/Project.Data
    tests/Project.Backend.Tests
    tests/Project.Commons.Tests
    tests/Project.Data.Tests

    The "src/Project.Commons" is deployed but "src/Project.Backend" should be deployed.

    Tuesday, September 12, 2017 2:51 PM
  • I have found solution here:

    https://stackoverflow.com/questions/24947317/two-web-project-in-my-solution-which-one-to-deploy

    (there was need to FTP to Azure, find deploy.cmd file and change csproj there).

    Tuesday, September 12, 2017 3:43 PM