diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs index 89ff76eb13..27a917ea22 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs @@ -59,12 +59,6 @@ namespace Microsoft.AspNetCore.Server.Testing " . 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)) { throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.ApplicationBaseUriHint)}."); @@ -143,12 +137,23 @@ namespace Microsoft.AspNetCore.Server.Testing { 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(); parameterBuilder.Append($"\"{remotePSSessionHelperScript}\""); parameterBuilder.Append($" -serverName {_deploymentParameters.ServerName}"); parameterBuilder.Append($" -accountName {_deploymentParameters.ServerAccountName}"); parameterBuilder.Append($" -accountPassword {_deploymentParameters.ServerAccountPassword}"); - parameterBuilder.Append($" -executablePath \"{Path.Combine(_deployedFolderPathInFileShare, _deploymentParameters.RemoteServerRelativeExecutablePath)}\""); + parameterBuilder.Append($" -executablePath \'{executablePath}\'"); parameterBuilder.Append($" -serverType {_deploymentParameters.ServerType}"); parameterBuilder.Append($" -serverAction {serverAction}"); parameterBuilder.Append($" -applicationBaseUrl {_deploymentParameters.ApplicationBaseUriHint}"); diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeploymentParameters.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeploymentParameters.cs index e1d9d74b96..b8e5ab0f95 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeploymentParameters.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/RemoteWindowsDeployer/RemoteWindowsDeploymentParameters.cs @@ -13,15 +13,13 @@ namespace Microsoft.AspNetCore.Server.Testing string remoteServerFileSharePath, string remoteServerName, string remoteServerAccountName, - string remoteServerAccountPassword, - string remoteServerRelativeExecutablePath) + string remoteServerAccountPassword) : base(applicationPath, serverType, runtimeFlavor, runtimeArchitecture) { RemoteServerFileSharePath = remoteServerFileSharePath; ServerName = remoteServerName; ServerAccountName = remoteServerAccountName; ServerAccountPassword = remoteServerAccountPassword; - RemoteServerRelativeExecutablePath = remoteServerRelativeExecutablePath; } public string ServerName { get; } @@ -34,10 +32,5 @@ namespace Microsoft.AspNetCore.Server.Testing /// The full path to the remote server's file share /// public string RemoteServerFileSharePath { get; } - - /// - /// The relative path to the executable in the published output - /// - public string RemoteServerRelativeExecutablePath { get; } } }