Fixed RemoteWindowsDeployer to copy dontet runtime to target server for enabling portable apps scenario
This commit is contained in:
parent
f60aa7aa70
commit
bb3555c3dc
|
|
@ -9,6 +9,9 @@ param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$accountPassword,
|
[string]$accountPassword,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$dotnetRuntimePath = "",
|
||||||
|
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$executablePath,
|
[string]$executablePath,
|
||||||
|
|
||||||
|
|
@ -40,7 +43,7 @@ if ($serverAction -eq "StartServer")
|
||||||
{
|
{
|
||||||
Write-Host "Starting the application on machine '$serverName'"
|
Write-Host "Starting the application on machine '$serverName'"
|
||||||
$startServerScriptPath = "$PSScriptRoot\StartServer.ps1"
|
$startServerScriptPath = "$PSScriptRoot\StartServer.ps1"
|
||||||
$remoteResult=Invoke-Command -Session $psSession -FilePath $startServerScriptPath -ArgumentList $executablePath, $executableParameters, $serverType, $serverName, $applicationBaseUrl, $environmentVariables
|
$remoteResult=Invoke-Command -Session $psSession -FilePath $startServerScriptPath -ArgumentList $dotnetRuntimePath, $executablePath, $executableParameters, $serverType, $serverName, $applicationBaseUrl, $environmentVariables
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -54,5 +57,8 @@ Remove-PSSession $psSession
|
||||||
|
|
||||||
# NOTE: Currenty there is no straight forward way to get the exit code from a remotely executing session, so
|
# NOTE: Currenty there is no straight forward way to get the exit code from a remotely executing session, so
|
||||||
# we print out the exit code in the remote script and capture it's output to get the exit code.
|
# we print out the exit code in the remote script and capture it's output to get the exit code.
|
||||||
$finalExitCode=$remoteResult[$remoteResult.Length-1]
|
if($remoteResult.Length > 0)
|
||||||
exit $finalExitCode
|
{
|
||||||
|
$finalExitCode=$remoteResult[$remoteResult.Length-1]
|
||||||
|
exit $finalExitCode
|
||||||
|
}
|
||||||
|
|
@ -53,6 +53,13 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
" Account credentials are required to enable creating a powershell session to the remote server.");
|
" Account credentials are required to enable creating a powershell session to the remote server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_deploymentParameters.ApplicationType == ApplicationType.Portable
|
||||||
|
&& string.IsNullOrWhiteSpace(_deploymentParameters.DotnetRuntimePath))
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Invalid value '{_deploymentParameters.DotnetRuntimePath}' for {nameof(RemoteWindowsDeploymentParameters.DotnetRuntimePath)}. " +
|
||||||
|
"It must be non-empty for portable apps.");
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(_deploymentParameters.RemoteServerFileSharePath))
|
if (string.IsNullOrWhiteSpace(_deploymentParameters.RemoteServerFileSharePath))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.RemoteServerFileSharePath)}." +
|
throw new ArgumentException($"Invalid value for {nameof(RemoteWindowsDeploymentParameters.RemoteServerFileSharePath)}." +
|
||||||
|
|
@ -155,6 +162,12 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
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}");
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(_deploymentParameters.DotnetRuntimePath))
|
||||||
|
{
|
||||||
|
parameterBuilder.Append($" -dotnetRuntimePath \"{_deploymentParameters.DotnetRuntimePath}\"");
|
||||||
|
}
|
||||||
|
|
||||||
parameterBuilder.Append($" -executablePath \"{executablePath}\"");
|
parameterBuilder.Append($" -executablePath \"{executablePath}\"");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(executableParameters))
|
if (!string.IsNullOrEmpty(executableParameters))
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
{
|
{
|
||||||
public RemoteWindowsDeploymentParameters(
|
public RemoteWindowsDeploymentParameters(
|
||||||
string applicationPath,
|
string applicationPath,
|
||||||
|
string dotnetRuntimePath,
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture runtimeArchitecture,
|
RuntimeArchitecture runtimeArchitecture,
|
||||||
|
|
@ -20,6 +21,7 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
ServerName = remoteServerName;
|
ServerName = remoteServerName;
|
||||||
ServerAccountName = remoteServerAccountName;
|
ServerAccountName = remoteServerAccountName;
|
||||||
ServerAccountPassword = remoteServerAccountPassword;
|
ServerAccountPassword = remoteServerAccountPassword;
|
||||||
|
DotnetRuntimePath = dotnetRuntimePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ServerName { get; }
|
public string ServerName { get; }
|
||||||
|
|
@ -28,6 +30,8 @@ namespace Microsoft.AspNetCore.Server.Testing
|
||||||
|
|
||||||
public string ServerAccountPassword { get; }
|
public string ServerAccountPassword { get; }
|
||||||
|
|
||||||
|
public string DotnetRuntimePath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The full path to the remote server's file share
|
/// The full path to the remote server's file share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$dotnetRuntimePath,
|
||||||
|
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$executablePath,
|
[string]$executablePath,
|
||||||
|
|
||||||
|
|
@ -31,8 +34,19 @@ IF (-Not [string]::IsNullOrWhitespace($environmentVariables))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Temporary workaround for issue https://github.com/dotnet/cli/issues/2967
|
if ($executablePath -eq "dotnet.exe")
|
||||||
if ($executablePath -ne "dotnet.exe"){
|
{
|
||||||
|
Write-Host "Setting the dotnet runtime path to the PATH environment variable"
|
||||||
|
[Environment]::SetEnvironmentVariable("PATH", "$dotnetRuntimePath")
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Copying shell32.dll as a temporary workaround for issue https://github.com/dotnet/cli/issues/2967"
|
||||||
|
if ($executablePath -eq "dotnet.exe")
|
||||||
|
{
|
||||||
|
Copy-Item C:\Windows\System32\forwarders\shell32.dll $dotnetRuntimePath
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$destinationDir = Split-Path $executablePath
|
$destinationDir = Split-Path $executablePath
|
||||||
Copy-Item C:\Windows\System32\forwarders\shell32.dll $destinationDir
|
Copy-Item C:\Windows\System32\forwarders\shell32.dll $destinationDir
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue