10

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 question appears to be identical to this one: Azure websites deploy specific web project

The solution to that question 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
  • 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 as described here (although this article also mentions using a Project app setting): How can I use the TFS Online <--> Azure Website integration when there are two web apps in the solution

This did not work either

Community
  • 1
  • 1
user2800795
  • 271
  • 2
  • 8
  • 1
    Where is your .deployment file located? It needs to be in the root of your repository, is this the case? – cory-fowler Feb 25 '14 at 17:12
  • Cory is most likely correct here. It is worth the exercise to generate a deployment script. This will give you insight into what is happening on deployment and you can instrument it to see more as the process is executing – Dennis Burton Feb 25 '14 at 17:20
  • @SyntaxC4 the .deployment file was placed in the root of the repo. I was aware of that. But good question. – user2800795 Feb 25 '14 at 17:34
  • @DennisBurton How do you generate a deployment script? I would love to get more insight into the deployment process. – user2800795 Feb 25 '14 at 17:36
  • I generate the deployment script using the cross platform command line (http://www.windowsazure.com/en-us/documentation/articles/xplat-cli/) azure site deploymentscript --WAP (projectfile). @SyntaxC4 is Cory, he has been around Azure for a long time. – Dennis Burton Feb 25 '14 at 17:41
  • also take a look here https://github.com/projectkudu/kudu/wiki/Customizing-deployments – ahmelsayed Feb 25 '14 at 17:53
  • @DennisBurton I will take a look at generating the deployment script. – user2800795 Feb 25 '14 at 17:59
  • I created a deployment script with this command: azure site deploymentscript --aspWAP WebApplication1\WebApplication1\WebApplication1.csproj -s WebApplication1\WebApplication1.sln and it generated a script. I was able to execute the script locally from a cmd prompt and it worked (although I did have to add a variable to define path to nuget). I've read up a lot on kudu (thanks @ahmelsayed). That led me to visiting the Kudu web console as well as hooking into the logstream with curl. I set the logstream to verbose and nothing came through. I'm wondering if I'm missing something very basic. – user2800795 Feb 26 '14 at 17:38

3 Answers3

8

I received this comment from Microsoft on a different forum and thought I'd add it here as it turned out to be the answer:

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.

Link http://social.msdn.microsoft.com/Forums/windowsazure/en-US/95f161f6-9370-43ad-9ac5-714f8978cc5e/continuous-integration-deploying-wrong-project-from-solution?forum=azuregit

user2800795
  • 271
  • 2
  • 8
  • Marking this as the answer as my link to the other portal was indeed the answer. I've commented on the other forum what happened. thanks – user2800795 May 19 '14 at 21:51
5

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.

Peter Örneholm
  • 2,838
  • 20
  • 24
  • 1
    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 – user2800795 May 05 '14 at 18:11
  • This worked like a charm. I don't know what scenario user2800795 is referring to as you should not have website apps have direct strong references within VS to other website apps in your solution. Basically I can have many azure websites in 1 solution now, wait about 10 minutes and they are deployed to my staging slots on azure. Just a side note: This works for standard tier and above only. Create 2 azure websites in portal, create staging slot for each, associate your single VSO team solution to each staging slot. In Team Explr, select Builds. You should see both build defs to edit. – RandallTo Nov 05 '15 at 02:16
0

Or set the Project attribute under App Settings in Azure.

See: Azure websites deploy specific web project

Community
  • 1
  • 1
Auri Rahimzadeh
  • 2,133
  • 15
  • 21