Updating the vstest.console to use the same runtime that is shipping with the CLI.

This commit is contained in:
Livar Cunha 2017-06-08 15:51:27 -07:00
parent 1b2c0cffc0
commit 0b19d6889e
2 changed files with 17 additions and 1 deletions

View file

@ -3,6 +3,7 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
@ -84,7 +85,8 @@ namespace Microsoft.DotNet.Cli.Build
var replacementPattern = ReplacementPatterns[i].ItemSpec;
var replacementString = ReplacementStrings[i].ItemSpec;
outText = outText.Replace(replacementPattern, replacementString);
var regex = new Regex(replacementPattern);
outText = regex.Replace(outText, replacementString);
}
return outText;

View file

@ -264,4 +264,18 @@
<Copy SourceFiles="@(Stage2Cli)"
DestinationFiles="@(Stage2Cli->'$(Stage2WithBackwardsCompatibleRuntimesOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="RetargetVSTestConsole"
AfterTargets="Publish">
<PropertyGroup>
<VSTestRuntimeConfigPath>$(PublishDir)/vstest.console.runtimeconfig.json</VSTestRuntimeConfigPath>
<ReplacementPattern>"version": ".*"</ReplacementPattern>
<ReplacementString>"version": "$(CLI_SharedFrameworkVersion)"</ReplacementString>
</PropertyGroup>
<ReplaceFileContents
InputFile="$(VSTestRuntimeConfigPath)"
DestinationFile="$(VSTestRuntimeConfigPath)"
ReplacementPatterns="$(ReplacementPattern)"
ReplacementStrings="$(ReplacementString)" />
</Target>
</Project>