From 863f1cd91d19dc1c1e5af129b044b3f97b39d345 Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Mon, 14 Mar 2016 16:34:02 -0700 Subject: [PATCH 1/2] add the additional probing path to dotnet run remove colon --- src/dotnet/commands/dotnet-run/RunCommand.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index db67a4394..4270cfc16 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -124,6 +124,12 @@ namespace Microsoft.DotNet.Tools.Run 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 var outputPaths = _context.GetOutputPaths(Configuration); var outputName = outputPaths.RuntimeFiles.Executable; @@ -150,7 +156,9 @@ namespace Microsoft.DotNet.Tools.Run if (outputName.EndsWith(FileNameSuffixes.DotNet.DynamicLib, StringComparison.OrdinalIgnoreCase)) { // 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[] { outputName }, _args)); } else { From 2afe032280e384a44f7e0f3cabe15e923c84c93e Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Thu, 17 Mar 2016 18:02:48 -0700 Subject: [PATCH 2/2] Add tests and change to call exec --- src/dotnet/commands/dotnet-run/RunCommand.cs | 2 +- test/dotnet-run.Tests/RunTests.cs | 29 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index 4270cfc16..5936c2d7a 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -158,7 +158,7 @@ namespace Microsoft.DotNet.Tools.Run // The executable is a ".dll", we need to call it through dotnet.exe var muxer = new Muxer(); - command = Command.Create(muxer.MuxerPath, Enumerable.Concat(new[] { outputName }, _args)); + command = Command.Create(muxer.MuxerPath, Enumerable.Concat(new[] { "exec", outputName }, _args)); } else { diff --git a/test/dotnet-run.Tests/RunTests.cs b/test/dotnet-run.Tests/RunTests.cs index eaadc4c09..0ef74da61 100644 --- a/test/dotnet-run.Tests/RunTests.cs +++ b/test/dotnet-run.Tests/RunTests.cs @@ -11,6 +11,7 @@ namespace Microsoft.DotNet.Tools.Run.Tests { public class RunTests : TestBase { + private const string PortableAppsTestBase = "PortableTests"; private const string RunTestsBase = "RunTestsApps"; [WindowsOnlyFact] @@ -40,6 +41,34 @@ namespace Microsoft.DotNet.Tools.Run.Tests 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) { // copy all the files to temp dir