23

I have a solution with multiple web projects. I want to run them inside Azure Websites, each as a separate website, from the same Git repository.

How do I specify which website runs which web project?

AppHarbor handles this with multiple solution files named after the applications, containing the respective web project. I cannot find anything about Azure websites.

CMircea
  • 3,543
  • 2
  • 36
  • 58

3 Answers3

44

Now it is as simple as using App.Settings instead of a .deployment file.

This also allows for multi-project solutions in one Repo, so for example, if you have a WebAPI and a Web App in one solution you can configure an Azure Web Site to deploy a specific project. like so:

Azure App.Settings Example

Source: https://github.com/projectkudu/kudu/wiki/Customizing-deployments#using-app-settings-instead-of-a-deployment-file

I have tried this and works a treat.

SimonGates
  • 5,961
  • 4
  • 40
  • 52
  • Is it possible to specify a supporting library project? – LiamB Nov 27 '13 at 12:49
  • @LiamB - My WebAPI has project references with two of my .NET Class Libraries which work with no additional configuration from Windows Azure / deployment point of view. If that is what you mean? – SimonGates Nov 27 '13 at 15:35
  • Yep thats sorted it - one of my ref's got corrupted. thanks for coming back to me though. – LiamB Nov 27 '13 at 15:44
  • 1
    Better solution than .deployment file – Freshblood Jun 20 '16 at 18:38
  • Definitely my preferred solution though it appears to break with recent changes associated with ASP.NET Core projects which use a new project file extension of .xproj. When using the PROJECT app setting as above to point to a .xproj file the deployment fails with the following error: "The specified project 'D:\home\site\repository\FloatPin' is not valid. It needs to point to either a csproj/vbproj file or to a directory.". I tried pointing just to the directory with no joy, same error. Hopefully Azure CI/CD will catch up with ASP.NET Core quickly so we can get this working again. – Opsimath Dec 21 '16 at 17:13
  • good point @davidfer the project.json has been deprecated in favour of .csproj, replacing xproj - I'm not sure if that mean this is still a valid solution for ASP.NET Core projects on Azure. – SimonGates Dec 23 '16 at 11:39
6

You will need to work with 2 different branches combined with a .deployment file.

So the first branch could have something like this in the .deployment file:

[config]
project = WebProject/WebProjectA.csproj

And branch 2 something like this:

[config]
project = WebProject/WebProjectB.csproj
Sandrino Di Mattia
  • 24,739
  • 2
  • 60
  • 65
3

I came across a good blog post that describes how to do this using a custom deployment script. It is a bit fiddly but is a workable solution until something better is added.

http://blog.amitapple.com/post/38419111245/azurewebsitecustomdeploymentpart3

Edit:

This one is even better and allows you to do it with a couple of extra files at the route of your repo:

http://www.devtrends.co.uk/blog/azure-web-sites-git-deploy-for-multiple-project-solutions

Paul Hiles
  • 9,558
  • 7
  • 51
  • 76