diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/MultitargetedCS.csproj b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/MultitargetedCS.csproj new file mode 100644 index 000000000..3b002645a --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/MultitargetedCS.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/Program.cs b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/Program.cs new file mode 100644 index 000000000..83d14f592 --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedCS/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace MultitargetedCS +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/MultitargetedFS.fsproj b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/MultitargetedFS.fsproj new file mode 100644 index 000000000..3d57360e1 --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/MultitargetedFS.fsproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.1 + + + + + + + diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/Program.fs b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/Program.fs new file mode 100644 index 000000000..a7458f522 --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedFS/Program.fs @@ -0,0 +1,8 @@ +// Learn more about F# at http://fsharp.org + +open System + +[] +let main argv = + printfn "Hello World from F#!" + 0 // return an integer exit code diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/MultitargetedVB.vbproj b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/MultitargetedVB.vbproj new file mode 100644 index 000000000..a7e3f5c46 --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/MultitargetedVB.vbproj @@ -0,0 +1,9 @@ + + + + Exe + MultitargetedVB + netcoreapp2.1 + + + diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/Program.vb b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/Program.vb new file mode 100644 index 000000000..46283ca23 --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/MultitargetedVB/Program.vb @@ -0,0 +1,7 @@ +Imports System + +Module Program + Sub Main(args As String()) + Console.WriteLine("Hello World!") + End Sub +End Module diff --git a/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/TestAppsWithSlnAndMultitargetedProjects.sln b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/TestAppsWithSlnAndMultitargetedProjects.sln new file mode 100644 index 000000000..2f92ebd9b --- /dev/null +++ b/TestAssets/TestProjects/TestAppsWithSlnAndMultitargetedProjects/TestAppsWithSlnAndMultitargetedProjects.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 6f17d7e2f..8eee157e8 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -23,7 +23,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) $(MicrosoftCodeAnalysisCSharpPackageVersion) - 2.2.100-preview1-63118-02 + 2.2.100-preview1-63130-08 $(MicrosoftNETSdkPackageVersion) 2.1.1 2.1.400-preview1-20180705-1834985 diff --git a/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs b/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs index 5b211ef37..3cdcd85b1 100644 --- a/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs +++ b/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs @@ -1012,6 +1012,72 @@ EndGlobal .Should().BeVisuallyEquivalentTo(ExpectedSlnFileAfterAddingProjectWithAdditionalConfigs); } + [Fact] + public void ItAddsACSharpProjectThatIsMultitargeted() + { + var solutionDirectory = TestAssets + .Get("TestAppsWithSlnAndMultitargetedProjects") + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + var slnFullPath = Path.Combine(solutionDirectory, "App.sln"); + var projectToAdd = Path.Combine("MultitargetedCS", "MultitargetedCS.csproj"); + + new DotnetCommand() + .WithWorkingDirectory(solutionDirectory) + .ExecuteWithCapturedOutput($"sln add {projectToAdd}") + .Should() + .Pass() + .And + .HaveStdOutContaining(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd)); + } + + [Fact] + public void ItAddsAVisualBasicProjectThatIsMultitargeted() + { + var solutionDirectory = TestAssets + .Get("TestAppsWithSlnAndMultitargetedProjects") + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + var slnFullPath = Path.Combine(solutionDirectory, "App.sln"); + var projectToAdd = Path.Combine("MultitargetedVB", "MultitargetedVB.vbproj"); + + new DotnetCommand() + .WithWorkingDirectory(solutionDirectory) + .ExecuteWithCapturedOutput($"sln add {projectToAdd}") + .Should() + .Pass() + .And + .HaveStdOutContaining(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd)); + } + + [Fact] + public void ItAddsAnFSharpProjectThatIsMultitargeted() + { + var solutionDirectory = TestAssets + .Get("TestAppsWithSlnAndMultitargetedProjects") + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + var slnFullPath = Path.Combine(solutionDirectory, "App.sln"); + var projectToAdd = Path.Combine("MultitargetedFS", "MultitargetedFS.fsproj"); + + new DotnetCommand() + .WithWorkingDirectory(solutionDirectory) + .ExecuteWithCapturedOutput($"sln add {projectToAdd}") + .Should() + .Pass() + .And + .HaveStdOutContaining(string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, projectToAdd)); + } + private string GetExpectedSlnContents( string slnPath, string slnTemplate,