Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TargetProfile gives No default service configuration error

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?

MSBuild Arguments

/t:Publish /p:PublishDir=\buildserver\builddrops\LocA\ /p:TargetProfile=CloudLocA

Error Message

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.

like image 860
MikeDouglasDev Avatar asked Jan 01 '13 16:01

MikeDouglasDev


3 Answers

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.

like image 154
MikeDouglasDev Avatar answered Nov 04 '22 16:11

MikeDouglasDev


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>
like image 22
Nick Nieslanik Avatar answered Nov 04 '22 17:11

Nick Nieslanik


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

like image 40
Harshikesh Kumar Avatar answered Nov 04 '22 17:11

Harshikesh Kumar