diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index f3813694a..e16bf0d86 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -174,6 +174,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-test3.Tests", "test\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-cli-build", "build_projects\dotnet-cli-build\dotnet-cli-build.csproj", "{8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-run3.Tests", "test\dotnet-run3.Tests\dotnet-run3.Tests.xproj", "{9229D2A5-E2D1-4BEE-BC89-EFE65042842F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1018,6 +1020,22 @@ Global {8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Debug|x64.ActiveCfg = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Debug|x64.Build.0 = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Release|Any CPU.Build.0 = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Release|x64.ActiveCfg = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.Release|x64.Build.0 = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1083,5 +1101,6 @@ Global {FBE4F1D6-BA4C-46D9-8286-4EE4B032D01E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {90236A80-4B84-41D3-A161-AA20709776B1} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {8A2FA2D8-0DA1-4814-B5C1-2ECEAA613EB1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} + {9229D2A5-E2D1-4BEE-BC89-EFE65042842F} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} EndGlobalSection EndGlobal diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj new file mode 100644 index 000000000..abcd6d58c --- /dev/null +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/MSBuildAppWithMultipleFrameworks.csproj @@ -0,0 +1,28 @@ + + + + + + Exe + net451;netcoreapp1.0 + + + + + 1.0.0-alpha-20161010-1 + All + + + + + 1.0.1 + + + + + + + + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/Program.cs b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/Program.cs new file mode 100644 index 000000000..f5f4b6d13 --- /dev/null +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworks/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main() + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs b/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs index 62183ef9e..5583ea382 100644 --- a/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs +++ b/test/dotnet-run3.Tests/GivenDotnetRun3RunsCsProj.cs @@ -87,5 +87,31 @@ namespace Microsoft.DotNet.Cli.Run3.Tests .And .HaveStdOutContaining("Hello World!"); } + + [Fact] + public void ItReportsAGoodErrorWhenProjectHasMultipleFrameworks() + { + var testAppName = "MSBuildAppWithMultipleFrameworks"; + var testInstance = TestAssetsManager + .CreateTestInstance(testAppName); + + var testProjectDirectory = testInstance.TestRoot; + + new Restore3Command() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + // use --no-build so this test can run on all platforms. + // the test app targets net451, which can't be built on non-Windows + new Run3Command() + .WithWorkingDirectory(testProjectDirectory) + .ExecuteWithCapturedOutput("--no-build") + .Should() + .Fail() + .And + .HaveStdErrContaining("--framework"); + } } } \ No newline at end of file diff --git a/test/dotnet-run3.Tests/dotnet-run3.Tests.xproj b/test/dotnet-run3.Tests/dotnet-run3.Tests.xproj new file mode 100644 index 000000000..781162867 --- /dev/null +++ b/test/dotnet-run3.Tests/dotnet-run3.Tests.xproj @@ -0,0 +1,18 @@ + + + + 14.0.24720 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 9229D2A5-E2D1-4BEE-BC89-EFE65042842F + Microsoft.DotNet.Cli.Run3.Tests + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin + + + 2.0 + + + \ No newline at end of file