Fixed RemoteWindowsDeployer to differentiate running between portable/standalone apps.
This commit is contained in:
parent
06e23558d2
commit
954e864f96
|
|
@ -59,12 +59,6 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
" . A file share is required to copy the application's published output.");
|
" . A file share is required to copy the application's published output.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(_deploymentParameters.RemoteServerRelativeExecutablePath))
|
|
||||||
{
|
|
||||||
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.RemoteServerRelativeExecutablePath)}." +
|
|
||||||
" This is the name of the executable in the published output which needs to be executed on the remote server.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(_deploymentParameters.ApplicationBaseUriHint))
|
if (string.IsNullOrWhiteSpace(_deploymentParameters.ApplicationBaseUriHint))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.ApplicationBaseUriHint)}.");
|
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.ApplicationBaseUriHint)}.");
|
||||||
|
|
@ -143,12 +137,23 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
{
|
{
|
||||||
var remotePSSessionHelperScript = _scripts.Value.RemotePSSessionHelper;
|
var remotePSSessionHelperScript = _scripts.Value.RemotePSSessionHelper;
|
||||||
|
|
||||||
|
string executablePath = null;
|
||||||
|
var applicationName = new DirectoryInfo(DeploymentParameters.ApplicationPath).Name;
|
||||||
|
if (DeploymentParameters.ApplicationType == ApplicationType.Portable)
|
||||||
|
{
|
||||||
|
executablePath = $"dotnet {applicationName}.dll";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
executablePath = Path.Combine(_deployedFolderPathInFileShare, applicationName + ".exe");
|
||||||
|
}
|
||||||
|
|
||||||
var parameterBuilder = new StringBuilder();
|
var parameterBuilder = new StringBuilder();
|
||||||
parameterBuilder.Append($"\"{remotePSSessionHelperScript}\"");
|
parameterBuilder.Append($"\"{remotePSSessionHelperScript}\"");
|
||||||
parameterBuilder.Append($" -serverName {_deploymentParameters.ServerName}");
|
parameterBuilder.Append($" -serverName {_deploymentParameters.ServerName}");
|
||||||
parameterBuilder.Append($" -accountName {_deploymentParameters.ServerAccountName}");
|
parameterBuilder.Append($" -accountName {_deploymentParameters.ServerAccountName}");
|
||||||
parameterBuilder.Append($" -accountPassword {_deploymentParameters.ServerAccountPassword}");
|
parameterBuilder.Append($" -accountPassword {_deploymentParameters.ServerAccountPassword}");
|
||||||
parameterBuilder.Append($" -executablePath \"{Path.Combine(_deployedFolderPathInFileShare, _deploymentParameters.RemoteServerRelativeExecutablePath)}\"");
|
parameterBuilder.Append($" -executablePath \'{executablePath}\'");
|
||||||
parameterBuilder.Append($" -serverType {_deploymentParameters.ServerType}");
|
parameterBuilder.Append($" -serverType {_deploymentParameters.ServerType}");
|
||||||
parameterBuilder.Append($" -serverAction {serverAction}");
|
parameterBuilder.Append($" -serverAction {serverAction}");
|
||||||
parameterBuilder.Append($" -applicationBaseUrl {_deploymentParameters.ApplicationBaseUriHint}");
|
parameterBuilder.Append($" -applicationBaseUrl {_deploymentParameters.ApplicationBaseUriHint}");
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,13 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
string remoteServerFileSharePath,
|
string remoteServerFileSharePath,
|
||||||
string remoteServerName,
|
string remoteServerName,
|
||||||
string remoteServerAccountName,
|
string remoteServerAccountName,
|
||||||
string remoteServerAccountPassword,
|
string remoteServerAccountPassword)
|
||||||
string remoteServerRelativeExecutablePath)
|
|
||||||
: base(applicationPath, serverType, runtimeFlavor, runtimeArchitecture)
|
: base(applicationPath, serverType, runtimeFlavor, runtimeArchitecture)
|
||||||
{
|
{
|
||||||
RemoteServerFileSharePath = remoteServerFileSharePath;
|
RemoteServerFileSharePath = remoteServerFileSharePath;
|
||||||
ServerName = remoteServerName;
|
ServerName = remoteServerName;
|
||||||
ServerAccountName = remoteServerAccountName;
|
ServerAccountName = remoteServerAccountName;
|
||||||
ServerAccountPassword = remoteServerAccountPassword;
|
ServerAccountPassword = remoteServerAccountPassword;
|
||||||
RemoteServerRelativeExecutablePath = remoteServerRelativeExecutablePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ServerName { get; }
|
public string ServerName { get; }
|
||||||
|
|
@ -34,10 +32,5 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
/// The full path to the remote server's file share
|
/// The full path to the remote server's file share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RemoteServerFileSharePath { get; }
|
public string RemoteServerFileSharePath { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The relative path to the executable in the published output
|
|
||||||
/// </summary>
|
|
||||||
public string RemoteServerRelativeExecutablePath { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue