Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear MSBuild related env variables before dotnet restore #233

Merged
merged 2 commits into from
Mar 6, 2018
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 @@ -18,8 +18,8 @@ public DotnetRestorer(CommandRunner commandRunner, LogFactory logFactory)

public void Restore(string pathToProjectFile)
{
_logger.Debug($"Restoring {pathToProjectFile} using the dotnet cli.");
var runtimeIdentifier = RuntimeHelper.GetRuntimeIdentifier();
_logger.Debug($"Restoring {pathToProjectFile} using the dotnet cli. RuntimeIdentifier : {runtimeIdentifier}");
var exitcode = _commandRunner.Execute("dotnet", $"restore \"{pathToProjectFile}\" -r {runtimeIdentifier}");
if (exitcode != 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/filipw/dotnet-script.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>script;csx;csharp;roslyn;omnisharp</PackageTags>
<Version>0.4.0</Version>
<Version>0.5.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 12 additions & 2 deletions src/Dotnet.Script.DependencyModel/Process/CommandRunner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Collections.Generic;
using System.Diagnostics;
using Dotnet.Script.DependencyModel.Logging;

namespace Dotnet.Script.DependencyModel.Process
Expand Down Expand Up @@ -27,11 +28,20 @@ private static ProcessStartInfo CreateProcessStartInfo(string commandPath, strin
CreateNoWindow = true,
Arguments = arguments ?? "",
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardError = true,
UseShellExecute = false
};
RemoveMsBuildEnvironmentVariables(startInformation.Environment);
return startInformation;
}
private static void RemoveMsBuildEnvironmentVariables(IDictionary<string, string> environment)
{
// Remove various MSBuild environment variables set by OmniSharp to ensure that
// the .NET CLI is not launched with the wrong values.
environment.Remove("MSBUILD_EXE_PATH");
environment.Remove("MSBuildExtensionsPath");
}


private static void RunAndWait(System.Diagnostics.Process process)
{
Expand Down