Create the ServiceDefinition environment wise files in azure project
Format:
ServiceDefinition.$(Configuration).csdef
Add following line of code
in Project .ccproj file
<ItemGroup>
<EnvironmentDefinition
Include="ServiceDefinition.Debug.csdef">
<BaseConfiguration>ServiceDefinition.csdef</BaseConfiguration>
</EnvironmentDefinition>
<EnvironmentDefinition
Include="ServiceDefinition.Production.csdef">
<BaseConfiguration>ServiceDefinition.csdef</BaseConfiguration>
</EnvironmentDefinition>
<EnvironmentDefinition
Include="ServiceDefinition.Int.csdef">
<BaseConfiguration>ServiceDefinition.csdef</BaseConfiguration>
</EnvironmentDefinition>
<EnvironmentDefinition
Include="ServiceDefinition.Dev.csdef">
<BaseConfiguration>ServiceDefinition.csdef</BaseConfiguration>
</EnvironmentDefinition>
<EnvironmentDefinition
Include="ServiceDefinition.Cloud.csdef">
<BaseConfiguration>ServiceDefinition.csdef</BaseConfiguration>
</EnvironmentDefinition>
<None
Include="@(EnvironmentDefinition)" />
</ItemGroup>
And then add
<Target Name="ValidateServiceFiles"
Inputs="@(EnvironmentDefinition);@(EnvironmentDefinition->'%(BaseConfiguration)')"
Outputs="@(EnvironmentDefinition->'%(Identity).transformed.csdef')">
<Message
Text="ValidateServiceFiles: Transforming %(EnvironmentDefinition.BaseConfiguration)
to %(EnvironmentDefinition.Identity).tmp via
%(EnvironmentDefinition.Identity)" Importance="High" />
<TransformXml
Source="%(EnvironmentDefinition.BaseConfiguration)"
Transform="%(EnvironmentDefinition.Identity)"
Destination="%(EnvironmentDefinition.Identity).tmp" />
<Message
Text="ValidateServiceFiles: Transformation complete; starting
validation" Importance="High" />
<ValidateServiceFiles
ServiceDefinitionFile="%(EnvironmentDefinition.Identity).tmp"
ServiceConfigurationFile="ServiceConfiguration.$(Configuration).cscfg"
/>
<Message
Text="ValidateServiceFiles: Validation complete; renaming temporary
file" Importance="High" />
<Move
SourceFiles="%(EnvironmentDefinition.Identity).tmp"
DestinationFiles="%(EnvironmentDefinition.Identity).transformed.csdef"
/>
</Target>
<Target
Name="MoveTransformedEnvironmentConfigurationXml"
AfterTargets="AfterPackageComputeService">
<Copy
SourceFiles="ServiceDefinition.$(Configuration).csdef.transformed.csdef"
DestinationFiles="$(OutDir)ServiceDefinition.csdef" />
</Target>