Skip to content

Commit 8958b1c

Browse files
committed
tokens parsed as strings
1 parent b123ec5 commit 8958b1c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/ServiceManagement/Services/Commands/Websites/PublishAzureWebsiteProject.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class PublishAzureWebsiteProject : WebsiteContextBaseCmdlet, IDynamicPara
3030

3131
[Parameter(ParameterSetName = "Package", Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration tokens to use for the deployment.")]
3232
[ValidateNotNullOrEmpty]
33-
public Hashtable Tokens { get; set; }
33+
public string Tokens { get; set; }
3434

3535
[Parameter(Mandatory = false, ParameterSetName = "Package", HelpMessage = "The WebDeploy SetParameters.xml file to transform configuration within the package.")]
3636
public string SetParametersFile { get; set; }
@@ -97,14 +97,18 @@ public override void ExecuteCmdlet()
9797
}
9898

9999
// If tokens are passed in, update the parameters file if there is one
100-
if (Tokens != null && !string.IsNullOrEmpty(fullSetParametersFile))
100+
if (!string.IsNullOrEmpty(Tokens) && !string.IsNullOrEmpty(fullSetParametersFile))
101101
{
102+
// Convert tokens string to hashtable
103+
string[] tokenSplit = Tokens.Split(';');
104+
102105
WriteVerbose(string.Format("Replacing tokens in {0}", fullSetParametersFile));
103106
var fileContents = File.ReadAllText(fullSetParametersFile);
104107

105-
foreach (DictionaryEntry pair in Tokens)
108+
foreach (string pair in tokenSplit)
106109
{
107-
fileContents = fileContents.Replace(string.Format("__{0}__", pair.Key), pair.Value.ToString());
110+
string[] data = pair.Split('=');
111+
fileContents = fileContents.Replace(string.Format("__{0}__", data[0].Replace("\"", "")), data[1].Replace("\"", ""));
108112
}
109113

110114
File.WriteAllText(fullSetParametersFile, fileContents);

0 commit comments

Comments
 (0)