I am building an Azure Cloud service application in a TFS 2012 build definition. Everything is working properly with the default Cloud configuration. However when I set the TargetProfile
property in the MSBuild
arguments I get the following error. The service configuration file exists in the project and I am able to select within the project properties.
Is there something additional I need to do to get the build to recognize the non-default configuration?
/t:Publish /p:PublishDir=\buildserver\builddrops\LocA\ /p:TargetProfile=CloudLocA
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\1.8\Microsoft.WindowsAzure.targets (353): No default service configuration "ServiceConfiguration.cscfg" could be found in the project.
I figured it out and it ended up not being related to the TargetProfile
property. I had my build definition set to only clean the workspace outputs. When I looked at the sources folder on the build server I realized it wasn't pulling down the additional service configuration files so it couldn't find what I was specifying in the TargetProfile
property. I changed the clean workspace setting to all and everything is working now.
Have you tried tying the TargetProfile
to the $(Configuration)
? In my last project, I configured the Azure project with the following settings and it worked fine:
...
<PropertyGroup>
<TargetProfile Condition="'$(TargetProfile)'==''">$(Configuration)</TargetProfile>
</PropertyGroup>
<!-- Items for the project -->
<ItemGroup>
<ServiceDefinition Include="ServiceDefinition.csdef">
<SubType>Designer</SubType>
</ServiceDefinition>
<None Include="ServiceDefinition.Debug.csdef">
<SubType>Designer</SubType>
<DependentUpon>ServiceDefinition.csdef</DependentUpon>
</None>
<None Include="ServiceDefinition.Demo.csdef">
<SubType>Designer</SubType>
<DependentUpon>ServiceDefinition.csdef</DependentUpon>
</None>
<None Include="ServiceDefinition.Release.csdef">
<SubType>Designer</SubType>
<DependentUpon>ServiceDefinition.csdef</DependentUpon>
</None>
<ServiceConfiguration Include="ServiceConfiguration.Debug.cscfg">
<SubType>Designer</SubType>
</ServiceConfiguration>
<ServiceConfiguration Include="ServiceConfiguration.Demo.cscfg">
<SubType>Designer</SubType>
</ServiceConfiguration>
<ServiceConfiguration Include="ServiceConfiguration.Release.cscfg">
<SubType>Designer</SubType>
</ServiceConfiguration>
</ItemGroup>
The best way is to change the service configuration prefix in ccproj of your project, add yourprojectname.configurationname Dot is the life saver.
<ServiceConfigurationPrefix>yourproject.ServiceConfiguration</ServiceConfigurationPrefix>
Add these in itemgroup:
<ServiceDefinition Include="yourproject.ServiceDefinition.csdef" />
<ServiceConfiguration Include="yourproject.ServiceConfiguration.cscfg" />
Make sure you have renamed your cscfg files from the folder it resides.
Reload
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With