2014-01-22 56 views
0

是否可以在ServiceDefinition.csdef xml文件本身內部使用環境變量?在xml中使用環境變量(在Azure ServiceDefinition xml中)

我試圖做到這一點:

<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0"> 
<WorkerRole name="MyService" vmsize="Small"> 
<Startup> 
    <Task commandLine="Create.cmd config_%DeploymentId%" executionContext="elevated" taskType="simple" > 
    <Environment> 
     <Variable name="DeploymentId"> 
     <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='DeploymentId']/@value" /> 
     </Variable> 
    </Environment>   
    </Task> 

...

的create.cmd批量接收參數字符串,沒有得到與實際部署的ID值替換。

是否有可能實現這一目標?

回答

0

爲什麼需要在命令行中傳遞%DeploymentId%?您可以讓Create.cmd中的代碼引用%DeploymentId%環境變量。