Merge pull request #1851 from dotnet/brthor/run-arg

Change dotnet run to call the muxer
This commit is contained in:
Bryan Thornbury 2016-03-22 18:09:07 -07:00
commit 9040a9094f
2 changed files with 38 additions and 1 deletions

View file

@ -124,6 +124,12 @@ namespace Microsoft.DotNet.Tools.Run
return result; return result;
} }
// Add Nuget Packages Probing Path
var nugetPackagesRoot = _context.PackagesDirectory;
var probingPathArg = "--additionalprobingpath";
_args.Insert(0, nugetPackagesRoot);
_args.Insert(0, probingPathArg);
// Now launch the output and give it the results // Now launch the output and give it the results
var outputPaths = _context.GetOutputPaths(Configuration); var outputPaths = _context.GetOutputPaths(Configuration);
var outputName = outputPaths.RuntimeFiles.Executable; var outputName = outputPaths.RuntimeFiles.Executable;
@ -150,7 +156,9 @@ namespace Microsoft.DotNet.Tools.Run
if (outputName.EndsWith(FileNameSuffixes.DotNet.DynamicLib, StringComparison.OrdinalIgnoreCase)) if (outputName.EndsWith(FileNameSuffixes.DotNet.DynamicLib, StringComparison.OrdinalIgnoreCase))
{ {
// The executable is a ".dll", we need to call it through dotnet.exe // The executable is a ".dll", we need to call it through dotnet.exe
command = Command.Create("corehost", Enumerable.Concat(new[] { outputName }, _args)); var muxer = new Muxer();
command = Command.Create(muxer.MuxerPath, Enumerable.Concat(new[] { "exec", outputName }, _args));
} }
else else
{ {

View file

@ -11,6 +11,7 @@ namespace Microsoft.DotNet.Tools.Run.Tests
{ {
public class RunTests : TestBase public class RunTests : TestBase
{ {
private const string PortableAppsTestBase = "PortableTests";
private const string RunTestsBase = "RunTestsApps"; private const string RunTestsBase = "RunTestsApps";
[WindowsOnlyFact] [WindowsOnlyFact]
@ -40,6 +41,34 @@ namespace Microsoft.DotNet.Tools.Run.Tests
new RunCommand(instance.TestRoot).Execute().Should().Fail(); new RunCommand(instance.TestRoot).Execute().Should().Fail();
} }
[Fact]
public void ItRunsPortableApps()
{
TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(PortableAppsTestBase, "PortableApp"))
.WithLockFiles()
.WithBuildArtifacts();
new RunCommand(instance.TestRoot).Execute().Should().Pass();
}
[Fact(Skip = "https://github.com/dotnet/cli/issues/1940")]
public void ItRunsPortableAppsWithNative()
{
TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(PortableAppsTestBase, "PortableAppWithNative"))
.WithLockFiles()
.WithBuildArtifacts();
new RunCommand(instance.TestRoot).Execute().Should().Pass();
}
[Fact]
public void ItRunsStandaloneApps()
{
TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine(PortableAppsTestBase, "StandaloneApp"))
.WithLockFiles()
.WithBuildArtifacts();
new RunCommand(instance.TestRoot).Execute().Should().Pass();
}
private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir) private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir)
{ {
// copy all the files to temp dir // copy all the files to temp dir