A while back I was setting build definitions to automatically deploy our MVC app to Microsoft Azure. There's a nifty way to integrate the two, such that I can kick off a build in Visual Studio and minutes later the website will be updated. Things weren't going exactly as planned though and I was receiving the error shown below.
The issue was that I had failed to specify the MSBuild Arguments in the build definition when I created it in Visual Studio. To do so, follow these steps:
- Open up the Team Explorer in Visual Studio
- Select "Builds"
- Right click on the build of interest and select "Edit Build Definition..."
- Click on the "Process" tab on the left-hand side
- Navigate to the "Advanced" section
- In the "MSBuild Arguments" setting, input "/t:Publish /p:TargetProfile=QA" replace "QA" with the environment of choice corresponding to the configuration file name
This should help the build server to know which config file to use.
BONUS TIP: If you're trying to figure out how to deploy to the Production slot instead of Staging, put "Production" in the "Alternate Cloud Service Environment" setting under the "Publishing - Azure Cloud Service" section on the "Process" tab.