Changing ZIP Deploy Publish to use the PublishUrl property instead of ScmSiteUrl

This commit is contained in:
Brian Zhu 2018-06-13 15:56:54 -07:00
Родитель e9d61a0754
Коммит 02a50562b7
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -43,7 +43,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
ZipToPublishPath="$(ZippedPublishContentsPath)"
DeploymentUsername="$(UserName)"
DeploymentPassword="$(Password)"
ScmSiteUrl="$(ScmSiteUrl)" />
PublishUrl="$(PublishUrl)" />
</Target>
</Project>

Просмотреть файл

@ -21,31 +21,31 @@ namespace Microsoft.NET.Sdk.Functions.Tasks
public string DeploymentPassword { get; set; }
[Required]
public string ScmSiteUrl { get; set; }
public string PublishUrl { get; set; }
public override bool Execute()
{
using(DefaultHttpClient client = new DefaultHttpClient())
{
System.Threading.Tasks.Task<bool> t = ZipDeployAsync(ZipToPublishPath, DeploymentUsername, DeploymentPassword, ScmSiteUrl, client);
System.Threading.Tasks.Task<bool> t = ZipDeployAsync(ZipToPublishPath, DeploymentUsername, DeploymentPassword, PublishUrl, client);
t.Wait();
return t.Result;
}
}
private async System.Threading.Tasks.Task<bool> ZipDeployAsync(string zipToPublishPath, string userName, string password, string scmSiteUrl, IHttpClient client)
private async System.Threading.Tasks.Task<bool> ZipDeployAsync(string zipToPublishPath, string userName, string password, string publishUrl, IHttpClient client)
{
if (!File.Exists(ZipToPublishPath) || client == null)
{
return false;
}
if (!scmSiteUrl.EndsWith("/"))
if (!publishUrl.EndsWith("/"))
{
scmSiteUrl += "/";
publishUrl += "/";
}
string zipDeployPublishUrl = scmSiteUrl + "api/zipdeploy";
string zipDeployPublishUrl = publishUrl + "api/zipdeploy";
Log.LogMessage(MessageImportance.High, String.Format(Resources.PublishingZipViaZipDeploy, zipToPublishPath, zipDeployPublishUrl));