Set TargetProfile for an Azure project
Asked Answered
O

4

10

I'm getting the following error from a build I'm running through TeamCity on my development machine:

[ResolveServiceConfiguration] WATMessage
[16:02:05][WATMessage] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets(354, 5): No default service configuration "ServiceConfiguration.cscfg" could be found in the project.
[16:02:05][Xxx.Azure.Production\Xxx.Azure.Production.ccproj] Project Xxx.Azure.Production\Xxx.Azure.Production.ccproj failed.

The same solution builds okay in VS.NET.

I think what I need to do is set the TargetProfile for each of the Azure projects (there's more than one complaining) to override the default of Cloud but I can't find out where to do this.

So how do I set the Target Profile for an Azure project?

Orestes answered 5/7, 2012 at 16:22 Comment(7)
To get round this problem I have created ServiceConfiguration.Cloud.cscfg for each Azure project using the .cscfg that was being set in the definition.Orestes
Do you mean everything works in Visual Studio, but doesn’t work in a third party tool TeamCity? If it is a Windows Azure issue, please provide more information.Lorrettalorri
I think it's a difference between how VS and TeamCity build a solution using the .sln file. In VS it seems to pick up which .cscfg to use for each .ccproj. In TeamCity it uses the default (Cloud). I need to understand what is different between a VS.NET build and a TeamCity build (on the same machine) specifically for picking up the correct .cscfg to use. I think I can specify the TargetProfile as a parameter to MSBuild but then I'm not using the .sln any more.Orestes
I am not familiar with TeamCity. But since VS is working fine, I suggest you to continue to use VS. Let’s see if someone else can comment on TeamCity.Lorrettalorri
Is this still open? Did any of the replies not help in solving this? If solved, please accept answer and close the question, if not please clarify what is the current problem.Hasheem
@Ray'user1578904' I went for my workaround (see first comment to question).Orestes
then you should write that as an answer (with full details) and accept it accordingly.Hasheem
O
2

To work around this problem I have created ServiceConfiguration.Cloud.cscfg for each Azure project using the .cscfg that was being set in the definition.

Orestes answered 16/8, 2013 at 12:49 Comment(0)
F
27

Have you tried setting the target profile at command line?

/p:TargetProfile=MyProfile
Feudal answered 11/9, 2012 at 14:6 Comment(4)
Since I have a single build configuration that produces Azure packages for multiple profiles, I just added this argument to the individual VS build steps in my TeamCity build configuration. If I were to put it in as a TeamCity "system" variable, I'd be limited to building packages for just one profile per build configuration.Uptake
This can also be used with a parameter that is input to the build configuration, it does not need to be system variables.Hasheem
i had the same problem when i was trying to invoke msbuild from a powershell script and this fixed it for meAzobenzene
If the config is ServiceConfiguration.Production.cscfg, your target profile should be /p:TargetProfile=ProductionPatricia
S
11

Given an Azure service configuration file named "ServiceConfiguration.Production.cscfg":

  1. In your TeamCity project build configuration, go to Build Parameters (step 7)
  2. Add a system property with the name "system.TargetProfile" and a value of "Production"

This pattern applies for any named configuration in the format ServiceConfiguration.[your profile].cscfg.

Sower answered 17/9, 2012 at 5:37 Comment(1)
In my opinion: This should be the answer.Plainsman
O
2

To work around this problem I have created ServiceConfiguration.Cloud.cscfg for each Azure project using the .cscfg that was being set in the definition.

Orestes answered 16/8, 2013 at 12:49 Comment(0)
A
0

In my case, I renamed the ServiceConfiguration.Cloud.csfg file, and since the build agent will first look for that file because the default TargetProfile is "Cloud", I had to re-create the ServiceConfiguration.Cloud.csfg file in the same location, then went into the .ccproj file and added this line under the <ItemGroup> node:

<ServiceConfiguration Include="ServiceConfiguration.Cloud.csfg" />

Then I rebuilt and the problem was solved.

Atelier answered 4/2, 2016 at 10:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.