From e96f2cb738031a0c9c0c40c15a06d2d8aec7c3c0 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Thu, 4 Aug 2016 14:07:36 -0700 Subject: [PATCH] Set deployed application root folder as working directory --- .../Deployers/SelfHostDeployer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs index 47353de788..cad9fb991f 100644 --- a/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.Testing/Deployers/SelfHostDeployer.cs @@ -50,8 +50,10 @@ namespace Microsoft.AspNetCore.Server.Testing { string executableName; string executableArgs = string.Empty; + string workingDirectory = string.Empty; if (DeploymentParameters.PublishApplicationBeforeDeployment) { + workingDirectory = DeploymentParameters.PublishedApplicationRootPath; var executableExtension = DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? ".exe" : DeploymentParameters.ApplicationType == ApplicationType.Portable ? ".dll" : ""; @@ -74,6 +76,7 @@ namespace Microsoft.AspNetCore.Server.Testing } else { + workingDirectory = DeploymentParameters.ApplicationPath; var targetFramework = DeploymentParameters.TargetFramework ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0"); executableName = DotnetCommandName; @@ -94,7 +97,8 @@ namespace Microsoft.AspNetCore.Server.Testing RedirectStandardError = true, RedirectStandardOutput = true, // Trying a work around for https://github.com/aspnet/Hosting/issues/140. - RedirectStandardInput = true + RedirectStandardInput = true, + WorkingDirectory = workingDirectory }; AddEnvironmentVariablesToProcess(startInfo);