From 33ec55aee37b6eefee6f77446a83c9d4b31e43a4 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 26 Oct 2016 00:04:40 -0500 Subject: [PATCH] Fix dotnet run3 --project to pass the project to msbuild. Also update Microsoft.NET.Sdk to 1.0.0-alpha-20161026-2 since this has the corresponding fix needed for https://github.com/dotnet/sdk/issues/301. --- .../MSBuildAppWithMultipleFrameworks.csproj | 2 +- ...ldAppWithMultipleFrameworksAndTools.csproj | 2 +- .../MSBuildTestApp/MSBuildTestApp.csproj | 2 +- ...SBuildTestAppWithToolInDependencies.csproj | 2 +- .../CsprojLibrary1/project.json | 2 +- .../CsprojLibrary2/project.json | 2 +- .../CsprojLibrary3/project.json | 2 +- .../VSTestDotNetCoreProject.csproj | 2 +- .../dotnet-cli-build/dotnet-cli-build.csproj | 2 +- .../CSharp_Console/$projectName$.csproj | 2 +- .../CSharp_Lib/$projectName$.csproj | 2 +- .../commands/dotnet-run3/Run3Command.cs | 2 + test/EndToEnd/GivenDotNetUsesMSBuild.cs | 3 +- .../GivenDotnetRun3RunsCsProj.cs | 65 +++++++++++++++++-- 14 files changed, 74 insertions(+), 18 deletions(-) diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj index 43cdfd648..e7842b636 100644 --- a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj @@ -9,7 +9,7 @@ - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj index a7fad9b20..0f8b4a535 100644 --- a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj @@ -9,7 +9,7 @@ - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj index 4ab505eff..00f51ebb3 100644 --- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj +++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj @@ -15,7 +15,7 @@ 1.0.1 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/TestAssets/TestProjects/MSBuildTestAppWithToolInDependencies/MSBuildTestAppWithToolInDependencies.csproj b/TestAssets/TestProjects/MSBuildTestAppWithToolInDependencies/MSBuildTestAppWithToolInDependencies.csproj index de2931786..3be88edba 100644 --- a/TestAssets/TestProjects/MSBuildTestAppWithToolInDependencies/MSBuildTestAppWithToolInDependencies.csproj +++ b/TestAssets/TestProjects/MSBuildTestAppWithToolInDependencies/MSBuildTestAppWithToolInDependencies.csproj @@ -15,7 +15,7 @@ 1.0.1 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary1/project.json b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary1/project.json index 9cd4c2d47..ea1b66242 100644 --- a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary1/project.json +++ b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary1/project.json @@ -3,7 +3,7 @@ "frameworks": { "netstandard1.5": { "dependencies": { - "Microsoft.NET.Sdk": "1.0.0-alpha-20161019-1", + "Microsoft.NET.Sdk": "1.0.0-alpha-20161026-2", "NETStandard.Library": "1.6.0" } } diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary2/project.json b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary2/project.json index 9cd4c2d47..ea1b66242 100644 --- a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary2/project.json +++ b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary2/project.json @@ -3,7 +3,7 @@ "frameworks": { "netstandard1.5": { "dependencies": { - "Microsoft.NET.Sdk": "1.0.0-alpha-20161019-1", + "Microsoft.NET.Sdk": "1.0.0-alpha-20161026-2", "NETStandard.Library": "1.6.0" } } diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary3/project.json b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary3/project.json index 9cd4c2d47..ea1b66242 100644 --- a/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary3/project.json +++ b/TestAssets/TestProjects/TestAppDependencyGraph/CsprojLibrary3/project.json @@ -3,7 +3,7 @@ "frameworks": { "netstandard1.5": { "dependencies": { - "Microsoft.NET.Sdk": "1.0.0-alpha-20161019-1", + "Microsoft.NET.Sdk": "1.0.0-alpha-20161026-2", "NETStandard.Library": "1.6.0" } } diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj index 51f15125b..a65ef268e 100644 --- a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj @@ -17,7 +17,7 @@ 1.0.1 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj index e79d38ab4..d1bd45274 100644 --- a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj +++ b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj @@ -43,7 +43,7 @@ 1.0.1-beta-000933 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj index 8f7a78fa8..74fb291e9 100755 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj @@ -16,7 +16,7 @@ 1.0.1 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj index 911d63874..296cb5b67 100755 --- a/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj @@ -15,7 +15,7 @@ 1.6 - 1.0.0-alpha-20161019-1 + 1.0.0-alpha-20161026-2 All diff --git a/src/dotnet/commands/dotnet-run3/Run3Command.cs b/src/dotnet/commands/dotnet-run3/Run3Command.cs index 531a0a7e5..c5fe0bb56 100644 --- a/src/dotnet/commands/dotnet-run3/Run3Command.cs +++ b/src/dotnet/commands/dotnet-run3/Run3Command.cs @@ -46,6 +46,8 @@ namespace Microsoft.DotNet.Tools.Run { List buildArgs = new List(); + buildArgs.Add(Project); + buildArgs.Add("/nologo"); buildArgs.Add("/verbosity:quiet"); diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index e1c4a7463..27f7a3c87 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -39,10 +39,9 @@ namespace Microsoft.DotNet.Tests.EndToEnd .Should() .Pass(); - //TODO: https://github.com/dotnet/sdk/issues/187 - remove framework from below. new Run3Command() .WithWorkingDirectory(projectDirectory) - .ExecuteWithCapturedOutput("--framework netcoreapp1.0") + .ExecuteWithCapturedOutput() .Should() .Pass() .And diff --git a/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs b/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs index a946e23b9..c07d03c33 100644 --- a/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs +++ b/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; @@ -29,10 +30,9 @@ namespace Microsoft.DotNet.Cli.Run3.Tests .Should() .Pass(); - //TODO: https://github.com/dotnet/sdk/issues/187 - remove framework from below. new Run3Command() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("--framework netcoreapp1.0") + .ExecuteWithCapturedOutput() .Should() .Pass() .And @@ -54,10 +54,9 @@ namespace Microsoft.DotNet.Cli.Run3.Tests .Should() .Pass(); - //TODO: https://github.com/dotnet/sdk/issues/187 - remove framework from below. new Run3Command() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("--framework netcoreapp1.0") + .ExecuteWithCapturedOutput() .Should() .Pass() .And @@ -85,7 +84,7 @@ namespace Microsoft.DotNet.Cli.Run3.Tests .Should() .Pass() .And - .HaveStdOutContaining("Hello World!"); + .HaveStdOutContaining("Hello World!"); } [Fact] @@ -113,5 +112,61 @@ namespace Microsoft.DotNet.Cli.Run3.Tests .And .HaveStdErrContaining("--framework"); } + + [Fact] + public void It_runs_portable_apps_from_a_different_path_after_building() + { + var testAppName = "MSBuildTestApp"; + var testInstance = TestAssetsManager + .CreateTestInstance(testAppName); + + var testProjectDirectory = testInstance.TestRoot; + + new Restore3Command() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + new Build3Command() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + string workingDirectory = Directory.GetParent(testProjectDirectory).FullName; + new Run3Command() + .WithWorkingDirectory(workingDirectory) + .ExecuteWithCapturedOutput($"--no-build --project {Path.Combine(testProjectDirectory, testAppName)}.csproj") + .Should() + .Pass() + .And + .HaveStdOutContaining("Hello World!"); + } + + [Fact] + public void It_runs_portable_apps_from_a_different_path_without_building() + { + var testAppName = "MSBuildTestApp"; + var testInstance = TestAssetsManager + .CreateTestInstance(testAppName); + + var testProjectDirectory = testInstance.TestRoot; + + new Restore3Command() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + string workingDirectory = Directory.GetParent(testProjectDirectory).FullName; + new Run3Command() + .WithWorkingDirectory(workingDirectory) + .ExecuteWithCapturedOutput($"--project {Path.Combine(testProjectDirectory, testAppName)}.csproj") + .Should() + .Pass() + .And + .HaveStdOutContaining("Hello World!"); + } } } \ No newline at end of file