diff --git a/Nodejs/Product/TestAdapter/TestExecutor.cs b/Nodejs/Product/TestAdapter/TestExecutor.cs index 7b0d1d8bd..ca1b67595 100644 --- a/Nodejs/Product/TestAdapter/TestExecutor.cs +++ b/Nodejs/Product/TestAdapter/TestExecutor.cs @@ -226,23 +226,28 @@ private void RunTestCase(VisualStudioApp app, IFrameworkHandle frameworkHandle, } private NodejsProjectSettings LoadProjectSettings(string projectFile) { - var buildEngine = new MSBuild.ProjectCollection(); + var env = new Dictionary(); +#if DEV15 + var root = Environment.GetEnvironmentVariable(NodejsConstants.NodeToolsVsInstallRootEnvironmentVariable); + if (!string.IsNullOrEmpty(root)) { + env["VsInstallRoot"] = root; + env["MSBuildExtensionsPath32"] = Path.Combine(root, "MSBuild"); + } +#endif + var buildEngine = new MSBuild.ProjectCollection(env); var proj = buildEngine.LoadProject(projectFile); var projectRootDir = Path.GetFullPath(Path.Combine(proj.DirectoryPath, proj.GetPropertyValue(CommonConstants.ProjectHome) ?? ".")); - NodejsProjectSettings projSettings = new NodejsProjectSettings(); - - projSettings.ProjectRootDir = projectRootDir; + return new NodejsProjectSettings() { + ProjectRootDir = projectRootDir, - projSettings.WorkingDir = Path.GetFullPath(Path.Combine(projectRootDir, proj.GetPropertyValue(CommonConstants.WorkingDirectory) ?? ".")); + WorkingDir = Path.GetFullPath(Path.Combine(projectRootDir, proj.GetPropertyValue(CommonConstants.WorkingDirectory) ?? ".")), - projSettings.NodeExePath = - Nodejs.GetAbsoluteNodeExePath( + NodeExePath = Nodejs.GetAbsoluteNodeExePath( projectRootDir, - proj.GetPropertyValue(NodeProjectProperty.NodeExePath)); - - return projSettings; + proj.GetPropertyValue(NodeProjectProperty.NodeExePath)) + }; } private static void RecordEnd(IFrameworkHandle frameworkHandle, TestCase test, TestResult result, string stdout, string stderr, TestOutcome outcome) {