Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

Expand Down Expand Up @@ -37,6 +38,16 @@ public ConsoleParameters(IFileHelper fileHelper)
this.fileHelper = fileHelper;
}

#if NET451
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this check


/// <summary>
/// TODO: Remove the #if when project is targeted to netstandard2.0
/// Environment variables to be set for the process
/// </summary>
public Dictionary<string, string> EnvironmentVariables { get; set; }

#endif

/// <summary>
/// Trace level for logs.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -106,6 +107,19 @@ public void StartProcess(ConsoleParameters consoleParameters)

EqtTrace.Verbose("VsTestCommandLineWrapper: Process Start Info {0} {1}", info.FileName, info.Arguments);

#if NET451
if (consoleParameters.EnvironmentVariables != null)
{
info.EnvironmentVariables.Clear();
foreach (var envVariable in consoleParameters.EnvironmentVariables)
{
if (envVariable.Key != null)
{
info.EnvironmentVariables.Add(envVariable.Key.ToString(), envVariable.Value?.ToString());
}
}
}
#endif
this.process = Process.Start(info);
this.process.Start();

Expand Down