From 20fa03e37f503e1a4224d1972cfaa9559767e763 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 13 Jan 2017 22:10:56 -0800 Subject: [PATCH 01/13] Bump SDK to 1.0.0-alpha-20170113-2 (#5313) * Bump SDK to 1.0.0-alpha-20170113-2 * Updating the Web.SDK to 1.0.0-alpha-20170113-2-221 * Updating the web SDK to 1.0.0-alpha-20170114-1-223 --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index ff1b726b2..8e6f919e1 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,8 +3,8 @@ 15.1.0-preview-000522-02 2.0.0-rc3-61212-03 - 1.0.0-alpha-20170111-1 - 1.0.0-alpha-20170106-1-203 + 1.0.0-alpha-20170113-2 + 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 From db2282a0556c5d88c4080d4f5289bba813c86e67 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 13 Jan 2017 23:53:08 -0800 Subject: [PATCH 02/13] Update Microsoft.DotNet.Cli.DependencyVersions.props (#5322) --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 8e6f919e1..1fcb90c7b 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,7 +3,7 @@ 15.1.0-preview-000522-02 2.0.0-rc3-61212-03 - 1.0.0-alpha-20170113-2 + 1.0.0-alpha-20170114-2 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 From 7bc1bd4e7d0a49791b8699fc005878b357549200 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Sat, 14 Jan 2017 15:55:08 -0600 Subject: [PATCH 03/13] Update msbuild to 15.1.0-preview-000523-01 (#5323) --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 1fcb90c7b..18db3d7f3 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -1,7 +1,7 @@ - 15.1.0-preview-000522-02 + 15.1.0-preview-000523-01 2.0.0-rc3-61212-03 1.0.0-alpha-20170114-2 1.0.0-alpha-20170114-1-223 From b312fbb17696b027fd3e1acf836a553efa33875c Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Sat, 14 Jan 2017 19:52:02 -0800 Subject: [PATCH 04/13] Bump SDK to 20170114-3 (#5324) * Bump SDK to 20170114-3 * bump to 20170115-2 --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 18db3d7f3..fb5ff6898 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,7 +3,7 @@ 15.1.0-preview-000523-01 2.0.0-rc3-61212-03 - 1.0.0-alpha-20170114-2 + 1.0.0-alpha-20170115-2 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 From b8da3b9a875bbbe46fee81c3ce2786620086e8c9 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 16 Jan 2017 13:08:40 -0800 Subject: [PATCH 05/13] Updating the versions of xunit 2.2.0-beta5-build3474 and xunit runner to 2.2.0-beta5-build1225. --- .../ConstantPackageVersions.cs | 4 ++-- .../Rules/GivenThatIWantToMigratePackageDependencies.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs index f3e33f733..9928d0e67 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ConstantPackageVersions.cs @@ -10,8 +10,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration public const string AspNetLTSPackagesVersion = "1.0.2"; public const string EntityFrameworkLTSPackagesVersion = "1.0.2"; public const string TestSdkPackageVersion = "15.0.0-preview-20170106-08"; - public const string XUnitPackageVersion = "2.2.0-beta4-build3444"; - public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1194"; + public const string XUnitPackageVersion = "2.2.0-beta5-build3474"; + public const string XUnitRunnerPackageVersion = "2.2.0-beta5-build1225"; public const string MstestTestAdapterVersion = "1.1.8-rc"; public const string MstestTestFrameworkVersion = "1.0.8-rc"; public const string BundleMinifierToolVersion = "2.2.301"; diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs index d93c3c96a..3067b567a 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs @@ -309,13 +309,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.Should().ContainSingle( i => (i.Include == "xunit" && i.ItemType == "PackageReference" && - i.GetMetadataWithName("Version").Value == "2.2.0-beta4-build3444" && + i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build3474" && i.GetMetadataWithName("Version").ExpressedAsAttribute)); mockProj.Items.Should().ContainSingle( i => (i.Include == "xunit.runner.visualstudio" && i.ItemType == "PackageReference" && - i.GetMetadataWithName("Version").Value == "2.2.0-beta4-build1194" && + i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build1225" && i.GetMetadataWithName("Version").ExpressedAsAttribute)); mockProj.Items.Should().NotContain( @@ -351,13 +351,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.Should().ContainSingle( i => (i.Include == "xunit" && i.ItemType == "PackageReference" && - i.GetMetadataWithName("Version").Value == "2.2.0-beta4-build3444" && + i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build3474" && i.GetMetadataWithName("Version").ExpressedAsAttribute)); mockProj.Items.Should().ContainSingle( i => (i.Include == "xunit.runner.visualstudio" && i.ItemType == "PackageReference" && - i.GetMetadataWithName("Version").Value == "2.2.0-beta4-build1194" && + i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build1225" && i.GetMetadataWithName("Version").ExpressedAsAttribute)); mockProj.Items.Should().NotContain( From e1f355065d2dedb800df1af707956df9781677f0 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 16 Jan 2017 15:16:31 -0800 Subject: [PATCH 06/13] Moving the project dependencies construction to after we check for the skip project reference check, so that we really don't look for P2P projects when the flag is passed. --- .../ProjectMigrator.cs | 16 ++++++++-------- .../GivenThatIWantToMigrateTestApps.cs | 13 +++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index 98f7e4cf4..2eb611361 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -37,12 +37,20 @@ namespace Microsoft.DotNet.ProjectJsonMigration // Try to read the project dependencies, ignore an unresolved exception for now MigrationRuleInputs rootInputs = ComputeMigrationRuleInputs(rootSettings); IEnumerable projectDependencies = null; + var projectMigrationReports = new List(); try { // Verify up front so we can prefer these errors over an unresolved project dependency VerifyInputs(rootInputs, rootSettings); + projectMigrationReports.Add(MigrateProject(rootSettings)); + + if (skipProjectReferences) + { + return new MigrationReport(projectMigrationReports); + } + projectDependencies = ResolveTransitiveClosureProjectDependencies( rootSettings.ProjectDirectory, rootSettings.ProjectXProjFilePath, @@ -61,14 +69,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration }); } - var projectMigrationReports = new List(); - projectMigrationReports.Add(MigrateProject(rootSettings)); - - if (skipProjectReferences) - { - return new MigrationReport(projectMigrationReports); - } - foreach(var project in projectDependencies) { var projectDir = Path.GetDirectoryName(project.ProjectFilePath); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 2e511c1b3..3cb7e0d57 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -163,6 +163,19 @@ namespace Microsoft.DotNet.Migration.Tests PublishMSBuild(projectDirectory, projectName); } + [Fact] + public void ItMigratesAProjectThatDependsOnAMigratedProjectWithTheSkipProjectReferenceFlag() + { + const string dependentProject = "ProjectA"; + const string dependencyProject = "ProjectB"; + + var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppDependencyGraph").Path; + + MigrateProject(Path.Combine(projectDirectory, dependencyProject)); + + MigrateProject("--skip-project-references", Path.Combine(projectDirectory, dependentProject)); + } + [Fact] public void ItAddsMicrosoftNetWebSdkToTheSdkAttributeOfAWebApp() { From 82dcdada5005774b70ca14c3935f8c4c3acd6265 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Mon, 16 Jan 2017 16:13:58 -0800 Subject: [PATCH 07/13] Fixes #5345 --- .../ProjectContextExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectContextExtensions.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectContextExtensions.cs index d1b0dac7a..10c2630e0 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectContextExtensions.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectContextExtensions.cs @@ -14,8 +14,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration { public static string GetProjectName(this ProjectContext projectContext) { - // _ here is just an arbitrary configuration value so we can obtain the output name - return Path.GetFileNameWithoutExtension(projectContext.GetOutputPaths("_").CompilationFiles.Assembly); + var projectDirectory = projectContext.ProjectDirectory; + + return Path.GetFileName(projectDirectory); } public static bool HasRuntimes(this IEnumerable projectContexts) From 03de88f24b4560b5d9af5f850dbd08f3fbbae030 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Mon, 16 Jan 2017 19:31:33 -0800 Subject: [PATCH 08/13] Update dotnet new templates with beta5 xunit (#5339) * Pull latest template engine version * Bump xunit version and take corresponding template engine * Rollback template engine version bump --- .../commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj | 4 ++-- .../commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj index f76c6d4b9..1de3d53ff 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj index 17b826289..2197d2277 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj @@ -15,8 +15,8 @@ - - + + From 61b784108791c7374f1870f6fb05888e564ace29 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Mon, 16 Jan 2017 20:02:02 -0800 Subject: [PATCH 09/13] bump core sdk to 1.0.0-alpha-20170117-1 (#5358) --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index fb5ff6898..8fcaccd95 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,7 +3,7 @@ 15.1.0-preview-000523-01 2.0.0-rc3-61212-03 - 1.0.0-alpha-20170115-2 + 1.0.0-alpha-20170117-1 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 From 2676682fecd79748a3a2e474344d7e21d2594644 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 17 Jan 2017 13:45:48 -0800 Subject: [PATCH 10/13] Migrate should change the visual studio version --- src/dotnet/commands/dotnet-migrate/MigrateCommand.cs | 8 ++++++++ .../GivenThatIWantToMigrateSolutions.cs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index a814acd82..4b5f62249 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -20,6 +20,10 @@ namespace Microsoft.DotNet.Tools.Migrate { public partial class MigrateCommand { + private const string ProductDescription = "Visual Studio 15"; + private const string VisualStudioVersion = "15.0.26114.2"; + private const string MinimumVisualStudioVersion = "10.0.40219.1"; + private SlnFile _slnFile; private readonly DirectoryInfo _workspaceDirectory; private readonly string _templateFile; @@ -141,6 +145,10 @@ namespace Microsoft.DotNet.Tools.Migrate } } + _slnFile.ProductDescription = ProductDescription; + _slnFile.VisualStudioVersion = VisualStudioVersion; + _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; + _slnFile.Write(); foreach (var csprojFile in csprojFilesToAdd) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 08fdfca37..25621313c 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -64,6 +64,11 @@ namespace Microsoft.DotNet.Migration.Tests // .Should().Pass(); SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); + + slnFile.ProductDescription.Should().Be("Visual Studio 15"); ; + slnFile.VisualStudioVersion.Should().Be("15.0.26114.2"); + slnFile.MinimumVisualStudioVersion.Should().Be("10.0.40219.1"); + var nonSolutionFolderProjects = slnFile.Projects .Where(p => p.TypeGuid != ProjectTypeGuids.SolutionFolderGuid); From a5fb7862284c86f2a075aa15a0d15cfd8d3026f0 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 17 Jan 2017 14:48:54 -0800 Subject: [PATCH 11/13] Ensure we don't downgrade VS version --- .../PJAppWithSlnVersion14/Program.cs | 16 +++++++++ .../PJAppWithSlnVersion14/TestApp.sln | 23 +++++++++++++ .../PJAppWithSlnVersion14/TestApp.xproj | 18 ++++++++++ .../PJAppWithSlnVersion14/project.json | 26 ++++++++++++++ .../PJAppWithSlnVersion15/Program.cs | 16 +++++++++ .../PJAppWithSlnVersion15/TestApp.sln | 23 +++++++++++++ .../PJAppWithSlnVersion15/TestApp.xproj | 18 ++++++++++ .../PJAppWithSlnVersion15/project.json | 26 ++++++++++++++ .../PJAppWithSlnVersionUnknown/Program.cs | 16 +++++++++ .../PJAppWithSlnVersionUnknown/TestApp.sln | 23 +++++++++++++ .../PJAppWithSlnVersionUnknown/TestApp.xproj | 18 ++++++++++ .../PJAppWithSlnVersionUnknown/project.json | 26 ++++++++++++++ .../commands/dotnet-migrate/MigrateCommand.cs | 10 ++++-- .../GivenThatIWantToMigrateSolutions.cs | 34 ++++++++++++++++--- 14 files changed, 285 insertions(+), 8 deletions(-) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.sln create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.xproj create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.sln create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.xproj create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.sln create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.xproj create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/Program.cs new file mode 100644 index 000000000..e901ebc5c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/Program.cs @@ -0,0 +1,16 @@ +// 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; + +namespace TestApp +{ + public class Program + { + public static int Main(string[] args) + { + Console.WriteLine("Hello world"); + return 0; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.sln b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.sln new file mode 100644 index 000000000..3adf30d78 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}" +EndProject +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.xproj b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.xproj new file mode 100644 index 000000000..d18702195 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/TestApp.xproj @@ -0,0 +1,18 @@ + + + + 14.0.23107 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 0138cb8f-4aa9-4029-a21e-c07c30f425ba + TestAppWithContents + ..\..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\..\artifacts\ + + + 2.0 + + + diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/project.json new file mode 100644 index 000000000..166d41c2b --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion14/project.json @@ -0,0 +1,26 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.NETCore.App": "1.0.1" + }, + "frameworks": { + "netcoreapp1.0": {} + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {} + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/Program.cs new file mode 100644 index 000000000..e901ebc5c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/Program.cs @@ -0,0 +1,16 @@ +// 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; + +namespace TestApp +{ + public class Program + { + public static int Main(string[] args) + { + Console.WriteLine("Hello world"); + return 0; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.sln b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.sln new file mode 100644 index 000000000..88284045d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 Custom +VisualStudioVersion = 15.9.12345.4 +MinimumVisualStudioVersion = 10.9.1234.5 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}" +EndProject +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.xproj b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.xproj new file mode 100644 index 000000000..d18702195 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/TestApp.xproj @@ -0,0 +1,18 @@ + + + + 14.0.23107 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 0138cb8f-4aa9-4029-a21e-c07c30f425ba + TestAppWithContents + ..\..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\..\artifacts\ + + + 2.0 + + + diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/project.json new file mode 100644 index 000000000..166d41c2b --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersion15/project.json @@ -0,0 +1,26 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.NETCore.App": "1.0.1" + }, + "frameworks": { + "netcoreapp1.0": {} + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {} + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/Program.cs new file mode 100644 index 000000000..e901ebc5c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/Program.cs @@ -0,0 +1,16 @@ +// 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; + +namespace TestApp +{ + public class Program + { + public static int Main(string[] args) + { + Console.WriteLine("Hello world"); + return 0; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.sln b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.sln new file mode 100644 index 000000000..60722b8f3 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 16 +VisualStudioVersion = 14.0.unknown.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestApp.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}" +EndProject +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0138CB8F-4AA9-4029-A21E-C07C30F425BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.xproj b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.xproj new file mode 100644 index 000000000..d18702195 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/TestApp.xproj @@ -0,0 +1,18 @@ + + + + 14.0.23107 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 0138cb8f-4aa9-4029-a21e-c07c30f425ba + TestAppWithContents + ..\..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\..\artifacts\ + + + 2.0 + + + diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/project.json new file mode 100644 index 000000000..166d41c2b --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnVersionUnknown/project.json @@ -0,0 +1,26 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + "dependencies": { + "Microsoft.NETCore.App": "1.0.1" + }, + "frameworks": { + "netcoreapp1.0": {} + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {} + } +} diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index 4b5f62249..33527a108 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -145,9 +145,13 @@ namespace Microsoft.DotNet.Tools.Migrate } } - _slnFile.ProductDescription = ProductDescription; - _slnFile.VisualStudioVersion = VisualStudioVersion; - _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; + Version version; + if (!Version.TryParse(_slnFile.VisualStudioVersion, out version) || version.Major < 15) + { + _slnFile.ProductDescription = ProductDescription; + _slnFile.VisualStudioVersion = VisualStudioVersion; + _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; + } _slnFile.Write(); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 25621313c..6ea232b2f 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -13,6 +13,35 @@ namespace Microsoft.DotNet.Migration.Tests { public class GivenThatIWantToMigrateSolutions : TestBase { + [Theory] + [InlineData("PJAppWithSlnVersion14", "Visual Studio 15", "15.0.26114.2", "10.0.40219.1")] + [InlineData("PJAppWithSlnVersion15", "Visual Studio 15 Custom", "15.9.12345.4", "10.9.1234.5")] + [InlineData("PJAppWithSlnVersionUnknown", "Visual Studio 15", "15.0.26114.2", "10.0.40219.1")] + public void ItMigratesSlnAndEnsuresAtLeastVS15( + string projectName, + string productDescription, + string visualStudioVersion, + string minVisualStudioVersion) + { + var projectDirectory = TestAssets + .Get("NonRestoredTestProjects", projectName) + .CreateInstance() + .WithSourceFiles() + .Root; + + var solutionRelPath = "TestApp.sln"; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute($"migrate \"{solutionRelPath}\"") + .Should().Pass(); + + SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); + slnFile.ProductDescription.Should().Be(productDescription); + slnFile.VisualStudioVersion.Should().Be(visualStudioVersion); + slnFile.MinimumVisualStudioVersion.Should().Be(minVisualStudioVersion); + } + [Fact] public void ItMigratesAndBuildsSln() { @@ -64,11 +93,6 @@ namespace Microsoft.DotNet.Migration.Tests // .Should().Pass(); SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); - - slnFile.ProductDescription.Should().Be("Visual Studio 15"); ; - slnFile.VisualStudioVersion.Should().Be("15.0.26114.2"); - slnFile.MinimumVisualStudioVersion.Should().Be("10.0.40219.1"); - var nonSolutionFolderProjects = slnFile.Projects .Where(p => p.TypeGuid != ProjectTypeGuids.SolutionFolderGuid); From 964f0177d8db572565d66beef903f0e9cce550d7 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 17 Jan 2017 16:33:36 -0800 Subject: [PATCH 12/13] 20170117-4 --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 8fcaccd95..ec8e301c3 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,7 +3,7 @@ 15.1.0-preview-000523-01 2.0.0-rc3-61212-03 - 1.0.0-alpha-20170117-1 + 1.0.0-alpha-20170117-4 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 From 3e2b28f9eb9a22dc2cb95dc9bf1814d2c9dd11dd Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Wed, 18 Jan 2017 13:41:57 -0800 Subject: [PATCH 13/13] fix a warning in a test asset causing test failure --- .../TestProjects/MSBuildTestApp/MSBuildTestApp.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj index 9713f8d67..f4bc3f4d1 100644 --- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj +++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj @@ -5,12 +5,6 @@ win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64 - - - 1.0.3 - - - 1.0.0