Goal: Create the environment variable that informs the startup task whether it is running in the Compute Emulator or in the cloud.
Error:
Error 124 The XML specification is not valid: The element 'Startup' in namespace 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition' has invalid child element 'environment' in namespace 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'. List of possible elements expected: 'Task' in namespace 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition'. D:\PrasadP_Workspace\FlexPathCapital\flexpathazurecloudmigration\flexpathazurecloudmigration\FlexPath.Cloud\ServiceDefinition.csdef 11 8 FlexPath.Cloud
StartUp task:
<Startup>
<Task commandLine="startup.cmd" executionContext="elevated" taskType="simple" />
<environment>
<!--create the environment variable that informs the startup task whether it is running
in the compute emulator or in the cloud. "%computeemulatorrunning%"=="true" when
running in the compute emulator, "%computeemulatorrunning%"=="false" when running
in the cloud.-->
<variable name="computeemulatorrunning">
<roleinstancevalue xpath="/roleenvironment/deployment/@emulated" />
</variable>
</environment>
</Startup>
startup.cmd:
After it i will check the environment in cmd file to perform my task.
REM Check if this task is running on the compute emulator
IF "%ComputeEmulatorRunning%" == "true" (
REM This task is running on the compute emulator. Perform tasks that must be run only in the compute emulator.
) ELSE (
REM This task is running on the cloud. Perform tasks that must be run only in the cloud.
)