From 337d579949989fbb272010f5cd19e52081253d1f Mon Sep 17 00:00:00 2001 From: "Rohit Agrawal (NUGET)" Date: Tue, 17 Jan 2017 11:08:17 -0800 Subject: [PATCH 01/88] update nuget and sdk to run a trial build --- .../dotnet-dependency-tool-invoker.csproj | 2 +- build/Microsoft.DotNet.Cli.BundledSdks.props | 2 +- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- build_projects/dotnet-cli-build/dotnet-cli-build.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.csproj | 8 ++++---- src/redist/redist.csproj | 2 +- src/tool_nuget/tool_nuget.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.Tests.csproj | 8 ++++---- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index a67ca793b..d3257128f 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -24,7 +24,7 @@ 1.0.3 - 4.0.0-rc3 + 4.0.0-rc3-2215 $(SdkNugetVersion) diff --git a/build/Microsoft.DotNet.Cli.BundledSdks.props b/build/Microsoft.DotNet.Cli.BundledSdks.props index baab92a0b..2898c04c4 100644 --- a/build/Microsoft.DotNet.Cli.BundledSdks.props +++ b/build/Microsoft.DotNet.Cli.BundledSdks.props @@ -2,7 +2,7 @@ - + diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 8fcaccd95..92af87970 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-2 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 diff --git a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj index 8e5ec2d2f..e3f47050e 100644 --- a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj +++ b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj @@ -41,7 +41,7 @@ 7.2.1 - 4.0.0-rc3 + 4.0.0-rc3-2215 $(CLI_MSBuild_Version) diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index ce5308d98..2bba88f6a 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -18,16 +18,16 @@ 1.0.1-beta-000933 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 $(CLI_MSBuild_Version) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 5c0c36e2d..ac79c9a39 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -15,7 +15,7 @@ $(CLI_MSBuild_Version) - 4.0.0-rc3 + 4.0.0-rc3-2215 $(CLI_TestPlatform_Version) diff --git a/src/tool_nuget/tool_nuget.csproj b/src/tool_nuget/tool_nuget.csproj index ef70fa8e6..74f1a5a58 100644 --- a/src/tool_nuget/tool_nuget.csproj +++ b/src/tool_nuget/tool_nuget.csproj @@ -10,7 +10,7 @@ 1.0.3 - 4.0.0-rc3 + 4.0.0-rc3-2215 diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj index c9d901f0d..38357b430 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj @@ -57,16 +57,16 @@ 4.1.1 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 - 4.0.0-rc3 + 4.0.0-rc3-2215 4.4.0-beta8 From b020b6f6b13953e3d7c476f4e2c32def6e123805 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 17 Jan 2017 16:26:20 -0800 Subject: [PATCH 02/88] Adding a workaround for the build failure. --- .../dotnet-desktop-and-portable.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 8a1e7d530..68045ef60 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -19,6 +19,10 @@ + + + + From 7802b957d3eecba00ad9830b8178b217bcdc4a01 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 18 Jan 2017 10:17:37 -0800 Subject: [PATCH 03/88] Adding a second workaround for the build failure. Same fix as the other one though. --- .../DependencyContextFromTool.csproj | 3 +++ src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj index 6a76893df..54a21a60a 100755 --- a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj +++ b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj @@ -18,6 +18,9 @@ 1.0.0-* + + + $(DefineConstants);RELEASE;TRACE true diff --git a/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs b/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs index a11e149cb..138256e9c 100644 --- a/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs +++ b/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs @@ -251,8 +251,6 @@ namespace Microsoft.DotNet.TestFramework var restoreArgs = new string[] { "restore", projFile.FullName }; var commandResult = Command.Create(_dotnetExeFile.FullName, restoreArgs) - .CaptureStdOut() - .CaptureStdErr() .Execute(); int exitCode = commandResult.ExitCode; @@ -267,6 +265,8 @@ namespace Microsoft.DotNet.TestFramework throw new Exception(message); } + + Console.WriteLine($"TestAsset Restore '{_assetName}' for {projFile.FullName} exited with {exitCode}"); } } From baecbd8d43d75784ef0b94d4c51c7a978995a7ff Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Fri, 20 Jan 2017 17:37:11 -0800 Subject: [PATCH 04/88] WIP --- .../NoSolutionItemsAfterMigration.sln | 39 +++++++ .../ReadmeSolutionItemAfterMigration.sln | 40 +++++++ .../TestApp/Program.cs | 15 +++ .../TestApp/TestApp.xproj | 18 ++++ .../TestApp/project.json | 26 +++++ .../global.json | 3 + .../readme.txt | 1 + .../commands/dotnet-migrate/MigrateCommand.cs | 18 ++++ .../GivenThatIWantToMigrateSolutions.cs | 100 ++++++++++++++++++ 9 files changed, 260 insertions(+) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/NoSolutionItemsAfterMigration.sln create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/ReadmeSolutionItemAfterMigration.sln create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/TestApp.xproj create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/global.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/readme.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/NoSolutionItemsAfterMigration.sln b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/NoSolutionItemsAfterMigration.sln new file mode 100644 index 000000000..da0ae5935 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/NoSolutionItemsAfterMigration.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26006.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.xproj", "{D65E5A1F-719F-4F95-8835-88BDD67AD457}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FAACC4BE-31AE-4EB7-A4C8-5BB4617EB4AF}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +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(ProjectConfigurationPlatforms) = postSolution + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/ReadmeSolutionItemAfterMigration.sln b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/ReadmeSolutionItemAfterMigration.sln new file mode 100644 index 000000000..05aecb75d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/ReadmeSolutionItemAfterMigration.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26006.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.xproj", "{D65E5A1F-719F-4F95-8835-88BDD67AD457}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FAACC4BE-31AE-4EB7-A4C8-5BB4617EB4AF}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + readme.txt = readme.txt + EndProjectSection +EndProject +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(ProjectConfigurationPlatforms) = postSolution + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/Program.cs new file mode 100644 index 000000000..2289ac741 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/Program.cs @@ -0,0 +1,15 @@ +// 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/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/TestApp.xproj b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/TestApp.xproj new file mode 100644 index 000000000..d18702195 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/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/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/project.json new file mode 100644 index 000000000..166d41c2b --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/TestApp/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/PJAppWithSlnAndSolutionItemsToMoveToBackup/global.json b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/global.json new file mode 100644 index 000000000..22936715c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "." ] +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/readme.txt b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/readme.txt new file mode 100644 index 000000000..6e3eb33f4 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndSolutionItemsToMoveToBackup/readme.txt @@ -0,0 +1 @@ +This is just for our test to verify that we do not remove the readme.txt link from the solution. diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index ab5875acc..00c620819 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -153,6 +153,8 @@ namespace Microsoft.DotNet.Tools.Migrate _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; } + RemoveReferencesToMigratedFiles(_slnFile); + _slnFile.Write(); foreach (var csprojFile in csprojFilesToAdd) @@ -161,6 +163,22 @@ namespace Microsoft.DotNet.Tools.Migrate } } + private void RemoveReferencesToMigratedFiles(SlnFile slnFile) + { + // TODO: Need to merge my PRs then I can call the ProjectCollection extension methods. + // And create new extension methods. + var solutionFolders = slnFile.Projects.Where(p => p.TypeGuid == ProjectTypeGuids.SolutionFolderGuid); + + foreach (var solutionFolder in solutionFolders) + { + var solutionItems = solutionFolder.Sections.GetSection("SolutionItems"); + if (solutionItems != null && solutionItems.Properties.ContainsKey("global.json")) + { + solutionItems.Properties.Remove("global.json"); + } + } + } + private void AddProject(string slnPath, string csprojPath) { List args = new List() diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 07f68b5b8..b93690e94 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -14,6 +14,83 @@ namespace Microsoft.DotNet.Migration.Tests { public class GivenThatIWantToMigrateSolutions : TestBase { + private const string ExpectedSlnFileAfterRemovingAllSolutionItems = @" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26006.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""TestApp"", ""TestApp\TestApp.csproj"", ""{D65E5A1F-719F-4F95-8835-88BDD67AD457}"" +EndProject +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(ProjectConfigurationPlatforms) = postSolution + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal +"; + + private const string ExpectedSlnFileAfterRemovingAllSolutionItemsExceptReadme = @" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26006.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""TestApp"", ""TestApp\TestApp.csproj"", ""{D65E5A1F-719F-4F95-8835-88BDD67AD457}"" +EndProject +Project(""{2150E333-8FDC-42A3-9474-1A3956D46DE8}"") = ""Solution Items"", ""Solution Items"", ""{FAACC4BE-31AE-4EB7-A4C8-5BB4617EB4AF}"" + ProjectSection(SolutionItems) = preProject + readme.txt = readme.txt + EndProjectSection +EndProject +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(ProjectConfigurationPlatforms) = postSolution + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 + {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal +"; + [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")] @@ -96,6 +173,29 @@ namespace Microsoft.DotNet.Migration.Tests "PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj"); } + [Theory] + [InlineData("NoSolutionItemsAfterMigration.sln", ExpectedSlnFileAfterRemovingAllSolutionItems)] + [InlineData("ReadmeSolutionItemAfterMigration.sln", ExpectedSlnFileAfterRemovingAllSolutionItemsExceptReadme)] + public void WhenMigratingAnSlnLinksReferencingItemsMovedToBackupAreRemoved( + string slnFileName, + string expectedSlnContents) + { + var projectDirectory = TestAssets + .Get("NonRestoredTestProjects", "PJAppWithSlnAndSolutionItemsToMoveToBackup") + .CreateInstance(Path.GetFileNameWithoutExtension(slnFileName)) + .WithSourceFiles() + .Root + .FullName; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute($"migrate \"{slnFileName}\"") + .Should().Pass(); + + File.ReadAllText(Path.Combine(projectDirectory, slnFileName)) + .Should().BeVisuallyEquivalentTo(expectedSlnContents); + } + private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") { var projectDirectory = TestAssets From 0edee4a37340fb469aaaa065088960882a14e4ed Mon Sep 17 00:00:00 2001 From: dasMulli Date: Sat, 21 Jan 2017 17:02:01 +0100 Subject: [PATCH 05/88] Fix in German translation for dotnet-add-reference --- .../dotnet-add-reference/xlf/LocalizableStrings.de.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-reference/xlf/LocalizableStrings.de.xlf b/src/dotnet/commands/dotnet-add/dotnet-add-reference/xlf/LocalizableStrings.de.xlf index becde7aba..ab216036c 100644 --- a/src/dotnet/commands/dotnet-add/dotnet-add-reference/xlf/LocalizableStrings.de.xlf +++ b/src/dotnet/commands/dotnet-add/dotnet-add-reference/xlf/LocalizableStrings.de.xlf @@ -10,7 +10,7 @@ Command to add project to project reference - Befehl zum Hinzufügen des Projekts zum Projektverweis + Befehl zum Hinzufügen eines Projekt-zu-Projekt-Verweises From a2088e26413160325dd8532b2b8497354e09ee8f Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Mon, 23 Jan 2017 13:01:58 -0800 Subject: [PATCH 06/88] Refactor and finish the feature --- src/dotnet/SlnFileExtensions.cs | 310 ++++++++++++++++++ .../commands/dotnet-migrate/MigrateCommand.cs | 10 +- src/dotnet/commands/dotnet-sln/add/Program.cs | 165 +--------- .../commands/dotnet-sln/remove/Program.cs | 121 +------ .../GivenThatIWantToMigrateSolutions.cs | 2 +- 5 files changed, 322 insertions(+), 286 deletions(-) create mode 100644 src/dotnet/SlnFileExtensions.cs diff --git a/src/dotnet/SlnFileExtensions.cs b/src/dotnet/SlnFileExtensions.cs new file mode 100644 index 000000000..fc8054ef8 --- /dev/null +++ b/src/dotnet/SlnFileExtensions.cs @@ -0,0 +1,310 @@ +// 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 Microsoft.Build.Construction; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; +using Microsoft.DotNet.Cli.Sln.Internal; +using Microsoft.DotNet.Cli.Utils; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Microsoft.DotNet.Tools.Common +{ + public static class SlnFileExtensions + { + public static void AddProject(this SlnFile slnFile, string fullProjectPath) + { + var relativeProjectPath = PathUtility.GetRelativePath( + PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory), + fullProjectPath); + + if (slnFile.Projects.Any((p) => + string.Equals(p.FilePath, relativeProjectPath, StringComparison.OrdinalIgnoreCase))) + { + Reporter.Output.WriteLine(string.Format( + CommonLocalizableStrings.SolutionAlreadyContainsProject, + slnFile.FullPath, + relativeProjectPath)); + } + else + { + var projectInstance = new ProjectInstance(fullProjectPath); + + var slnProject = new SlnProject + { + Id = projectInstance.GetProjectId(), + TypeGuid = projectInstance.GetProjectTypeGuid(), + Name = Path.GetFileNameWithoutExtension(relativeProjectPath), + FilePath = relativeProjectPath + }; + + slnFile.AddDefaultBuildConfigurations(slnProject); + + slnFile.AddSolutionFolders(slnProject); + + slnFile.Projects.Add(slnProject); + + Reporter.Output.WriteLine( + string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, relativeProjectPath)); + } + } + + public static void AddDefaultBuildConfigurations(this SlnFile slnFile, SlnProject slnProject) + { + var defaultConfigurations = new List() + { + "Debug|Any CPU", + "Debug|x64", + "Debug|x86", + "Release|Any CPU", + "Release|x64", + "Release|x86", + }; + + // NOTE: The order you create the sections determines the order they are written to the sln + // file. In the case of an empty sln file, in order to make sure the solution configurations + // section comes first we need to add it first. This doesn't affect correctness but does + // stop VS from re-ordering things later on. Since we are keeping the SlnFile class low-level + // it shouldn't care about the VS implementation details. That's why we handle this here. + AddDefaultSolutionConfigurations(defaultConfigurations, slnFile.SolutionConfigurationsSection); + AddDefaultProjectConfigurations( + defaultConfigurations, + slnFile.ProjectConfigurationsSection.GetOrCreatePropertySet(slnProject.Id)); + } + + private static void AddDefaultSolutionConfigurations( + List defaultConfigurations, + SlnPropertySet solutionConfigs) + { + foreach (var config in defaultConfigurations) + { + if (!solutionConfigs.ContainsKey(config)) + { + solutionConfigs[config] = config; + } + } + } + + private static void AddDefaultProjectConfigurations( + List defaultConfigurations, + SlnPropertySet projectConfigs) + { + foreach (var config in defaultConfigurations) + { + var activeCfgKey = $"{config}.ActiveCfg"; + if (!projectConfigs.ContainsKey(activeCfgKey)) + { + projectConfigs[activeCfgKey] = config; + } + + var build0Key = $"{config}.Build.0"; + if (!projectConfigs.ContainsKey(build0Key)) + { + projectConfigs[build0Key] = config; + } + } + } + + public static void AddSolutionFolders(this SlnFile slnFile, SlnProject slnProject) + { + var solutionFolders = slnProject.GetSolutionFoldersFromProject(); + + if (solutionFolders.Any()) + { + var nestedProjectsSection = slnFile.Sections.GetOrCreateSection( + "NestedProjects", + SlnSectionType.PreProcess); + + var pathToGuidMap = slnFile.GetSolutionFolderPaths(nestedProjectsSection.Properties); + + string parentDirGuid = null; + var solutionFolderHierarchy = string.Empty; + foreach (var dir in solutionFolders) + { + solutionFolderHierarchy = Path.Combine(solutionFolderHierarchy, dir); + if (pathToGuidMap.ContainsKey(solutionFolderHierarchy)) + { + parentDirGuid = pathToGuidMap[solutionFolderHierarchy]; + } + else + { + var solutionFolder = new SlnProject + { + Id = Guid.NewGuid().ToString("B").ToUpper(), + TypeGuid = ProjectTypeGuids.SolutionFolderGuid, + Name = dir, + FilePath = dir + }; + + slnFile.Projects.Add(solutionFolder); + + if (parentDirGuid != null) + { + nestedProjectsSection.Properties[solutionFolder.Id] = parentDirGuid; + } + parentDirGuid = solutionFolder.Id; + } + } + + nestedProjectsSection.Properties[slnProject.Id] = parentDirGuid; + } + } + + private static IDictionary GetSolutionFolderPaths( + this SlnFile slnFile, + SlnPropertySet nestedProjects) + { + var solutionFolderPaths = new Dictionary(); + + var solutionFolderProjects = slnFile.Projects.GetProjectsByType(ProjectTypeGuids.SolutionFolderGuid); + foreach (var slnProject in solutionFolderProjects) + { + var path = slnProject.FilePath; + var id = slnProject.Id; + while (nestedProjects.ContainsKey(id)) + { + id = nestedProjects[id]; + var parentSlnProject = solutionFolderProjects.Where(p => p.Id == id).Single(); + path = Path.Combine(parentSlnProject.FilePath, path); + } + + solutionFolderPaths[path] = slnProject.Id; + } + + return solutionFolderPaths; + } + + public static bool RemoveProject(this SlnFile slnFile, string projectPath) + { + var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath); + + var projectsToRemove = slnFile.Projects.Where((p) => + string.Equals(p.FilePath, projectPathNormalized, StringComparison.OrdinalIgnoreCase)).ToList(); + + bool projectRemoved = false; + if (projectsToRemove.Count == 0) + { + Reporter.Output.WriteLine(string.Format( + CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, + projectPath)); + } + else + { + foreach (var slnProject in projectsToRemove) + { + var buildConfigsToRemove = slnFile.ProjectConfigurationsSection.GetPropertySet(slnProject.Id); + if (buildConfigsToRemove != null) + { + slnFile.ProjectConfigurationsSection.Remove(buildConfigsToRemove); + } + + var nestedProjectsSection = slnFile.Sections.GetSection( + "NestedProjects", + SlnSectionType.PreProcess); + if (nestedProjectsSection != null && nestedProjectsSection.Properties.ContainsKey(slnProject.Id)) + { + nestedProjectsSection.Properties.Remove(slnProject.Id); + } + + slnFile.Projects.Remove(slnProject); + Reporter.Output.WriteLine( + string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, slnProject.FilePath)); + } + + projectRemoved = true; + } + + return projectRemoved; + } + + public static void RemoveEmptyConfigurationSections(this SlnFile slnFile) + { + if (slnFile.Projects.Count == 0) + { + var solutionConfigs = slnFile.Sections.GetSection("SolutionConfigurationPlatforms"); + if (solutionConfigs != null) + { + slnFile.Sections.Remove(solutionConfigs); + } + + var projectConfigs = slnFile.Sections.GetSection("ProjectConfigurationPlatforms"); + if (projectConfigs != null) + { + slnFile.Sections.Remove(projectConfigs); + } + } + } + + public static void RemoveEmptySolutionFolders(this SlnFile slnFile) + { + var solutionFolderProjects = slnFile.Projects + .GetProjectsByType(ProjectTypeGuids.SolutionFolderGuid) + .ToList(); + + if (solutionFolderProjects.Any()) + { + var nestedProjectsSection = slnFile.Sections.GetSection( + "NestedProjects", + SlnSectionType.PreProcess); + + if (nestedProjectsSection == null) + { + foreach (var solutionFolderProject in solutionFolderProjects) + { + if (solutionFolderProject.Sections.Count() == 0) + { + slnFile.Projects.Remove(solutionFolderProject); + } + } + } + else + { + var solutionFoldersInUse = slnFile.GetSolutionFoldersThatContainProjectsInItsHierarchy( + nestedProjectsSection.Properties); + + foreach (var solutionFolderProject in solutionFolderProjects) + { + if (!solutionFoldersInUse.Contains(solutionFolderProject.Id)) + { + nestedProjectsSection.Properties.Remove(solutionFolderProject.Id); + if (solutionFolderProject.Sections.Count() == 0) + { + slnFile.Projects.Remove(solutionFolderProject); + } + } + } + + if (nestedProjectsSection.IsEmpty) + { + slnFile.Sections.Remove(nestedProjectsSection); + } + } + } + } + + private static HashSet GetSolutionFoldersThatContainProjectsInItsHierarchy( + this SlnFile slnFile, + SlnPropertySet nestedProjects) + { + var solutionFoldersInUse = new HashSet(); + + var nonSolutionFolderProjects = slnFile.Projects.GetProjectsNotOfType( + ProjectTypeGuids.SolutionFolderGuid); + + foreach (var nonSolutionFolderProject in nonSolutionFolderProjects) + { + var id = nonSolutionFolderProject.Id; + while (nestedProjects.ContainsKey(id)) + { + id = nestedProjects[id]; + solutionFoldersInUse.Add(id); + } + } + + return solutionFoldersInUse; + } + } +} diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index 70c9cd68d..c76293d71 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -174,9 +174,7 @@ namespace Microsoft.DotNet.Tools.Migrate private void RemoveReferencesToMigratedFiles(SlnFile slnFile) { - // TODO: Need to merge my PRs then I can call the ProjectCollection extension methods. - // And create new extension methods. - var solutionFolders = slnFile.Projects.Where(p => p.TypeGuid == ProjectTypeGuids.SolutionFolderGuid); + var solutionFolders = slnFile.Projects.GetProjectsByType(ProjectTypeGuids.SolutionFolderGuid); foreach (var solutionFolder in solutionFolders) { @@ -184,8 +182,14 @@ namespace Microsoft.DotNet.Tools.Migrate if (solutionItems != null && solutionItems.Properties.ContainsKey("global.json")) { solutionItems.Properties.Remove("global.json"); + if (solutionItems.IsEmpty) + { + solutionFolder.Sections.Remove(solutionItems); + } } } + + slnFile.RemoveEmptySolutionFolders(); } private void AddProject(string slnPath, string csprojPath) diff --git a/src/dotnet/commands/dotnet-sln/add/Program.cs b/src/dotnet/commands/dotnet-sln/add/Program.cs index 889506662..6b6124a29 100644 --- a/src/dotnet/commands/dotnet-sln/add/Program.cs +++ b/src/dotnet/commands/dotnet-sln/add/Program.cs @@ -1,9 +1,6 @@ // 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 Microsoft.Build.Construction; -using Microsoft.Build.Evaluation; -using Microsoft.Build.Execution; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Sln.Internal; using Microsoft.DotNet.Cli.Utils; @@ -49,7 +46,7 @@ namespace Microsoft.DotNet.Tools.Sln.Add int preAddProjectCount = slnFile.Projects.Count; foreach (var fullProjectPath in fullProjectPaths) { - AddProject(slnFile, fullProjectPath); + slnFile.AddProject(fullProjectPath); } if (slnFile.Projects.Count > preAddProjectCount) @@ -59,165 +56,5 @@ namespace Microsoft.DotNet.Tools.Sln.Add return 0; } - - private void AddProject(SlnFile slnFile, string fullProjectPath) - { - var relativeProjectPath = PathUtility.GetRelativePath( - PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory), - fullProjectPath); - - if (slnFile.Projects.Any((p) => - string.Equals(p.FilePath, relativeProjectPath, StringComparison.OrdinalIgnoreCase))) - { - Reporter.Output.WriteLine(string.Format( - CommonLocalizableStrings.SolutionAlreadyContainsProject, - slnFile.FullPath, - relativeProjectPath)); - } - else - { - var projectInstance = new ProjectInstance(fullProjectPath); - - var slnProject = new SlnProject - { - Id = projectInstance.GetProjectId(), - TypeGuid = projectInstance.GetProjectTypeGuid(), - Name = Path.GetFileNameWithoutExtension(relativeProjectPath), - FilePath = relativeProjectPath - }; - - AddDefaultBuildConfigurations(slnFile, slnProject); - - AddSolutionFolders(slnFile, slnProject); - - slnFile.Projects.Add(slnProject); - - Reporter.Output.WriteLine( - string.Format(CommonLocalizableStrings.ProjectAddedToTheSolution, relativeProjectPath)); - } - } - - private void AddDefaultBuildConfigurations(SlnFile slnFile, SlnProject slnProject) - { - var defaultConfigurations = new List() - { - "Debug|Any CPU", - "Debug|x64", - "Debug|x86", - "Release|Any CPU", - "Release|x64", - "Release|x86", - }; - - // NOTE: The order you create the sections determines the order they are written to the sln - // file. In the case of an empty sln file, in order to make sure the solution configurations - // section comes first we need to add it first. This doesn't affect correctness but does - // stop VS from re-ordering things later on. Since we are keeping the SlnFile class low-level - // it shouldn't care about the VS implementation details. That's why we handle this here. - AddDefaultSolutionConfigurations(defaultConfigurations, slnFile.SolutionConfigurationsSection); - AddDefaultProjectConfigurations( - defaultConfigurations, - slnFile.ProjectConfigurationsSection.GetOrCreatePropertySet(slnProject.Id)); - } - - private void AddDefaultSolutionConfigurations( - List defaultConfigurations, - SlnPropertySet solutionConfigs) - { - foreach (var config in defaultConfigurations) - { - if (!solutionConfigs.ContainsKey(config)) - { - solutionConfigs[config] = config; - } - } - } - - private void AddDefaultProjectConfigurations( - List defaultConfigurations, - SlnPropertySet projectConfigs) - { - foreach (var config in defaultConfigurations) - { - var activeCfgKey = $"{config}.ActiveCfg"; - if (!projectConfigs.ContainsKey(activeCfgKey)) - { - projectConfigs[activeCfgKey] = config; - } - - var build0Key = $"{config}.Build.0"; - if (!projectConfigs.ContainsKey(build0Key)) - { - projectConfigs[build0Key] = config; - } - } - } - - private void AddSolutionFolders(SlnFile slnFile, SlnProject slnProject) - { - var solutionFolders = slnProject.GetSolutionFoldersFromProject(); - - if (solutionFolders.Any()) - { - var nestedProjectsSection = slnFile.Sections.GetOrCreateSection( - "NestedProjects", - SlnSectionType.PreProcess); - - var pathToGuidMap = GetSolutionFolderPaths(slnFile, nestedProjectsSection.Properties); - - string parentDirGuid = null; - var solutionFolderHierarchy = string.Empty; - foreach (var dir in solutionFolders) - { - solutionFolderHierarchy = Path.Combine(solutionFolderHierarchy, dir); - if (pathToGuidMap.ContainsKey(solutionFolderHierarchy)) - { - parentDirGuid = pathToGuidMap[solutionFolderHierarchy]; - } - else - { - var solutionFolder = new SlnProject - { - Id = Guid.NewGuid().ToString("B").ToUpper(), - TypeGuid = ProjectTypeGuids.SolutionFolderGuid, - Name = dir, - FilePath = dir - }; - - slnFile.Projects.Add(solutionFolder); - - if (parentDirGuid != null) - { - nestedProjectsSection.Properties[solutionFolder.Id] = parentDirGuid; - } - parentDirGuid = solutionFolder.Id; - } - } - - nestedProjectsSection.Properties[slnProject.Id] = parentDirGuid; - } - } - - private IDictionary GetSolutionFolderPaths(SlnFile slnFile, SlnPropertySet nestedProjects) - { - var solutionFolderPaths = new Dictionary(); - - var solutionFolderProjects = slnFile.Projects.GetProjectsByType(ProjectTypeGuids.SolutionFolderGuid); - foreach (var slnProject in solutionFolderProjects) - { - var path = slnProject.FilePath; - var id = slnProject.Id; - while (nestedProjects.ContainsKey(id)) - { - id = nestedProjects[id]; - var parentSlnProject = solutionFolderProjects.Where(p => p.Id == id).Single(); - path = Path.Combine(parentSlnProject.FilePath, path); - } - - solutionFolderPaths[path] = slnProject.Id; - } - - return solutionFolderPaths; - } } } diff --git a/src/dotnet/commands/dotnet-sln/remove/Program.cs b/src/dotnet/commands/dotnet-sln/remove/Program.cs index 18f3866e5..c147052cd 100644 --- a/src/dotnet/commands/dotnet-sln/remove/Program.cs +++ b/src/dotnet/commands/dotnet-sln/remove/Program.cs @@ -48,12 +48,12 @@ namespace Microsoft.DotNet.Tools.Sln.Remove bool slnChanged = false; foreach (var path in relativeProjectPaths) { - slnChanged |= RemoveProject(slnFile, path); + slnChanged |= slnFile.RemoveProject(path); } - RemoveEmptyConfigurationSections(slnFile); + slnFile.RemoveEmptyConfigurationSections(); - RemoveEmptySolutionFolders(slnFile); + slnFile.RemoveEmptySolutionFolders(); if (slnChanged) { @@ -62,120 +62,5 @@ namespace Microsoft.DotNet.Tools.Sln.Remove return 0; } - - private bool RemoveProject(SlnFile slnFile, string projectPath) - { - var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath); - - var projectsToRemove = slnFile.Projects.Where((p) => - string.Equals(p.FilePath, projectPathNormalized, StringComparison.OrdinalIgnoreCase)).ToList(); - - bool projectRemoved = false; - if (projectsToRemove.Count == 0) - { - Reporter.Output.WriteLine(string.Format( - CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, - projectPath)); - } - else - { - foreach (var slnProject in projectsToRemove) - { - var buildConfigsToRemove = slnFile.ProjectConfigurationsSection.GetPropertySet(slnProject.Id); - if (buildConfigsToRemove != null) - { - slnFile.ProjectConfigurationsSection.Remove(buildConfigsToRemove); - } - - var nestedProjectsSection = slnFile.Sections.GetSection( - "NestedProjects", - SlnSectionType.PreProcess); - if (nestedProjectsSection != null && nestedProjectsSection.Properties.ContainsKey(slnProject.Id)) - { - nestedProjectsSection.Properties.Remove(slnProject.Id); - } - - slnFile.Projects.Remove(slnProject); - Reporter.Output.WriteLine( - string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, slnProject.FilePath)); - } - - projectRemoved = true; - } - - return projectRemoved; - } - - private void RemoveEmptyConfigurationSections(SlnFile slnFile) - { - if (slnFile.Projects.Count == 0) - { - var solutionConfigs = slnFile.Sections.GetSection("SolutionConfigurationPlatforms"); - if (solutionConfigs != null) - { - slnFile.Sections.Remove(solutionConfigs); - } - - var projectConfigs = slnFile.Sections.GetSection("ProjectConfigurationPlatforms"); - if (projectConfigs != null) - { - slnFile.Sections.Remove(projectConfigs); - } - } - } - - private void RemoveEmptySolutionFolders(SlnFile slnFile) - { - var solutionFolderProjects = slnFile.Projects - .GetProjectsByType(ProjectTypeGuids.SolutionFolderGuid) - .ToList(); - - if (solutionFolderProjects.Any()) - { - var nestedProjectsSection = slnFile.Sections.GetSection( - "NestedProjects", - SlnSectionType.PreProcess); - - var solutionFoldersInUse = GetSolutionFoldersThatContainProjectsInItsHierarchy( - slnFile, - nestedProjectsSection.Properties); - - foreach (var solutionFolderProject in solutionFolderProjects) - { - if (!solutionFoldersInUse.Contains(solutionFolderProject.Id)) - { - slnFile.Projects.Remove(solutionFolderProject); - nestedProjectsSection.Properties.Remove(solutionFolderProject.Id); - } - } - - if (nestedProjectsSection.IsEmpty) - { - slnFile.Sections.Remove(nestedProjectsSection); - } - } - } - - private HashSet GetSolutionFoldersThatContainProjectsInItsHierarchy( - SlnFile slnFile, - SlnPropertySet nestedProjects) - { - var solutionFoldersInUse = new HashSet(); - - var nonSolutionFolderProjects = slnFile.Projects.GetProjectsNotOfType( - ProjectTypeGuids.SolutionFolderGuid); - - foreach (var nonSolutionFolderProject in nonSolutionFolderProjects) - { - var id = nonSolutionFolderProject.Id; - while (nestedProjects.ContainsKey(id)) - { - id = nestedProjects[id]; - solutionFoldersInUse.Add(id); - } - } - - return solutionFoldersInUse; - } } } diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index f70ce7c08..0a670cb7f 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -234,7 +234,7 @@ EndGlobal string expectedSlnContents) { var projectDirectory = TestAssets - .Get("NonRestoredTestProjects", "PJAppWithSlnAndSolutionItemsToMoveToBackup") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndSolutionItemsToMoveToBackup") .CreateInstance(Path.GetFileNameWithoutExtension(slnFileName)) .WithSourceFiles() .Root From aa0359cd9a7dfe94091e7cb86e1c21f554d7f4ae Mon Sep 17 00:00:00 2001 From: Arun Mahapatra Date: Tue, 24 Jan 2017 03:24:08 +0530 Subject: [PATCH 07/88] Insert test platform v15.0.0-preview-20170123-02 (#5426) * Insert test platform v15.0.0-preview-20160120-03. Remove OutputType from test project templates since it is automatically determined by Microsoft.NET.Test.Sdk. * Update testplatform v15.0.0-preview-20170123-02. --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- .../commands/dotnet-new/CSharp_Mstest/$projectName$.csproj | 3 +-- .../commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj | 3 +-- .../commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj | 3 +-- .../commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj | 3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index bc2c3ca66..b7ebc8f54 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,7 +6,7 @@ 1.0.0-alpha-20170117-4 4.0.0-rc3 1.0.0-alpha-20170120-3-249 - 15.0.0-preview-20170106-08 + 15.0.0-preview-20170123-02 1.0.0-beta1-20170108-83 diff --git a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj index 689b3f8f2..051122114 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj @@ -1,12 +1,11 @@ - Exe netcoreapp1.0 - + diff --git a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj index 1de3d53ff..22bf0da91 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj @@ -1,12 +1,11 @@ - Exe netcoreapp1.0 - + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj index 00636ee77..ec090fa88 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj @@ -1,7 +1,6 @@ - Exe netcoreapp1.0 false @@ -14,7 +13,7 @@ - + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj index 2197d2277..cbd1570f0 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj @@ -1,7 +1,6 @@ - Exe netcoreapp1.0 false @@ -14,7 +13,7 @@ - + From 6c623d9d98eba94666d64b55f7f80949e54cc92f Mon Sep 17 00:00:00 2001 From: Livar Date: Mon, 23 Jan 2017 20:19:53 -0800 Subject: [PATCH 08/88] Localizing MigrateCommand and fixing one string for dotnet test. (#5419) --- .../dotnet-migrate/LocalizableStrings.cs | 28 +++++++++++ .../commands/dotnet-migrate/MigrateCommand.cs | 46 +++++++++++++------ .../dotnet-test/LocalizableStrings.cs | 3 +- 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs b/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs index f443a269c..ca83f4387 100644 --- a/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs @@ -32,5 +32,33 @@ Defaults to current directory if nothing is specified."; public const string MigrationFailedError = "Migration failed."; public const string MigrationAdditionalHelp = "Your project has been migrated to the .csproj format and can be used with this build of the .NET Core Tools. Please visit https://aka.ms/coremigration to report issues or ask for help."; + + public const string MigrationReportSummary = "Summary"; + + public const string MigrationReportTotalProjects = "Total Projects: {0}"; + + public const string MigrationReportSucceededProjects = "Succeeded Projects: {0}"; + + public const string MigrationReportFailedProjects = "Failed Projects: {0}"; + + public const string ProjectMigrationSucceeded = "Project {0} migration succeeded ({1})."; + + public const string ProjectMigrationFailed = "Project {0} migration failed ({1})."; + + public const string MigrationFailedToFindProjectInGlobalJson = "Unable to find any projects in global.json."; + + public const string MigrationUnableToFindProjects = "Unable to find any projects in {0}."; + + public const string MigrationProjectJsonNotFound = "No project.json file found in '{0}'."; + + public const string MigrationInvalidProjectArgument = "Invalid project argument - '{0}' is not a project.json, global.json, or solution.sln file and a directory named '{0}' doesn't exist."; + + public const string MigratonUnableToFindProjectJson = "Unable to find project.json file at {0}."; + + public const string MigrationUnableToFindGlobalJson = "Unable to find global settings file at {0}."; + + public const string MigrationUnableToFindSolutionFile = "Unable to find the solution file at {0}."; + + public const string MigrateFilesBackupLocation = "Files backed up to {0}"; } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index bc7e6b444..34c8bbc53 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -214,7 +214,9 @@ namespace Microsoft.DotNet.Tools.Migrate backupPlan.PerformBackup(); - Reporter.Output.WriteLine($"Files backed up to {backupPlan.RootBackupDirectory.FullName}"); + Reporter.Output.WriteLine(string.Format( + LocalizableStrings.MigrateFilesBackupLocation, + backupPlan.RootBackupDirectory.FullName)); } private void WriteReport(MigrationReport migrationReport) @@ -285,10 +287,15 @@ namespace Microsoft.DotNet.Tools.Migrate { StringBuilder sb = new StringBuilder(); - sb.AppendLine("Summary"); - sb.AppendLine($"Total Projects: {migrationReport.MigratedProjectsCount}"); - sb.AppendLine($"Succeeded Projects: {migrationReport.SucceededProjectsCount}"); - sb.AppendLine($"Failed Projects: {migrationReport.FailedProjectsCount}"); + sb.AppendLine(LocalizableStrings.MigrationReportSummary); + sb.AppendLine( + string.Format(LocalizableStrings.MigrationReportTotalProjects, migrationReport.MigratedProjectsCount)); + sb.AppendLine(string.Format( + LocalizableStrings.MigrationReportSucceededProjects, + migrationReport.SucceededProjectsCount)); + sb.AppendLine(string.Format( + LocalizableStrings.MigrationReportFailedProjects, + migrationReport.FailedProjectsCount)); return sb.ToString(); } @@ -296,7 +303,10 @@ namespace Microsoft.DotNet.Tools.Migrate private string GetProjectReportSuccessContent(ProjectMigrationReport projectMigrationReport, bool colored) { Func GreenIfColored = (str) => colored ? str.Green() : str; - return GreenIfColored($"Project {projectMigrationReport.ProjectName} migration succeeded ({projectMigrationReport.ProjectDirectory})"); + return GreenIfColored(string.Format( + LocalizableStrings.ProjectMigrationSucceeded, + projectMigrationReport.ProjectName, + projectMigrationReport.ProjectDirectory)); } private string GetProjectReportErrorContent(ProjectMigrationReport projectMigrationReport, bool colored) @@ -306,7 +316,10 @@ namespace Microsoft.DotNet.Tools.Migrate if (projectMigrationReport.Errors.Any()) { - sb.AppendLine(RedIfColored($"Project {projectMigrationReport.ProjectName} migration failed ({projectMigrationReport.ProjectDirectory})")); + sb.AppendLine(RedIfColored(string.Format( + LocalizableStrings.ProjectMigrationFailed, + projectMigrationReport.ProjectName, + projectMigrationReport.ProjectDirectory))); foreach (var error in projectMigrationReport.Errors.Select(e => e.GetFormattedErrorMessage())) { @@ -336,7 +349,7 @@ namespace Microsoft.DotNet.Tools.Migrate if (!projects.Any()) { - throw new GracefulException("Unable to find any projects in global.json"); + throw new GracefulException(LocalizableStrings.MigrationFailedToFindProjectInGlobalJson); } } else if (File.Exists(projectArg) && @@ -346,7 +359,8 @@ namespace Microsoft.DotNet.Tools.Migrate if (!projects.Any()) { - throw new GracefulException($"Unable to find any projects in {projectArg}"); + throw new GracefulException( + string.Format(LocalizableStrings.MigrationUnableToFindProjects, projectArg)); } } else if (Directory.Exists(projectArg)) @@ -355,12 +369,14 @@ namespace Microsoft.DotNet.Tools.Migrate if (!projects.Any()) { - throw new GracefulException($"No project.json file found in '{projectArg}'"); + throw new GracefulException( + string.Format(LocalizableStrings.MigrationProjectJsonNotFound, projectArg)); } } else { - throw new GracefulException($"Invalid project argument - '{projectArg}' is not a project.json, global.json, or solution.sln file and a directory named '{projectArg}' doesn't exist."); + throw new GracefulException( + string.Format(LocalizableStrings.MigrationInvalidProjectArgument, projectArg)); } foreach (var project in projects) @@ -386,7 +402,7 @@ namespace Microsoft.DotNet.Tools.Migrate return projectJson; } - throw new GracefulException($"Unable to find project file at {projectJson}"); + throw new GracefulException(string.Format(LocalizableStrings.MigratonUnableToFindProjectJson, projectJson)); } private IEnumerable GetProjectsFromGlobalJson(string globalJson) @@ -418,7 +434,8 @@ namespace Microsoft.DotNet.Tools.Migrate { if (!File.Exists(globalJson)) { - throw new GracefulException($"Unable to find global settings file at {globalJson}"); + throw new GracefulException( + string.Format(LocalizableStrings.MigrationUnableToFindGlobalJson, globalJson)); } var globalJsonDirectory = Path.GetDirectoryName(globalJson); @@ -429,7 +446,8 @@ namespace Microsoft.DotNet.Tools.Migrate { if (!File.Exists(slnPath)) { - throw new GracefulException($"Unable to find the solution file at {slnPath}"); + throw new GracefulException( + string.Format(LocalizableStrings.MigrationUnableToFindSolutionFile, slnPath)); } _slnFile = SlnFile.Read(slnPath); diff --git a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs index af567dceb..16159aa0f 100644 --- a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs @@ -55,7 +55,8 @@ public const string RunSettingsArgsHelpText = @"Any extra commandline runsettings arguments that should be passed to vstest. See 'dotnet vstest --help' for available options. Example: -- RunConfiguration.ResultsDirectory=""C:\users\user\desktop\Results Directory"" MSTest.DeploymentEnabled=false"; - public const string CmdResultsDirectoryDescription = @"Test results directory will be created in specified path if not exists. + + public const string CmdResultsDirectoryDescription = @"The test results directory will be created in the specified path if it does not exist. Example: --results-directory "; } } From 872e96cfe2fe047d545de8215045d9e06c42a9b1 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Mon, 23 Jan 2017 20:21:58 -0800 Subject: [PATCH 09/88] Update version of Microsoft.AspNetCore.Mvc --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- .../commands/dotnet-new/CSharp_Web/$projectName$.csproj | 2 +- .../commands/dotnet-new/CSharp_Web1.1/$projectName$.csproj | 4 ++-- .../commands/dotnet-new/FSharp_Web/$projectName$.fsproj | 2 +- .../New3/GivenThatIWantANewAppWithSpecifiedType.cs | 4 ---- .../GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | 4 ++-- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 5c7bfc396..98e6b47ad 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,6 +6,6 @@ 1.0.0-alpha-20170118-3 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 - 1.0.0-beta1-20170108-83 + 1.0.0-beta1-20170123-94 diff --git a/src/dotnet/commands/dotnet-new/CSharp_Web/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Web/$projectName$.csproj index 35d10cc4c..fe8e903d9 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Web/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Web/$projectName$.csproj @@ -9,6 +9,6 @@ - + diff --git a/src/dotnet/commands/dotnet-new/CSharp_Web1.1/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Web1.1/$projectName$.csproj index 17ceafd29..d47c2a3c4 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Web1.1/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Web1.1/$projectName$.csproj @@ -6,9 +6,9 @@ - + - + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Web/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Web/$projectName$.fsproj index 6c1ac726b..5d64ddfc6 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Web/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Web/$projectName$.fsproj @@ -20,7 +20,7 @@ - + diff --git a/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs index b61565d83..e680f6270 100644 --- a/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs @@ -41,10 +41,6 @@ namespace Microsoft.DotNet.New3.Tests File.Copy("NuGet.tempaspnetpatch.config", Path.Combine(rootPath, "NuGet.Config")); } - string globalJsonPath = Path.Combine(rootPath, "global.json"); - Assert.True(File.Exists(globalJsonPath)); - Assert.Contains(Product.Version, File.ReadAllText(globalJsonPath)); - new TestCommand("dotnet") .WithWorkingDirectory(rootPath) .Execute($"restore") diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 9fe46af73..43b7fbe37 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -82,7 +82,7 @@ A command is running to initially populate your local package cache, to improve { _nugetCacheFolder .Should() - .HaveFile($"{GetDotnetVersion()}.dotnetSentinel"); + .HaveFile($"{GetDotnetVersion()}.dotnetSentinel"); } [Fact] @@ -116,7 +116,7 @@ A command is running to initially populate your local package cache, to improve _nugetCacheFolder .GetDirectory("microsoft.aspnetcore.mvc") - .Should().HaveDirectories(new string[] { "1.0.2", "1.1.0" }); + .Should().HaveDirectories(new string[] { "1.0.2", "1.1.1" }); } private string GetDotnetVersion() From b31b2f429d1df8ae42a8f7eeedf2645f83c2edb9 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Tue, 24 Jan 2017 00:43:47 -0800 Subject: [PATCH 10/88] Add NuGet feed --- NuGet.Config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.Config b/NuGet.Config index 559db7b79..64da20cde 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,6 +3,7 @@ + From ad8710decc8357e03a6c885b44bb40538318cefd Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 24 Jan 2017 01:14:35 -0800 Subject: [PATCH 11/88] SDK 20170123-1 (#5434) * Revert "Merge pull request #5362 from dotnet/ragrawal/updatesdktrial" This reverts commit 4e0b465093fd548a49a23b7e47c5c7ed286b0d7a. * bump SDK to 20170123-1 --- .../dotnet-dependency-tool-invoker.csproj | 2 +- .../dotnet-desktop-and-portable.csproj | 4 ---- .../DependencyContextFromTool.csproj | 3 --- build/Microsoft.DotNet.Cli.BundledSdks.props | 2 +- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- build_projects/dotnet-cli-build/dotnet-cli-build.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.csproj | 8 ++++---- src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs | 4 ++-- src/redist/redist.csproj | 2 +- src/tool_nuget/tool_nuget.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.Tests.csproj | 8 ++++---- 11 files changed, 16 insertions(+), 23 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index d3257128f..a67ca793b 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -24,7 +24,7 @@ 1.0.3 - 4.0.0-rc3-2215 + 4.0.0-rc3 $(SdkNugetVersion) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 68045ef60..8a1e7d530 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -19,10 +19,6 @@ - - - - diff --git a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj index 54a21a60a..6a76893df 100755 --- a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj +++ b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj @@ -18,9 +18,6 @@ 1.0.0-* - - - $(DefineConstants);RELEASE;TRACE true diff --git a/build/Microsoft.DotNet.Cli.BundledSdks.props b/build/Microsoft.DotNet.Cli.BundledSdks.props index 2898c04c4..baab92a0b 100644 --- a/build/Microsoft.DotNet.Cli.BundledSdks.props +++ b/build/Microsoft.DotNet.Cli.BundledSdks.props @@ -2,7 +2,7 @@ - + diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 5c7bfc396..c470a66b3 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-20170118-3 + 1.0.0-alpha-20170123-1 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 1.0.0-beta1-20170108-83 diff --git a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj index e3f47050e..8e5ec2d2f 100644 --- a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj +++ b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj @@ -41,7 +41,7 @@ 7.2.1 - 4.0.0-rc3-2215 + 4.0.0-rc3 $(CLI_MSBuild_Version) diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index 2bba88f6a..ce5308d98 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -18,16 +18,16 @@ 1.0.1-beta-000933 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 $(CLI_MSBuild_Version) diff --git a/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs b/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs index 138256e9c..a11e149cb 100644 --- a/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs +++ b/src/Microsoft.DotNet.TestFramework/TestAssetInfo.cs @@ -251,6 +251,8 @@ namespace Microsoft.DotNet.TestFramework var restoreArgs = new string[] { "restore", projFile.FullName }; var commandResult = Command.Create(_dotnetExeFile.FullName, restoreArgs) + .CaptureStdOut() + .CaptureStdErr() .Execute(); int exitCode = commandResult.ExitCode; @@ -265,8 +267,6 @@ namespace Microsoft.DotNet.TestFramework throw new Exception(message); } - - Console.WriteLine($"TestAsset Restore '{_assetName}' for {projFile.FullName} exited with {exitCode}"); } } diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index ac79c9a39..5c0c36e2d 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -15,7 +15,7 @@ $(CLI_MSBuild_Version) - 4.0.0-rc3-2215 + 4.0.0-rc3 $(CLI_TestPlatform_Version) diff --git a/src/tool_nuget/tool_nuget.csproj b/src/tool_nuget/tool_nuget.csproj index 74f1a5a58..ef70fa8e6 100644 --- a/src/tool_nuget/tool_nuget.csproj +++ b/src/tool_nuget/tool_nuget.csproj @@ -10,7 +10,7 @@ 1.0.3 - 4.0.0-rc3-2215 + 4.0.0-rc3 diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj index 38357b430..c9d901f0d 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj @@ -57,16 +57,16 @@ 4.1.1 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 - 4.0.0-rc3-2215 + 4.0.0-rc3 4.4.0-beta8 From 131c63ae276cc253af56c63a798a33a1179d7af7 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 24 Jan 2017 02:30:24 -0800 Subject: [PATCH 12/88] Generate lzma nuget.config when needed --- NuGet.Config | 1 - .../Microsoft.DotNet.Cli.LzmaArchive.targets | 17 +++++++++++++++++ .../dotnet-cli-build/DotNetRestore.cs | 14 +++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 64da20cde..559db7b79 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,7 +3,6 @@ - diff --git a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets index 06456c755..f267e7394 100644 --- a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets +++ b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets @@ -67,15 +67,31 @@ + + + <configuration> + <packageSources> + <add key="configurable.source" value="%CLI_LZMA_PACKAGE_SOURCE%" /> + </packageSources> + </configuration> + + $(NuGetPackagesArchiveProject)/Nuget.config + + + + @@ -85,6 +101,7 @@ WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" /> diff --git a/build_projects/dotnet-cli-build/DotNetRestore.cs b/build_projects/dotnet-cli-build/DotNetRestore.cs index d3f1a2b4d..05e531dea 100644 --- a/build_projects/dotnet-cli-build/DotNetRestore.cs +++ b/build_projects/dotnet-cli-build/DotNetRestore.cs @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } + get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetIgnoreMissingSources()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } } public string ConfigFile { get; set; } @@ -26,6 +26,8 @@ namespace Microsoft.DotNet.Cli.Build public string Packages { get; set; } public bool SkipInvalidConfigurations { get; set; } + + public bool IgnoreMissingSources { get; set; } public string Runtime { get; set; } @@ -78,6 +80,16 @@ namespace Microsoft.DotNet.Cli.Build return null; } + + private string GetIgnoreMissingSources() + { + if (IgnoreMissingSources) + { + return "--ignore-failed-sources"; + } + + return null; + } private string GetRuntime() { From f4f325f1d51dba0c6795494e4b118fb353babb73 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 24 Jan 2017 02:36:04 -0800 Subject: [PATCH 13/88] Cleanup --- .../Microsoft.DotNet.Cli.LzmaArchive.targets | 2 -- build_projects/dotnet-cli-build/DotNetRestore.cs | 14 +------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets index f267e7394..a785e7b3c 100644 --- a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets +++ b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets @@ -91,7 +91,6 @@ WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" /> @@ -101,7 +100,6 @@ WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" /> diff --git a/build_projects/dotnet-cli-build/DotNetRestore.cs b/build_projects/dotnet-cli-build/DotNetRestore.cs index 05e531dea..d3f1a2b4d 100644 --- a/build_projects/dotnet-cli-build/DotNetRestore.cs +++ b/build_projects/dotnet-cli-build/DotNetRestore.cs @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetIgnoreMissingSources()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } + get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } } public string ConfigFile { get; set; } @@ -26,8 +26,6 @@ namespace Microsoft.DotNet.Cli.Build public string Packages { get; set; } public bool SkipInvalidConfigurations { get; set; } - - public bool IgnoreMissingSources { get; set; } public string Runtime { get; set; } @@ -80,16 +78,6 @@ namespace Microsoft.DotNet.Cli.Build return null; } - - private string GetIgnoreMissingSources() - { - if (IgnoreMissingSources) - { - return "--ignore-failed-sources"; - } - - return null; - } private string GetRuntime() { From 731ab92c1fd9ba7ac0fb15ed6fb2f79723bacb45 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 24 Jan 2017 10:57:07 -0800 Subject: [PATCH 14/88] Update the test --- .../GivenThatIWantToMigrateSolutions.cs | 99 ++++--------------- 1 file changed, 17 insertions(+), 82 deletions(-) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 0a670cb7f..cbfa8ba50 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -14,83 +14,6 @@ namespace Microsoft.DotNet.Migration.Tests { public class GivenThatIWantToMigrateSolutions : TestBase { - private const string ExpectedSlnFileAfterRemovingAllSolutionItems = @" -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26006.2 -MinimumVisualStudioVersion = 10.0.40219.1 -Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""TestApp"", ""TestApp\TestApp.csproj"", ""{D65E5A1F-719F-4F95-8835-88BDD67AD457}"" -EndProject -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(ProjectConfigurationPlatforms) = postSolution - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -"; - - private const string ExpectedSlnFileAfterRemovingAllSolutionItemsExceptReadme = @" -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26006.2 -MinimumVisualStudioVersion = 10.0.40219.1 -Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""TestApp"", ""TestApp\TestApp.csproj"", ""{D65E5A1F-719F-4F95-8835-88BDD67AD457}"" -EndProject -Project(""{2150E333-8FDC-42A3-9474-1A3956D46DE8}"") = ""Solution Items"", ""Solution Items"", ""{FAACC4BE-31AE-4EB7-A4C8-5BB4617EB4AF}"" - ProjectSection(SolutionItems) = preProject - readme.txt = readme.txt - EndProjectSection -EndProject -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(ProjectConfigurationPlatforms) = postSolution - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.ActiveCfg = Debug|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x64.Build.0 = Debug|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.ActiveCfg = Debug|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Debug|x86.Build.0 = Debug|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|Any CPU.Build.0 = Release|Any CPU - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.ActiveCfg = Release|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x64.Build.0 = Release|x64 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.ActiveCfg = Release|x86 - {D65E5A1F-719F-4F95-8835-88BDD67AD457}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -"; - [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")] @@ -227,11 +150,11 @@ EndGlobal } [Theory] - [InlineData("NoSolutionItemsAfterMigration.sln", ExpectedSlnFileAfterRemovingAllSolutionItems)] - [InlineData("ReadmeSolutionItemAfterMigration.sln", ExpectedSlnFileAfterRemovingAllSolutionItemsExceptReadme)] + [InlineData("NoSolutionItemsAfterMigration.sln", false)] + [InlineData("ReadmeSolutionItemAfterMigration.sln", true)] public void WhenMigratingAnSlnLinksReferencingItemsMovedToBackupAreRemoved( string slnFileName, - string expectedSlnContents) + bool solutionItemsContainsReadme) { var projectDirectory = TestAssets .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndSolutionItemsToMoveToBackup") @@ -245,8 +168,20 @@ EndGlobal .Execute($"migrate \"{slnFileName}\"") .Should().Pass(); - File.ReadAllText(Path.Combine(projectDirectory, slnFileName)) - .Should().BeVisuallyEquivalentTo(expectedSlnContents); + var slnFile = SlnFile.Read(Path.Combine(projectDirectory, slnFileName)); + var solutionFolders = slnFile.Projects.Where(p => p.TypeGuid == ProjectTypeGuids.SolutionFolderGuid); + if (solutionItemsContainsReadme) + { + solutionFolders.Count().Should().Be(1); + var solutionItems = solutionFolders.Single().Sections.GetSection("SolutionItems"); + solutionItems.Should().NotBeNull(); + solutionItems.Properties.Count().Should().Be(1); + solutionItems.Properties["readme.txt"].Should().Be("readme.txt"); + } + else + { + solutionFolders.Count().Should().Be(0); + } } private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") From d522a973189cd7fce04d280acaa438a3a801a775 Mon Sep 17 00:00:00 2001 From: Zlatko Knezevic Date: Tue, 24 Jan 2017 11:40:39 -0800 Subject: [PATCH 15/88] Update LocalizableStrings.cs Change the migration after-process message with the link. --- src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs b/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs index ca83f4387..feb594fc8 100644 --- a/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-migrate/LocalizableStrings.cs @@ -31,7 +31,7 @@ Defaults to current directory if nothing is specified."; public const string MigrationFailedError = "Migration failed."; - public const string MigrationAdditionalHelp = "Your project has been migrated to the .csproj format and can be used with this build of the .NET Core Tools. Please visit https://aka.ms/coremigration to report issues or ask for help."; + public const string MigrationAdditionalHelp = "The project migration has finished. Please visit https://aka.ms/coremigration to report any issues you've encountered or ask for help."; public const string MigrationReportSummary = "Summary"; @@ -61,4 +61,4 @@ Defaults to current directory if nothing is specified."; public const string MigrateFilesBackupLocation = "Files backed up to {0}"; } -} \ No newline at end of file +} From 861d1edfd36dec214126191cc6890528bd2608a4 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 24 Jan 2017 15:02:19 -0800 Subject: [PATCH 16/88] Address PR comments --- src/dotnet/SlnFileExtensions.cs | 22 +++++++++++++++++++- src/dotnet/SlnProjectCollectionExtensions.cs | 2 +- src/dotnet/SlnProjectExtensions.cs | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/dotnet/SlnFileExtensions.cs b/src/dotnet/SlnFileExtensions.cs index fc8054ef8..7fbf0fb70 100644 --- a/src/dotnet/SlnFileExtensions.cs +++ b/src/dotnet/SlnFileExtensions.cs @@ -13,10 +13,15 @@ using System.Linq; namespace Microsoft.DotNet.Tools.Common { - public static class SlnFileExtensions + internal static class SlnFileExtensions { public static void AddProject(this SlnFile slnFile, string fullProjectPath) { + if (string.IsNullOrEmpty(fullProjectPath)) + { + throw new ArgumentException(); + } + var relativeProjectPath = PathUtility.GetRelativePath( PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory), fullProjectPath); @@ -54,6 +59,11 @@ namespace Microsoft.DotNet.Tools.Common public static void AddDefaultBuildConfigurations(this SlnFile slnFile, SlnProject slnProject) { + if (slnProject == null) + { + throw new ArgumentException(); + } + var defaultConfigurations = new List() { "Debug|Any CPU", @@ -110,6 +120,11 @@ namespace Microsoft.DotNet.Tools.Common public static void AddSolutionFolders(this SlnFile slnFile, SlnProject slnProject) { + if (slnProject == null) + { + throw new ArgumentException(); + } + var solutionFolders = slnProject.GetSolutionFoldersFromProject(); if (solutionFolders.Any()) @@ -179,6 +194,11 @@ namespace Microsoft.DotNet.Tools.Common public static bool RemoveProject(this SlnFile slnFile, string projectPath) { + if (string.IsNullOrEmpty(projectPath)) + { + throw new ArgumentException(); + } + var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath); var projectsToRemove = slnFile.Projects.Where((p) => diff --git a/src/dotnet/SlnProjectCollectionExtensions.cs b/src/dotnet/SlnProjectCollectionExtensions.cs index d99b34eee..09499e5a2 100644 --- a/src/dotnet/SlnProjectCollectionExtensions.cs +++ b/src/dotnet/SlnProjectCollectionExtensions.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Microsoft.DotNet.Tools.Common { - public static class SlnProjectCollectionExtensions + internal static class SlnProjectCollectionExtensions { public static IEnumerable GetProjectsByType( this SlnProjectCollection projects, diff --git a/src/dotnet/SlnProjectExtensions.cs b/src/dotnet/SlnProjectExtensions.cs index 925089beb..80ebf5d3e 100644 --- a/src/dotnet/SlnProjectExtensions.cs +++ b/src/dotnet/SlnProjectExtensions.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Microsoft.DotNet.Tools.Common { - public static class SlnProjectExtensions + internal static class SlnProjectExtensions { public static IList GetSolutionFoldersFromProject(this SlnProject project) { From 15930fac0f2da6f87a2678b35c62ba2f4d93a6e4 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 24 Jan 2017 14:42:09 -0600 Subject: [PATCH 17/88] Fix build with latest stage0. --- TestAssets/TestPackages/NuGet.Config | 6 ++++++ build/Microsoft.DotNet.Cli.Test.targets | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 TestAssets/TestPackages/NuGet.Config diff --git a/TestAssets/TestPackages/NuGet.Config b/TestAssets/TestPackages/NuGet.Config new file mode 100644 index 000000000..0750578cb --- /dev/null +++ b/TestAssets/TestPackages/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index 59ec2aae9..15744a5c3 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -97,7 +97,6 @@ From 7cb76c2ade78d1e8bdf566deaff944aded06e20b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 24 Jan 2017 17:56:28 -0600 Subject: [PATCH 18/88] Update run-build to install the latest stage0 from the rel-1.0.0 channel. --- run-build.ps1 | 4 ++-- run-build.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 3e16346ce..c035eb343 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -103,8 +103,8 @@ if ($LastExitCode -ne 0) # install the post-PJnistic stage0 $dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1" -Write-Host "$dotnetInstallPath -Version ""1.0.0-preview5-004422"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -Version ""1.0.0-preview5-004422"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Write-Host "$dotnetInstallPath -Channel ""rel-1.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Invoke-Expression "$dotnetInstallPath -Channel ""rel-1.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" diff --git a/run-build.sh b/run-build.sh index 399099364..5eb8e7ed2 100755 --- a/run-build.sh +++ b/run-build.sh @@ -163,8 +163,8 @@ if [ $? != 0 ]; then fi # now execute the script -echo "installing CLI: $dotnetInstallPath --version \"1.0.0-preview5-004422\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" -$dotnetInstallPath --version "1.0.0-preview5-004422" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" +echo "installing CLI: $dotnetInstallPath --channel \"rel-1.0.0\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" +$dotnetInstallPath --channel "rel-1.0.0" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" if [ $? != 0 ]; then echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $?." >&2 exit $? From 93651da836541a977de69e1b88395ff97a5a64eb Mon Sep 17 00:00:00 2001 From: Abhitej Anoop John Bandi Date: Wed, 25 Jan 2017 19:44:50 +0530 Subject: [PATCH 19/88] Updating the MSTest nugets with the ones shipping in VS for desktop and UWP scenarios. --- .../commands/dotnet-new/CSharp_Mstest/$projectName$.csproj | 4 ++-- .../commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj index 051122114..229580c09 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj index ec090fa88..fbccc158c 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj @@ -14,8 +14,8 @@ - - + + From e17c44edddbbee129c69739b351db97f810ee27d Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Wed, 25 Jan 2017 09:53:59 -0800 Subject: [PATCH 20/88] WIP --- .../ProjectReader.cs | 263 +++++++++++++++--- .../ProjectMigrator.cs | 9 +- 2 files changed, 234 insertions(+), 38 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs index 57583883e..50802ac70 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs @@ -809,50 +809,243 @@ namespace Microsoft.DotNet.Internal.ProjectModel private static void AddProjectFilesCollectionDiagnostics(JObject rawProject, Project project) { - var compileWarning = "'compile' in 'buildOptions'"; - AddDiagnosticMesage(rawProject, project, "compile", compileWarning); - AddDiagnosticMesage(rawProject, project, "compileExclude", compileWarning); - AddDiagnosticMesage(rawProject, project, "compileFiles", compileWarning); - AddDiagnosticMesage(rawProject, project, "compileBuiltIn", compileWarning); + ConvertDeprecatedCompileOptions(rawProject, project); + ConvertDeprecatedContentOptions(rawProject, project); + ConvertDeprecatedResourceOptions(rawProject, project); - var resourceWarning = "'embed' in 'buildOptions'"; - AddDiagnosticMesage(rawProject, project, "resource", resourceWarning); - AddDiagnosticMesage(rawProject, project, "resourceExclude", resourceWarning); - AddDiagnosticMesage(rawProject, project, "resourceFiles", resourceWarning); - AddDiagnosticMesage(rawProject, project, "resourceBuiltIn", resourceWarning); - AddDiagnosticMesage(rawProject, project, "namedResource", resourceWarning); + ConvertFromDeprecatedFormat( + rawProject, + project, + "'files' in 'packOptions'", + "packInclude", + new string[] { "packOptions" }, + "files"); - var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output"; - AddDiagnosticMesage(rawProject, project, "content", contentWarning); - AddDiagnosticMesage(rawProject, project, "contentExclude", contentWarning); - AddDiagnosticMesage(rawProject, project, "contentFiles", contentWarning); - AddDiagnosticMesage(rawProject, project, "contentBuiltIn", contentWarning); - - AddDiagnosticMesage(rawProject, project, "packInclude", "'files' in 'packOptions'"); - AddDiagnosticMesage(rawProject, project, "publishExclude", "'publishOptions'"); - AddDiagnosticMesage(rawProject, project, "exclude", "'exclude' within 'compile' or 'embed'"); + ConvertFromDeprecatedFormat( + rawProject, + project, + "'publishOptions'", + "publishExclude", + new string[] { "publishOptions" }, + "excludeFiles"); } - private static void AddDiagnosticMesage( + private static void ConvertDeprecatedCompileOptions(JObject rawProject, Project project) + { + var compileWarning = "'compile' in 'buildOptions'"; + var compileObjectHierarchy = new string[] { "buildOptions", "compile" }; + + ConvertFromDeprecatedFormat( + rawProject, + project, + compileWarning, + "compile", + compileObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + compileWarning, + "compileExclude", + compileObjectHierarchy, + "excludeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + compileWarning, + "compileFiles", + compileObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + compileWarning, + "compileBuiltIn", + compileObjectHierarchy, + "builtIns"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + compileWarning, + "exclude", + compileObjectHierarchy, + "exclude"); + } + + private static void ConvertDeprecatedContentOptions(JObject rawProject, Project project) + { + var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output"; + var copyToOutputObjectHierarchy = new string[] { "buildOptions", "copyToOutput" }; + var publishObjectHierarchy = new string[] { "publishOptions" }; + + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "content", + copyToOutputObjectHierarchy, + "includeFiles"); + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "content", + publishObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentExclude", + copyToOutputObjectHierarchy, + "excludeFiles"); + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentExclude", + publishObjectHierarchy, + "excludeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentFiles", + copyToOutputObjectHierarchy, + "includeFiles"); + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentFiles", + publishObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentFiles", + copyToOutputObjectHierarchy, + "contentBuiltIn"); + ConvertFromDeprecatedFormat( + rawProject, + project, + contentWarning, + "contentBuiltIn", + publishObjectHierarchy, + "builtIns"); + } + + private static void ConvertDeprecatedResourceOptions(JObject rawProject, Project project) + { + var resourceWarning = "'embed' in 'buildOptions'"; + var embedObjectHierarchy = new string[] { "buildOptions", "embed" }; + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "resource", + embedObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "resourceExclude", + embedObjectHierarchy, + "excludeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "resourceFiles", + embedObjectHierarchy, + "includeFiles"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "resourceBuiltIn", + embedObjectHierarchy, + "builtIns"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "namedResource", + embedObjectHierarchy, + "mappings"); + + ConvertFromDeprecatedFormat( + rawProject, + project, + resourceWarning, + "exclude", + embedObjectHierarchy, + "exclude"); + } + + private static void ConvertFromDeprecatedFormat( JObject rawProject, Project project, - string option, - string message) + string message, + string deprecatedKey, + string[] newKeyObjectHierarchy, + string newKey + ) { - var lineInfo = rawProject.Value(option); - if (lineInfo == null) + var deprecatedValue = rawProject.Value(deprecatedKey); + if (deprecatedValue != null) { - return; - } + var currentObject = rawProject; + foreach (var key in newKeyObjectHierarchy) + { + var childObject = currentObject.Value(key) as JObject; + if (childObject == null) + { + childObject = new JObject(); + currentObject[key] = childObject; + } - project.Diagnostics.Add( - new DiagnosticMessage( - ErrorCodes.DOTNET1015, - $"The '{option}' option is deprecated. Use {message} instead.", - project.ProjectFilePath, - DiagnosticMessageSeverity.Warning, - lineInfo.LineNumber, - lineInfo.LinePosition)); + currentObject = childObject; + } + + if (deprecatedValue is JObject) + { + currentObject[newKey] = (deprecatedValue as JObject).DeepClone(); + //(currentObject[newKey] as JObject).Merge((deprecatedValue as JObject).DeepClone(), new JsonMergeSettings + //{ + // // union array values together to avoid duplicates + // MergeArrayHandling = MergeArrayHandling.Union + //}); + } + else if (deprecatedValue is JToken) + { + currentObject[newKey] = (deprecatedValue as JToken).DeepClone(); + //JToken.FromObject(x.Concat(x)) + } + + project.Diagnostics.Add( + new DiagnosticMessage( + ErrorCodes.DOTNET1015, + $"The '{deprecatedKey}' option is deprecated. Use {message} instead.", + project.ProjectFilePath, + DiagnosticMessageSeverity.Warning, + deprecatedValue.LineNumber, + deprecatedValue.LinePosition)); + } } private static bool TryGetStringEnumerable(JToken token, out IEnumerable result) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index 2596d8f2f..7b2a31446 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -9,6 +9,7 @@ using Microsoft.Build.Construction; using Microsoft.DotNet.Internal.ProjectModel; using Microsoft.DotNet.Internal.ProjectModel.Graph; using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils.ExceptionExtensions; using Microsoft.DotNet.Cli.Sln.Internal; using Microsoft.DotNet.ProjectJsonMigration.Rules; @@ -251,9 +252,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration var diagnostics = defaultProjectContext.ProjectFile.Diagnostics; if (diagnostics.Any()) { - MigrationErrorCodes.MIGRATE1011( - String.Format("{0}{1}{2}", projectDirectory, Environment.NewLine, string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d))))) - .Throw(); + var deprecatedProjectJsonWarnings = string.Join( + Environment.NewLine, + diagnostics.Select(d => FormatDiagnosticMessage(d))); + var warnings = $"{projectDirectory}{Environment.NewLine}{deprecatedProjectJsonWarnings}"; + Reporter.Output.WriteLine(warnings.Yellow()); } var compilerName = From 6af164854337fa693871674fde33f38618589733 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 25 Jan 2017 10:33:38 -0800 Subject: [PATCH 21/88] Bumping the SDK version to 1.0.0-alpha-20170123-1. --- 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 b7ebc8f54..b993b35a2 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-4 + 1.0.0-alpha-20170123-1 4.0.0-rc3 1.0.0-alpha-20170120-3-249 15.0.0-preview-20170123-02 From b8d4010d85d44ce4306e731a8aaccae70fc04853 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Wed, 25 Jan 2017 12:30:56 -0800 Subject: [PATCH 22/88] Handle some of the deprecated properties --- .../Program.cs | 12 ++ .../project.json | 20 +++ .../PJAppWithDeprecatedPackOptions/Program.cs | 12 ++ .../project.json | 31 ++++ .../.noautobuild | 0 .../Helper.cs | 15 -- .../project.json | 13 -- .../GivenAProjectMigrator.cs | 21 --- ...venThatIWantToMigrateDeprecatedProjects.cs | 164 ++++++++++++++++++ 9 files changed, 239 insertions(+), 49 deletions(-) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json delete mode 100644 TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/.noautobuild delete mode 100644 TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/Helper.cs delete mode 100644 TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/project.json create mode 100644 test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs new file mode 100644 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json new file mode 100644 index 000000000..9f677856d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "compilerName": "csc", + "compilationOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs new file mode 100644 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json new file mode 100644 index 000000000..5ebe3586d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json @@ -0,0 +1,31 @@ +{ + "version": "1.0.0-*", + "projectUrl": "http://projecturl/", + "licenseUrl": "http://licenseurl/", + "iconUrl": "http://iconurl/", + "owners": [ "owner1", "owner2" ], + "tags": [ "tag1", "tag2" ], + "releaseNotes": "releaseNotes", + "requireLicenseAcceptance": true, + "summary": "summary", + "repository": { + "type": "git", + "url": "http://url/" + }, + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/.noautobuild b/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/.noautobuild deleted file mode 100644 index e69de29bb..000000000 diff --git a/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/Helper.cs b/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/Helper.cs deleted file mode 100644 index bd9a33ffe..000000000 --- a/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/Helper.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 TestLibrary -{ - public static class Helper - { - public static void SayHi() - { - Console.WriteLine("Hello there!"); - } - } -} diff --git a/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/project.json b/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/project.json deleted file mode 100644 index 90cf856ff..000000000 --- a/TestAssets/TestProjects/TestLibraryWithDeprecatedProjectFile/project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1.0.0-*", - "compilationOptions": { - "xmlDoc": true - }, - "packInclude": {}, - "dependencies": { - "NETStandard.Library": "1.6.0" - }, - "frameworks": { - "netstandard1.5": {} - } -} diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs index d15de0265..d1cb75935 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs @@ -38,27 +38,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } } - [Fact] - public void ItHasErrorWhenMigratingADeprecatedProjectJson() - { - var testProjectDirectory = - TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z") - .Path; - - var mockProj = ProjectRootElement.Create(); - var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(testProjectDirectory, testProjectDirectory, mockProj); - - var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); - var report = projectMigrator.Migrate(testSettings); - - var projectReport = report.ProjectMigrationReports.First(); - - var errorMessage = projectReport.Errors.First().GetFormattedErrorMessage(); - errorMessage.Should().Contain("MIGRATE1011::Deprecated Project:"); - errorMessage.Should().Contain("The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead. (line: 6, file:"); - errorMessage.Should().Contain("The 'compilationOptions' option is deprecated. Use 'buildOptions' instead. (line: 3, file:"); - } - [Fact] public void ItHasErrorWhenMigratingANonCsharpApp() { diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs new file mode 100644 index 000000000..5d91b0e8b --- /dev/null +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -0,0 +1,164 @@ +// 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 FluentAssertions; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools.Test.Utilities; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Xml.Linq; +using Xunit; + +namespace Microsoft.DotNet.Migration.Tests +{ + public class GivenThatIWantToMigrateDeprecatedProjects : TestBase + { + [Fact] + public void WhenMigratingAProjectWithDeprecatedPackOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'repository' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'projectUrl' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'licenseUrl' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'iconUrl' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'owners' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'tags' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'releaseNotes' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'requireLicenseAcceptance' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'summary' option in the root is deprecated. Use it in 'packOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedPackOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("pack") + .Should().Pass(); + + var outputDir = projectDirectory.GetDirectory("bin", "Debug"); + outputDir.Should().Exist() + .And.HaveFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg"); + + var outputPackage = outputDir.GetFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg"); + + var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read); + zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec"); + + var manifestReader = new StreamReader( + zip.Entries.First(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec").Open()); + + // NOTE: Commented out those that are not migrated. + // https://microsoft.sharepoint.com/teams/netfx/corefx/_layouts/15/WopiFrame.aspx?sourcedoc=%7B0cfbc196-0645-4781-84c6-5dffabd76bee%7D&action=edit&wd=target%28Planning%2FMSBuild%20CLI%20integration%2Eone%7C41D470DD-CF44-4595-8E05-0CE238864B55%2FProject%2Ejson%20Migration%7CA553D979-EBC6-484B-A12E-036E0730864A%2F%29 + var nuspecXml = XDocument.Parse(manifestReader.ReadToEnd()); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "projectUrl").Value + .Should().Be("http://projecturl/"); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "licenseUrl").Value + .Should().Be("http://licenseurl/"); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "iconUrl").Value + .Should().Be("http://iconurl/"); + //nuspecXml.Descendants().Single(e => e.Name.LocalName == "owners").Value + // .Should().Be("owner1,owner2"); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "tags").Value + .Should().Be("tag1 tag2"); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "releaseNotes").Value + .Should().Be("releaseNotes"); + nuspecXml.Descendants().Single(e => e.Name.LocalName == "requireLicenseAcceptance").Value + .Should().Be("true"); + //nuspecXml.Descendants().Single(e => e.Name.LocalName == "summary").Value + // .Should().Be("summary"); + + var repositoryNode = nuspecXml.Descendants().Single(e => e.Name.LocalName == "repository"); + repositoryNode.Attributes("type").Single().Value.Should().Be("git"); + repositoryNode.Attributes("url").Single().Value.Should().Be("http://url/"); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompilationOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'compilerName' option in the root is deprecated. Use it in 'buildOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'compilationOptions' option is deprecated. Use 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompilationOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + } + } +} From 150e3c431313725101a3906f163f2318d6aa9a5e Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Wed, 25 Jan 2017 17:28:57 -0800 Subject: [PATCH 23/88] Add more tests --- .../ContentFile1.txt | 1 + .../ContentFile2.txt | 1 + .../ContentFileBuiltIn1.txt | 1 + .../ContentFileBuiltIn2.txt | 1 + .../project/ExcludeThis.txt | 1 + .../project/IncludeThis1.txt | 1 + .../project/IncludeThis2.txt | 1 + .../project/Program.cs | 12 + .../project/project.json | 24 ++ .../Content1.txt | 1 + .../Content2.txt | 1 + .../project.json | 1 + .../ProjectReader.cs | 386 ++++++++---------- ...venThatIWantToMigrateDeprecatedProjects.cs | 88 +++- 14 files changed, 293 insertions(+), 227 deletions(-) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt new file mode 100644 index 000000000..949ca7b7c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt @@ -0,0 +1 @@ +Test content file that should be excluded. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt new file mode 100644 index 000000000..49852374c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt @@ -0,0 +1 @@ +Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs new file mode 100644 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json new file mode 100644 index 000000000..15c8a8cbe --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + "content": "*.txt", + "contentExclude": "ExcludeThis.txt", + "contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ], + "contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ], + "publishExclude": "IncludeThis2.txt", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt new file mode 100644 index 000000000..a36501f3f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt @@ -0,0 +1 @@ +Test pack content file. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt new file mode 100644 index 000000000..a36501f3f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt @@ -0,0 +1 @@ +Test pack content file. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json index 5ebe3586d..5daf77a20 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json @@ -12,6 +12,7 @@ "type": "git", "url": "http://url/" }, + "packInclude": [ "Content1.txt", "Content2.txt" ], "buildOptions": { "debugType": "portable", "emitEntryPoint": true diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs index 50802ac70..2c6e07710 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs @@ -165,7 +165,8 @@ namespace Microsoft.DotNet.Internal.ProjectModel // Project files project.Files = new ProjectFilesCollection(rawProject, project.ProjectDirectory, project.ProjectFilePath); - AddProjectFilesCollectionDiagnostics(rawProject, project); + AddProjectFilesDeprecationDiagnostics(rawProject, project); + ConvertDeprecatedToSupportedFormat(rawProject); var commands = rawProject.Value("commands") as JObject; if (commands != null) @@ -758,10 +759,14 @@ namespace Microsoft.DotNet.Internal.ProjectModel if (rawPackOptions != null) { - var packOptionValue = rawPackOptions.Value(option); - if (packOptionValue != null) + var hasOption = rawPackOptions.Value(option) != null; + if (hasOption) { - return packOptionValue; + var packOptionValue = rawPackOptions.Value(option); + if (packOptionValue != null) + { + return packOptionValue; + } } } @@ -807,244 +812,173 @@ namespace Microsoft.DotNet.Internal.ProjectModel return File.Exists(projectPath); } - private static void AddProjectFilesCollectionDiagnostics(JObject rawProject, Project project) - { - ConvertDeprecatedCompileOptions(rawProject, project); - ConvertDeprecatedContentOptions(rawProject, project); - ConvertDeprecatedResourceOptions(rawProject, project); - - ConvertFromDeprecatedFormat( - rawProject, - project, - "'files' in 'packOptions'", - "packInclude", - new string[] { "packOptions" }, - "files"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - "'publishOptions'", - "publishExclude", - new string[] { "publishOptions" }, - "excludeFiles"); - } - - private static void ConvertDeprecatedCompileOptions(JObject rawProject, Project project) + private static void AddProjectFilesDeprecationDiagnostics(JObject rawProject, Project project) { var compileWarning = "'compile' in 'buildOptions'"; - var compileObjectHierarchy = new string[] { "buildOptions", "compile" }; + AddDeprecatedDiagnosticMessage(rawProject, project, "compile", compileWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "compileExclude", compileWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "compileFiles", compileWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "compileBuiltIn", compileWarning); - ConvertFromDeprecatedFormat( - rawProject, - project, - compileWarning, - "compile", - compileObjectHierarchy, - "includeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - compileWarning, - "compileExclude", - compileObjectHierarchy, - "excludeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - compileWarning, - "compileFiles", - compileObjectHierarchy, - "includeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - compileWarning, - "compileBuiltIn", - compileObjectHierarchy, - "builtIns"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - compileWarning, - "exclude", - compileObjectHierarchy, - "exclude"); - } - - private static void ConvertDeprecatedContentOptions(JObject rawProject, Project project) - { - var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output"; - var copyToOutputObjectHierarchy = new string[] { "buildOptions", "copyToOutput" }; - var publishObjectHierarchy = new string[] { "publishOptions" }; - - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "content", - copyToOutputObjectHierarchy, - "includeFiles"); - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "content", - publishObjectHierarchy, - "includeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentExclude", - copyToOutputObjectHierarchy, - "excludeFiles"); - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentExclude", - publishObjectHierarchy, - "excludeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentFiles", - copyToOutputObjectHierarchy, - "includeFiles"); - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentFiles", - publishObjectHierarchy, - "includeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentFiles", - copyToOutputObjectHierarchy, - "contentBuiltIn"); - ConvertFromDeprecatedFormat( - rawProject, - project, - contentWarning, - "contentBuiltIn", - publishObjectHierarchy, - "builtIns"); - } - - private static void ConvertDeprecatedResourceOptions(JObject rawProject, Project project) - { var resourceWarning = "'embed' in 'buildOptions'"; - var embedObjectHierarchy = new string[] { "buildOptions", "embed" }; + AddDeprecatedDiagnosticMessage(rawProject, project, "resource", resourceWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "resourceExclude", resourceWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "resourceFiles", resourceWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "resourceBuiltIn", resourceWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "namedResource", resourceWarning); - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "resource", - embedObjectHierarchy, - "includeFiles"); + var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output"; + AddDeprecatedDiagnosticMessage(rawProject, project, "content", contentWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "contentExclude", contentWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "contentFiles", contentWarning); + AddDeprecatedDiagnosticMessage(rawProject, project, "contentBuiltIn", contentWarning); - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "resourceExclude", - embedObjectHierarchy, - "excludeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "resourceFiles", - embedObjectHierarchy, - "includeFiles"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "resourceBuiltIn", - embedObjectHierarchy, - "builtIns"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "namedResource", - embedObjectHierarchy, - "mappings"); - - ConvertFromDeprecatedFormat( - rawProject, - project, - resourceWarning, - "exclude", - embedObjectHierarchy, - "exclude"); + AddDeprecatedDiagnosticMessage(rawProject, project, "packInclude", "'files' in 'packOptions'"); + AddDeprecatedDiagnosticMessage(rawProject, project, "publishExclude", "'publishOptions'"); + AddDeprecatedDiagnosticMessage(rawProject, project, "exclude", "'exclude' within 'compile' or 'embed'"); } - private static void ConvertFromDeprecatedFormat( + private static void AddDeprecatedDiagnosticMessage( JObject rawProject, Project project, - string message, + string option, + string message) + { + var lineInfo = rawProject.Value(option); + if (lineInfo == null) + { + return; + } + + project.Diagnostics.Add( + new DiagnosticMessage( + ErrorCodes.DOTNET1015, + $"The '{option}' option is deprecated. Use {message} instead.", + project.ProjectFilePath, + DiagnosticMessageSeverity.Warning, + lineInfo.LineNumber, + lineInfo.LinePosition)); + } + + private static void ConvertDeprecatedToSupportedFormat(JObject rawProject) + { + ConvertToBuildOptionsCompile(rawProject); + ConvertToBuildOptionsEmbed(rawProject); + ConvertToBuildOptionsCopyToOutput(rawProject); + ConvertToPackOptions(rawProject); + ConvertToPublishOptions(rawProject); + } + + private static void ConvertToBuildOptionsCompile(JObject rawProject) + { + var jpath = "buildOptions.compile"; + if (AreDeprecatedOptionsIgnored(rawProject, jpath)) + { + return; + } + + ConvertFromDeprecatedFormat(rawProject, jpath, "compile", "include"); + ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude"); + ConvertFromDeprecatedFormat(rawProject, jpath, "compileExclude", "excludeFiles"); + ConvertFromDeprecatedFormat(rawProject, jpath, "compileFiles", "includeFiles"); + ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "compileBuiltIn", "include"); + } + + private static void ConvertToBuildOptionsEmbed(JObject rawProject) + { + var jpath = "buildOptions.embed"; + if (AreDeprecatedOptionsIgnored(rawProject, jpath)) + { + return; + } + + ConvertFromDeprecatedFormat(rawProject, jpath, "resource", "include"); + ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude"); + ConvertFromDeprecatedFormat(rawProject, jpath, "resourceExclude", "excludeFiles"); + ConvertFromDeprecatedFormat(rawProject, jpath, "resourceFiles", "includeFiles"); + ConvertFromDeprecatedFormat(rawProject, jpath, "namedResource", "mappings"); + ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "resourceBuiltIn", "include"); + } + + private static void ConvertToBuildOptionsCopyToOutput(JObject rawProject) + { + var jpath = "buildOptions.copyToOutput"; + if (AreDeprecatedOptionsIgnored(rawProject, jpath)) + { + return; + } + + ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include"); + ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles"); + ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles"); + ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include"); + } + + private static void ConvertToPackOptions(JObject rawProject) + { + var jpath = "packOptions"; + if (AreDeprecatedOptionsIgnored(rawProject, jpath)) + { + return; + } + + ConvertFromDeprecatedFormat(rawProject, $"{jpath}.files", "packInclude", "include"); + } + + private static void ConvertToPublishOptions(JObject rawProject) + { + var jpath = "publishOptions"; + if (AreDeprecatedOptionsIgnored(rawProject, jpath)) + { + return; + } + + ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include"); + ConvertFromDeprecatedFormat(rawProject, jpath, "publishExclude", "exclude"); + ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles"); + ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles"); + ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include"); + } + + private static bool AreDeprecatedOptionsIgnored(JObject rawProject, string jpathToNewFormatObject) + { + // If the node already exists this means that the project.json file contained both the old and + // new format. In these cases the project.json build ignores the deprecated format and just uses + // the new format. + return (rawProject.SelectToken(jpathToNewFormatObject) != null); + } + + private static JObject GetOrCreateObjectHierarchy(JObject rawProject, string jpath) + { + var currentObject = rawProject as JObject; + + var objectHierarchy = jpath.Split('.'); + foreach (var name in objectHierarchy) + { + var childObject = currentObject.Value(name); + if (childObject == null) + { + childObject = new JObject(); + currentObject[name] = childObject; + } + currentObject = childObject; + } + + return currentObject; + } + + private static void ConvertFromDeprecatedFormat( + JObject rawProject, + string jpathToObject, string deprecatedKey, - string[] newKeyObjectHierarchy, string newKey ) { - var deprecatedValue = rawProject.Value(deprecatedKey); + var deprecatedValue = rawProject.Value(deprecatedKey); if (deprecatedValue != null) { - var currentObject = rawProject; - foreach (var key in newKeyObjectHierarchy) - { - var childObject = currentObject.Value(key) as JObject; - if (childObject == null) - { - childObject = new JObject(); - currentObject[key] = childObject; - } - - currentObject = childObject; - } - - if (deprecatedValue is JObject) - { - currentObject[newKey] = (deprecatedValue as JObject).DeepClone(); - //(currentObject[newKey] as JObject).Merge((deprecatedValue as JObject).DeepClone(), new JsonMergeSettings - //{ - // // union array values together to avoid duplicates - // MergeArrayHandling = MergeArrayHandling.Union - //}); - } - else if (deprecatedValue is JToken) - { - currentObject[newKey] = (deprecatedValue as JToken).DeepClone(); - //JToken.FromObject(x.Concat(x)) - } - - project.Diagnostics.Add( - new DiagnosticMessage( - ErrorCodes.DOTNET1015, - $"The '{deprecatedKey}' option is deprecated. Use {message} instead.", - project.ProjectFilePath, - DiagnosticMessageSeverity.Warning, - deprecatedValue.LineNumber, - deprecatedValue.LinePosition)); + var objectNode = GetOrCreateObjectHierarchy(rawProject, jpathToObject); + objectNode[newKey] = deprecatedValue.DeepClone(); } } diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index 5d91b0e8b..07d48eb88 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -47,6 +47,8 @@ namespace Microsoft.DotNet.Migration.Tests "The 'requireLicenseAcceptance' option in the root is deprecated. Use it in 'packOptions' instead."); cmd.StdOut.Should().Contain( "The 'summary' option in the root is deprecated. Use it in 'packOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead."); } [Fact] @@ -85,7 +87,9 @@ namespace Microsoft.DotNet.Migration.Tests var outputPackage = outputDir.GetFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg"); var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read); - zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec"); + zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec") + .And.Contain(e => e.FullName == "content/Content1.txt") + .And.Contain(e => e.FullName == "content/Content2.txt"); var manifestReader = new StreamReader( zip.Entries.First(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec").Open()); @@ -160,5 +164,87 @@ namespace Microsoft.DotNet.Migration.Tests .Execute("build") .Should().Pass(); } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedContentOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'content' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead."); + cmd.StdOut.Should().Contain( + "The 'contentExclude' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead."); + cmd.StdOut.Should().Contain( + "The 'contentFiles' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead."); + cmd.StdOut.Should().Contain( + "The 'contentBuiltIn' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedContentOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("publish") + .Should().Pass(); + + var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0"); + outputDir.Should().Exist() + .And.HaveFiles(new[] + { + "ContentFile1.txt", + "ContentFile2.txt", + "ContentFileBuiltIn1.txt", + "ContentFileBuiltIn2.txt", + "IncludeThis1.txt", + }); + Directory.Exists(Path.Combine(outputDir.FullName, "IncludeThis2.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis.txt")).Should().BeFalse(); + + var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish"); + publishDir.Should().Exist() + .And.HaveFiles(new[] + { + "ContentFile1.txt", + "ContentFile2.txt", + "ContentFileBuiltIn1.txt", + "ContentFileBuiltIn2.txt", + "IncludeThis1.txt", + }); + Directory.Exists(Path.Combine(publishDir.FullName, "IncludeThis2.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis.txt")).Should().BeFalse(); + } } } From efa8dcdfd897b7d2172e073ce8294f2ca147b2b4 Mon Sep 17 00:00:00 2001 From: Jonathan Channon Date: Thu, 26 Jan 2017 13:09:07 +0000 Subject: [PATCH 24/88] Add instruction to add global.json to preview2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0293c8b5d..20d404943 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The current official release of the csproj-enabled CLI tools is **CLI Preview 4* There are a couple of things to keep in mind: * Preview 4 CLI bits are still **in development** so some rough edges are to be expected. -* Preview 4 bits **do not support** project.json so you will have to either keep Preview 2 tools around or migrate your project. You can find more information on this using the [project.json to csproj instructions](https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/ProjectJsonToCSProj.md). +* Preview 4 bits **do not support** project.json so you will have to either keep Preview 2 tools around or migrate your project or add a global.json file to your project to target preview2. You can find more information on this using the [project.json to csproj instructions](https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/ProjectJsonToCSProj.md). * Preview 4 refers to the **CLI tools only** and does not cover Visual Studio, VS Code or Visual Studio for Mac. * We welcome any and all issues that relate to MSBuild-based tools, so feel free to try them out and leave comments and file any bugs/problems. From ddf3261a67c95e5a4d8619ac12c92d4823bbec14 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 08:34:36 -0800 Subject: [PATCH 25/88] Add more tests --- .../HelperBuiltIn1.cs | 12 ++ .../HelperBuiltIn2.cs | 12 ++ .../project/IncludeThis.cs | 12 ++ .../project/Program.cs | 14 ++ .../project/project.json | 20 +++ .../ExcludeThis.cs | 1 + .../Program.cs | 12 ++ .../project.json | 20 +++ .../Helper1.cs | 12 ++ .../Helper2.cs | 12 ++ .../project/IncludeThis.cs | 12 ++ .../project/Program.cs | 14 ++ .../project/project.json | 21 +++ ...venThatIWantToMigrateDeprecatedProjects.cs | 138 ++++++++++++++++++ 14 files changed, 312 insertions(+) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs new file mode 100644 index 000000000..042fc53d1 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class HelperBuiltIn1 + { + public static string GetMessage() + { + return "Hello from HelperBuiltIn1 class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs new file mode 100644 index 000000000..5ba00add3 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class HelperBuiltIn2 + { + public static string GetMessage() + { + return "Hello from HelperBuiltIn2 class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs new file mode 100644 index 000000000..d9300fe2d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class IncludeThis + { + public static string GetMessage() + { + return "Hello from IncludeThis class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs new file mode 100644 index 000000000..bf3f8b064 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs @@ -0,0 +1,14 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine(IncludeThis.GetMessage()); + Console.WriteLine(HelperBuiltIn1.GetMessage()); + Console.WriteLine(HelperBuiltIn2.GetMessage()); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json new file mode 100644 index 000000000..7418df38c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "compileBuiltIn": [ "Program.cs", "IncludeThis.cs", "../HelperBuiltIn1.cs", "../HelperBuiltIn2.cs" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs new file mode 100644 index 000000000..c8ee6c75e --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs @@ -0,0 +1 @@ +This does not compile but is used to test compile exclusion. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs new file mode 100644 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json new file mode 100644 index 000000000..5c81a68c2 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "compileExclude": "ExcludeThis.cs", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs new file mode 100644 index 000000000..dd2447c0f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Helper1 + { + public static string GetMessage() + { + return "Hello from Helper1 class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs new file mode 100644 index 000000000..eeabb8a3d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Helper2 + { + public static string GetMessage() + { + return "Hello from Helper2 class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs new file mode 100644 index 000000000..d9300fe2d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class IncludeThis + { + public static string GetMessage() + { + return "Hello from IncludeThis class!"; + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs new file mode 100644 index 000000000..67d7bea12 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs @@ -0,0 +1,14 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine(IncludeThis.GetMessage()); + Console.WriteLine(Helper1.GetMessage()); + Console.WriteLine(Helper2.GetMessage()); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json new file mode 100644 index 000000000..87eeadaa3 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + "compile": "../Helper1.cs", + "compileFiles": "../Helper2.cs", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index 07d48eb88..e5839c949 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -246,5 +246,143 @@ namespace Microsoft.DotNet.Migration.Tests Directory.Exists(Path.Combine(publishDir.FullName, "IncludeThis2.txt")).Should().BeFalse(); Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis.txt")).Should().BeFalse(); } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'compileFiles' option is deprecated. Use 'compile' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'compileBuiltIn' option is deprecated. Use 'compile' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + //Issue: https://github.com/dotnet/cli/issues/5467 + //new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .Execute("build") + // .Should().Pass(); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'compileExclude' option is deprecated. Use 'compile' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + // Issue: https://github.com/dotnet/cli/issues/5461 + //new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .Execute("build") + // .Should().Pass(); + } } } From 000734d1ef05583277aee63ee2381045d71e77a5 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Fri, 20 Jan 2017 15:59:21 -0800 Subject: [PATCH 26/88] Ignore explicit glob **/*.cs --- .../TestAppWithExplicitIncludeGlob/Program.cs | 9 +++++++ .../project.json | 24 +++++++++++++++++++ .../Rules/MigrateBuildOptionsRule.cs | 5 ++++ .../transforms/IncludeContextTransform.cs | 22 +++++++++++++++-- .../GivenThatIWantToMigrateTestApps.cs | 15 ++++++++++++ 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs create mode 100644 TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/project.json diff --git a/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs new file mode 100644 index 000000000..5f9be2467 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs @@ -0,0 +1,9 @@ +using System; + +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } +} \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/project.json b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/project.json new file mode 100644 index 000000000..67a885251 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true, + "compile": { + "include": [ + "**/*.cs" + ] + } + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index c0e3b0201..7b15bdf9e 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -110,10 +110,15 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules compilerOptions => projectFolderName, compilerOptions => compilerOptions.OutputName != null); + private string[] _compilePatternsBlackList = new string[] { + "**/*.cs" + }; + private IncludeContextTransform CompileFilesTransform => new IncludeContextTransform( "Compile", transformMappings: false, + patternsBlackList: _compilePatternsBlackList, condition: ic => ic != null, emitBuiltInIncludes: false); diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs index 65630c2da..06a82260d 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs @@ -25,6 +25,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms && includeContext.IncludeFiles != null && includeContext.IncludeFiles.Count > 0); + private bool IsPatternBlackListed(string pattern) + { + if (_patternsBlackList == null) + { + return false; + } + + return _patternsBlackList.Contains(pattern.Replace('\\', '/')); + } + protected virtual Func> IncludeExcludeTransformGetter => (itemName) => new AddItemTransform( itemName, @@ -36,6 +46,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); } + if (_patternsBlackList != null) + { + fullIncludeSet = fullIncludeSet.Where((pattern) => !IsPatternBlackListed(pattern)); + } + return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); }, includeContext => @@ -50,7 +65,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms { return includeContext != null && ( - (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Count > 0) + (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !IsPatternBlackListed(pattern)).Count() > 0) || (_emitBuiltInIncludes && includeContext.BuiltInsInclude != null && @@ -68,6 +83,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms private readonly string _itemName; private bool _transformMappings; + private string[] _patternsBlackList; private bool _emitBuiltInIncludes; private readonly List> _metadata = new List>(); @@ -75,11 +91,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms string itemName, bool transformMappings = true, Func condition = null, - bool emitBuiltInIncludes = true) : base(condition) + bool emitBuiltInIncludes = true, + string[] patternsBlackList = null) : base(condition) { _itemName = itemName; _transformMappings = transformMappings; _emitBuiltInIncludes = emitBuiltInIncludes; + _patternsBlackList = patternsBlackList; _mappingsToTransfrom = (addItemTransform, targetPath) => { diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index c569c6cc6..98e1f2169 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -640,6 +640,21 @@ namespace Microsoft.DotNet.Migration.Tests Restore(projectDirectory, projectName); BuildMSBuild(projectDirectory, projectName); } + + [Fact] + public void ItMigratesAndBuildsAppWithExplicitIncludeGlob() + { + const string projectName = "TestAppWithExplicitIncludeGlob"; + var projectDirectory = TestAssets.Get(projectName) + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + MigrateProject(projectDirectory); + Restore(projectDirectory, projectName); + BuildMSBuild(projectDirectory, projectName); + } private void VerifyAutoInjectedDesktopReferences(DirectoryInfo projectDirectory, string projectName, bool shouldBePresent) { From ecd034b95cd8bcf2b8d3bd20dc9c23b1aed07f7a Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Mon, 23 Jan 2017 10:37:47 -0800 Subject: [PATCH 27/88] fix build errors after rebase --- test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 98e1f2169..f9ced890b 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -648,10 +648,9 @@ namespace Microsoft.DotNet.Migration.Tests var projectDirectory = TestAssets.Get(projectName) .CreateInstance() .WithSourceFiles() - .Root - .FullName; + .Root; - MigrateProject(projectDirectory); + MigrateProject(projectDirectory.FullName); Restore(projectDirectory, projectName); BuildMSBuild(projectDirectory, projectName); } From 3fa73a90d4b68330993fd65a0bcf0c789c531797 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Mon, 23 Jan 2017 11:35:32 -0800 Subject: [PATCH 28/88] fix EOL in test asset --- .../TestProjects/TestAppWithExplicitIncludeGlob/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs index 5f9be2467..c81448f54 100644 --- a/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs +++ b/TestAssets/TestProjects/TestAppWithExplicitIncludeGlob/Program.cs @@ -6,4 +6,4 @@ class Program { Console.WriteLine("Hello World!"); } -} \ No newline at end of file +} From 7a65922895a7183f2dd69027ee6c6f88db1f7529 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 26 Jan 2017 09:02:21 -0800 Subject: [PATCH 29/88] apply review feedback --- .../Rules/MigrateBuildOptionsRule.cs | 4 ++-- .../transforms/IncludeContextTransform.cs | 22 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index 7b15bdf9e..b243be518 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -110,7 +110,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules compilerOptions => projectFolderName, compilerOptions => compilerOptions.OutputName != null); - private string[] _compilePatternsBlackList = new string[] { + private string[] _compilePatternsToExclude = new string[] { "**/*.cs" }; @@ -118,7 +118,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules new IncludeContextTransform( "Compile", transformMappings: false, - patternsBlackList: _compilePatternsBlackList, + patternsToExclude: _compilePatternsToExclude, condition: ic => ic != null, emitBuiltInIncludes: false); diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs index 06a82260d..80a671cd1 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs @@ -25,14 +25,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms && includeContext.IncludeFiles != null && includeContext.IncludeFiles.Count > 0); - private bool IsPatternBlackListed(string pattern) + private bool IsPatternExcluded(string pattern) { - if (_patternsBlackList == null) - { - return false; - } - - return _patternsBlackList.Contains(pattern.Replace('\\', '/')); + return _patternsToExclude.Contains(pattern.Replace('\\', '/')); } protected virtual Func> IncludeExcludeTransformGetter => @@ -46,10 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); } - if (_patternsBlackList != null) - { - fullIncludeSet = fullIncludeSet.Where((pattern) => !IsPatternBlackListed(pattern)); - } + fullIncludeSet = fullIncludeSet.Where((pattern) => !IsPatternExcluded(pattern)); return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); }, @@ -65,7 +57,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms { return includeContext != null && ( - (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !IsPatternBlackListed(pattern)).Count() > 0) + (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !IsPatternExcluded(pattern)).Count() > 0) || (_emitBuiltInIncludes && includeContext.BuiltInsInclude != null && @@ -83,7 +75,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms private readonly string _itemName; private bool _transformMappings; - private string[] _patternsBlackList; + private string[] _patternsToExclude; private bool _emitBuiltInIncludes; private readonly List> _metadata = new List>(); @@ -92,12 +84,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms bool transformMappings = true, Func condition = null, bool emitBuiltInIncludes = true, - string[] patternsBlackList = null) : base(condition) + string[] patternsToExclude = null) : base(condition) { _itemName = itemName; _transformMappings = transformMappings; _emitBuiltInIncludes = emitBuiltInIncludes; - _patternsBlackList = patternsBlackList; + _patternsToExclude = patternsToExclude ?? Array.Empty(); _mappingsToTransfrom = (addItemTransform, targetPath) => { From 8b7c0ad4685f10267d72cacdc618a4489d8148db Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 09:15:30 -0800 Subject: [PATCH 30/88] Add more tests --- .../{ExcludeThis.cs => ExcludeThis1.cs} | 0 .../ExcludeThis2.cs | 1 + .../project.json | 3 +- .../Strings1.resx | 123 ++++++++++++++ .../Strings2.resx | 123 ++++++++++++++ .../project/Program.cs | 19 +++ .../project/Resources/Strings.resx | 123 ++++++++++++++ .../project/project.json | 20 +++ .../Exclude1.resx | 1 + .../Exclude2.resx | 1 + .../Program.cs | 19 +++ .../project.json | 21 +++ .../Strings1.resx | 123 ++++++++++++++ .../Strings2.resx | 123 ++++++++++++++ .../project/Program.cs | 19 +++ .../project/Resources/Strings.resx | 123 ++++++++++++++ .../project/project.json | 21 +++ ...venThatIWantToMigrateDeprecatedProjects.cs | 158 ++++++++++++++++++ 18 files changed, 1020 insertions(+), 1 deletion(-) rename TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/{ExcludeThis.cs => ExcludeThis1.cs} (100%) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis1.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis.cs rename to TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis1.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs new file mode 100644 index 000000000..c8ee6c75e --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs @@ -0,0 +1 @@ +This does not compile but is used to test compile exclusion. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json index 5c81a68c2..3b457a6dc 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json @@ -1,6 +1,7 @@ { "version": "1.0.0-*", - "compileExclude": "ExcludeThis.cs", + "compileExclude": "ExcludeThis1.cs", + "exclude": [ "ExcludeThis2.cs" ], "buildOptions": { "debugType": "portable", "emitEntryPoint": true diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs new file mode 100644 index 000000000..d0134277c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Linq; +using System.Reflection; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + var thisAssembly = typeof(Program).GetTypeInfo().Assembly; + var resources = from resourceName in thisAssembly.GetManifestResourceNames() + select resourceName; + + var resourceNames = string.Join(",", resources); + Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json new file mode 100644 index 000000000..d4f8ee07f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "resourceBuiltIn": [ "../Strings1.resx", "../Strings2.resx" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx new file mode 100644 index 000000000..a82c91ddd --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx @@ -0,0 +1 @@ +This is not a resource file but is used to test resource exclusion. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx new file mode 100644 index 000000000..a82c91ddd --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx @@ -0,0 +1 @@ +This is not a resource file but is used to test resource exclusion. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs new file mode 100644 index 000000000..d0134277c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Linq; +using System.Reflection; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + var thisAssembly = typeof(Program).GetTypeInfo().Assembly; + var resources = from resourceName in thisAssembly.GetManifestResourceNames() + select resourceName; + + var resourceNames = string.Join(",", resources); + Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json new file mode 100644 index 000000000..01c3c9e23 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + "exclude": "Exclude1.resx", + "resourceExclude": [ "Exclude2.resx" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs new file mode 100644 index 000000000..d0134277c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Linq; +using System.Reflection; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + var thisAssembly = typeof(Program).GetTypeInfo().Assembly; + var resources = from resourceName in thisAssembly.GetManifestResourceNames() + select resourceName; + + var resourceNames = string.Join(",", resources); + Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx new file mode 100644 index 000000000..1f24a372f --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello World! + + \ No newline at end of file diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json new file mode 100644 index 000000000..369f7325d --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + "resource": "../Strings1.resx", + "resourceFiles": [ "../Strings2.resx" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index e5839c949..d5dcad063 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -384,5 +384,163 @@ namespace Microsoft.DotNet.Migration.Tests // .Execute("build") // .Should().Pass(); } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'resource' option is deprecated. Use 'embed' in 'buildOptions' instead."); + cmd.StdOut.Should().Contain( + "The 'resourceFiles' option is deprecated. Use 'embed' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("run"); + cmd.Should().Pass(); + cmd.StdOut.Should().Contain("3 Resources Found:"); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceBuiltInOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'resourceBuiltIn' option is deprecated. Use 'embed' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceBuiltInOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project"); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build") + .Should().Pass(); + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("run"); + cmd.Should().Pass(); + // Issue: https://github.com/dotnet/cli/issues/5467 + //cmd.StdOut.Should().Contain("2 Resources Found:"); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsWarningsArePrinted() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("migrate"); + + cmd.Should().Pass(); + + cmd.StdOut.Should().Contain( + "The 'resourceExclude' option is deprecated. Use 'embed' in 'buildOptions' instead."); + } + + [Fact] + public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsItSucceeds() + { + var projectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions") + .CreateInstance() + .WithSourceFiles() + .Root; + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("migrate") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("restore") + .Should().Pass(); + + // Issue: https://github.com/dotnet/cli/issues/5461 + //new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .Execute("build") + // .Should().Pass(); + + //var cmd = new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .ExecuteWithCapturedOutput("run"); + //cmd.Should().Pass(); + //cmd.StdOut.Should().Contain("0 Resources Found:"); + } } } From 61ae452fe2548314932c72230c9331e4a566dc06 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 09:55:09 -0800 Subject: [PATCH 31/88] Updating tests --- .../project/{ExcludeThis.txt => ExcludeThis1.txt} | 0 .../project/ExcludeThis2.txt | 1 + .../project/{IncludeThis1.txt => IncludeThis.txt} | 0 .../project/IncludeThis2.txt | 1 - .../project/project.json | 4 ++-- .../GivenThatIWantToMigrateDeprecatedProjects.cs | 12 ++++++------ 6 files changed, 9 insertions(+), 9 deletions(-) rename TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/{ExcludeThis.txt => ExcludeThis1.txt} (100%) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt rename TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/{IncludeThis1.txt => IncludeThis.txt} (100%) delete mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis1.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis.txt rename to TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis1.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt new file mode 100644 index 000000000..949ca7b7c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt @@ -0,0 +1 @@ +Test content file that should be excluded. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis1.txt rename to TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt deleted file mode 100644 index 49852374c..000000000 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis2.txt +++ /dev/null @@ -1 +0,0 @@ -Test content file that should be included. diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json index 15c8a8cbe..bf61a22e2 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json @@ -1,10 +1,10 @@ { "version": "1.0.0-*", "content": "*.txt", - "contentExclude": "ExcludeThis.txt", + "contentExclude": "ExcludeThis1.txt", "contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ], "contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ], - "publishExclude": "IncludeThis2.txt", + "publishExclude": "ExcludeThis2.txt", "buildOptions": { "debugType": "portable", "emitEntryPoint": true diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index d5dcad063..419f50f29 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -228,10 +228,10 @@ namespace Microsoft.DotNet.Migration.Tests "ContentFile2.txt", "ContentFileBuiltIn1.txt", "ContentFileBuiltIn2.txt", - "IncludeThis1.txt", + "IncludeThis.txt", }); - Directory.Exists(Path.Combine(outputDir.FullName, "IncludeThis2.txt")).Should().BeFalse(); - Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis2.txt")).Should().BeFalse(); var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish"); publishDir.Should().Exist() @@ -241,10 +241,10 @@ namespace Microsoft.DotNet.Migration.Tests "ContentFile2.txt", "ContentFileBuiltIn1.txt", "ContentFileBuiltIn2.txt", - "IncludeThis1.txt", + "IncludeThis.txt", }); - Directory.Exists(Path.Combine(publishDir.FullName, "IncludeThis2.txt")).Should().BeFalse(); - Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse(); + Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis2.txt")).Should().BeFalse(); } [Fact] From 037da3fc014214764ed64ed2cece7392743b385d Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 11:00:50 -0800 Subject: [PATCH 32/88] Finish tests --- .../Program.cs | 19 ++++++++++++++ .../project.json | 20 ++++++++++++++ .../ProjectReader.cs | 15 ++++++++--- .../ProjectMigrator.cs | 25 ++++++++++++++---- .../GivenAProjectMigrator.cs | 26 +++++++++++++++++++ 5 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs create mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs new file mode 100644 index 000000000..d0134277c --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Linq; +using System.Reflection; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + var thisAssembly = typeof(Program).GetTypeInfo().Assembly; + var resources = from resourceName in thisAssembly.GetManifestResourceNames() + select resourceName; + + var resourceNames = string.Join(",", resources); + Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}"); + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json new file mode 100644 index 000000000..0bf0dfa00 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "namedResource": [ "My.Alias", "Strings.resx" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs index 2c6e07710..1b20a58af 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs @@ -825,7 +825,14 @@ namespace Microsoft.DotNet.Internal.ProjectModel AddDeprecatedDiagnosticMessage(rawProject, project, "resourceExclude", resourceWarning); AddDeprecatedDiagnosticMessage(rawProject, project, "resourceFiles", resourceWarning); AddDeprecatedDiagnosticMessage(rawProject, project, "resourceBuiltIn", resourceWarning); - AddDeprecatedDiagnosticMessage(rawProject, project, "namedResource", resourceWarning); + // Issue: https://github.com/dotnet/cli/issues/5471 + // This is why we mark it as an error which will fail migration. + AddDeprecatedDiagnosticMessage( + rawProject, + project, + "namedResource", + resourceWarning, + DiagnosticMessageSeverity.Error); var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output"; AddDeprecatedDiagnosticMessage(rawProject, project, "content", contentWarning); @@ -842,7 +849,8 @@ namespace Microsoft.DotNet.Internal.ProjectModel JObject rawProject, Project project, string option, - string message) + string message, + DiagnosticMessageSeverity severity = DiagnosticMessageSeverity.Warning) { var lineInfo = rawProject.Value(option); if (lineInfo == null) @@ -855,7 +863,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel ErrorCodes.DOTNET1015, $"The '{option}' option is deprecated. Use {message} instead.", project.ProjectFilePath, - DiagnosticMessageSeverity.Warning, + severity, lineInfo.LineNumber, lineInfo.LinePosition)); } @@ -896,7 +904,6 @@ namespace Microsoft.DotNet.Internal.ProjectModel ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude"); ConvertFromDeprecatedFormat(rawProject, jpath, "resourceExclude", "excludeFiles"); ConvertFromDeprecatedFormat(rawProject, jpath, "resourceFiles", "includeFiles"); - ConvertFromDeprecatedFormat(rawProject, jpath, "namedResource", "mappings"); ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "resourceBuiltIn", "include"); } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index 7b2a31446..37cc20b50 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -252,11 +252,26 @@ namespace Microsoft.DotNet.ProjectJsonMigration var diagnostics = defaultProjectContext.ProjectFile.Diagnostics; if (diagnostics.Any()) { - var deprecatedProjectJsonWarnings = string.Join( - Environment.NewLine, - diagnostics.Select(d => FormatDiagnosticMessage(d))); - var warnings = $"{projectDirectory}{Environment.NewLine}{deprecatedProjectJsonWarnings}"; - Reporter.Output.WriteLine(warnings.Yellow()); + var warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning); + if (warnings.Any()) + { + var deprecatedProjectJsonWarnings = string.Join( + Environment.NewLine, + diagnostics.Select(d => FormatDiagnosticMessage(d))); + var warningMessage = $"{projectDirectory}{Environment.NewLine}{deprecatedProjectJsonWarnings}"; + Reporter.Output.WriteLine(warningMessage.Yellow()); + } + + var errors = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Error); + if (errors.Any()) + { + MigrationErrorCodes.MIGRATE1011(String.Format( + "{0}{1}{2}", + projectDirectory, + Environment.NewLine, + string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d))))) + .Throw(); + } } var compilerName = diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs index d1cb75935..e0111f385 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs @@ -6,6 +6,7 @@ using FluentAssertions; using Microsoft.Build.Construction; using Microsoft.DotNet.ProjectJsonMigration.Rules; using Microsoft.DotNet.Internal.ProjectModel; +using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Common; using Microsoft.DotNet.Tools.Test.Utilities; using NuGet.Frameworks; @@ -38,6 +39,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } } + [Fact] + public void ItHasErrorWhenMigratingADeprecatedNamedResourceOptionProjectJson() + { + var testProjectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedNamedResourceOption") + .CreateInstance() + .WithSourceFiles() + .Root + .FullName; + + var mockProj = ProjectRootElement.Create(); + var testSettings = MigrationSettings.CreateMigrationSettingsTestHook( + testProjectDirectory, + testProjectDirectory, + mockProj); + + var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); + var report = projectMigrator.Migrate(testSettings); + + var projectReport = report.ProjectMigrationReports.First(); + var errorMessage = projectReport.Errors.First().GetFormattedErrorMessage(); + errorMessage.Should().Contain("MIGRATE1011::Deprecated Project:"); + errorMessage.Should().Contain("The 'namedResource' option is deprecated. Use 'embed' in 'buildOptions' instead. (line: 3, file:"); + } + [Fact] public void ItHasErrorWhenMigratingANonCsharpApp() { From 85ec8a6f2c56f6e0f3d7bde7807162ae36f2559b Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Wed, 25 Jan 2017 23:48:31 -0800 Subject: [PATCH 33/88] Fixing our solution tests so that they go back to building the solution. Seems to work now, at least on OSX. Also, made a change to update solution to update any solutions in the folder where dotnet migrate is executed. --- .../TestApp/src/subdir/subdir.csproj | 6 -- .../TestApp/TestAssets/TestAsset/Program.cs | 4 +- .../ProjectDependencyFinder.cs | 2 +- .../TestAssetInstance.cs | 9 +++ .../commands/dotnet-migrate/MigrateCommand.cs | 39 ++++++++---- .../Rules/PackageDependenciesTestBase.cs | 4 +- .../TemporaryProjectFileRuleRunner.cs | 10 +++ .../GivenThatIWantToMigrateSolutions.cs | 61 +++++++++++++++++-- .../GivenThatIWantToMigrateTestApps.cs | 23 +++++++ 9 files changed, 132 insertions(+), 26 deletions(-) diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj/TestApp/src/subdir/subdir.csproj b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj/TestApp/src/subdir/subdir.csproj index cec816e3f..731464ac2 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj/TestApp/src/subdir/subdir.csproj +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj/TestApp/src/subdir/subdir.csproj @@ -8,12 +8,6 @@ F8F96F4A-F10C-4C54-867C-A9EFF55494C8 - - - - - - 1.6.0 diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefs/TestApp/TestAssets/TestAsset/Program.cs b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefs/TestApp/TestAssets/TestAsset/Program.cs index c56978bf5..2906f8bbf 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefs/TestApp/TestAssets/TestAsset/Program.cs +++ b/TestAssets/NonRestoredTestProjects/PJAppWithSlnAndXprojRefs/TestApp/TestAssets/TestAsset/Program.cs @@ -2,9 +2,9 @@ using System; namespace App.Tests { - public class Program + public class TestAssetProgram { - public static void Main(string[] args) + public static void TestAssetMain(string[] args) { Console.WriteLine("Hello World!"); } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs index 380a9a435..d8332258a 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectDependencyFinder.cs @@ -314,7 +314,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration } foreach (var projectDirectory in - Enumerable.Repeat(directory, 1).Union(directory.GetDirectories())) + Enumerable.Repeat(directory, 1).Union(directory.GetDirectories("*", SearchOption.AllDirectories))) { AddIfProjectExists(projects, projectDirectory); } diff --git a/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs b/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs index ea942eb65..3fc98f0a4 100644 --- a/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs +++ b/src/Microsoft.DotNet.TestFramework/TestAssetInstance.cs @@ -104,6 +104,15 @@ namespace Microsoft.DotNet.TestFramework return this; } + public TestAssetInstance WithEmptyGlobalJson() + { + var file = Root.Parent.GetFile("global.json"); + + File.WriteAllText(file.FullName, @"{}"); + + return this; + } + private void CopyFiles(IEnumerable filesToCopy) { foreach (var file in filesToCopy) diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index b50aca8d1..ea66ed320 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -103,7 +103,24 @@ namespace Microsoft.DotNet.Tools.Migrate private void UpdateSolutionFile(MigrationReport migrationReport) { - if (_slnFile == null) + if(_slnFile != null) + { + UpdateSolutionFile(migrationReport, _slnFile); + } + else + { + foreach (var slnPath in _workspaceDirectory.EnumerateFiles("*.sln")) + { + var slnFile = SlnFile.Read(slnPath.FullName); + + UpdateSolutionFile(migrationReport, slnFile); + } + } + } + + private void UpdateSolutionFile(MigrationReport migrationReport, SlnFile slnFile) + { + if (slnFile == null) { return; } @@ -115,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Migrate var csprojFilesToAdd = new HashSet(); - var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(_slnFile.BaseDirectory); + var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory); foreach (var report in migrationReport.ProjectMigrationReports) { var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory); @@ -124,7 +141,7 @@ namespace Microsoft.DotNet.Tools.Migrate reportPathWithTrailingSlash); var xprojPath = Path.Combine(relativeReportPath, report.ProjectName + ".xproj"); - var xprojProjectsReferencedBySolution = _slnFile.Projects.Where(p => p.FilePath == xprojPath); + var xprojProjectsReferencedBySolution = slnFile.Projects.Where(p => p.FilePath == xprojPath); var migratedProjectName = report.ProjectName + ".csproj"; if (xprojProjectsReferencedBySolution.Count() == 1) @@ -138,7 +155,7 @@ namespace Microsoft.DotNet.Tools.Migrate else { var csprojPath = Path.Combine(relativeReportPath, migratedProjectName); - var solutionContainsCsprojPriorToMigration = _slnFile.Projects + var solutionContainsCsprojPriorToMigration = slnFile.Projects .Where(p => p.FilePath == csprojPath) .Any(); @@ -155,20 +172,20 @@ namespace Microsoft.DotNet.Tools.Migrate } Version version; - if (!Version.TryParse(_slnFile.VisualStudioVersion, out version) || version.Major < 15) + if (!Version.TryParse(slnFile.VisualStudioVersion, out version) || version.Major < 15) { - _slnFile.ProductDescription = ProductDescription; - _slnFile.VisualStudioVersion = VisualStudioVersion; - _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; + slnFile.ProductDescription = ProductDescription; + slnFile.VisualStudioVersion = VisualStudioVersion; + slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion; } - RemoveReferencesToMigratedFiles(_slnFile); + RemoveReferencesToMigratedFiles(slnFile); - _slnFile.Write(); + slnFile.Write(); foreach (var csprojFile in csprojFilesToAdd) { - AddProject(_slnFile.FullPath, csprojFile); + AddProject(slnFile.FullPath, csprojFile); } } diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs index e0eb3a99e..6df9528cb 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs @@ -48,7 +48,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests protected ProjectRootElement RunPackageDependenciesRuleOnPj(string s, string testDirectory = null) { - testDirectory = testDirectory ?? Temp.CreateDirectory().Path; + testDirectory = + testDirectory ?? + Temp.CreateDirectory().DirectoryInfo.CreateSubdirectory("project").FullName; return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[] { new MigratePackageDependenciesAndToolsRule() diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs index f574e26a6..e2aed119b 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs @@ -3,7 +3,9 @@ using System.Linq; using Microsoft.Build.Construction; using Microsoft.DotNet.ProjectJsonMigration.Rules; using Microsoft.DotNet.Internal.ProjectModel; +using Microsoft.DotNet.TestFramework; using NuGet.Frameworks; +using System.IO; namespace Microsoft.DotNet.ProjectJsonMigration.Tests { @@ -23,6 +25,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests string projectDirectory, string json) { + + var globalJson = Path.Combine(new DirectoryInfo(projectDirectory).Parent.FullName, "global.json"); + if (!File.Exists(globalJson)) + { + var file = new FileInfo(globalJson); + File.WriteAllText(file.FullName, @"{}"); + } + var testPj = new ProjectJsonBuilder(null) .FromStringBase(json) .SaveToDisk(projectDirectory); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index cbfa8ba50..622f0b27f 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, projectName) .CreateInstance(identifier: projectName) .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var solutionRelPath = "TestApp.sln"; @@ -58,6 +59,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndXprojRefs") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var solutionRelPath = Path.Combine("TestApp", "TestApp.sln"); @@ -103,6 +105,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("NonRestoredTestProjects", "PJAppWithSlnAndOneAlreadyMigratedCsproj") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var solutionRelPath = Path.Combine("TestApp", "TestApp.sln"); @@ -136,6 +139,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndOneAlreadyMigratedCsproj") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var solutionRelPath = Path.Combine("TestApp", "TestApp.sln"); @@ -184,12 +188,60 @@ namespace Microsoft.DotNet.Migration.Tests } } + [Fact] + public void ItMigratesSolutionInTheFolderWhenWeRunMigrationInThatFolder() + { + var projectDirectory = TestAssets + .Get("NonRestoredTestProjects", "PJAppWithSlnAndXprojRefs") + .CreateInstance() + .WithSourceFiles() + .WithEmptyGlobalJson() + .Root; + + var workingDirectory = new DirectoryInfo(Path.Combine(projectDirectory.FullName, "TestApp")); + var solutionRelPath = Path.Combine("TestApp", "TestApp.sln"); + + new DotnetCommand() + .WithWorkingDirectory(workingDirectory) + .Execute($"migrate") + .Should().Pass(); + + SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); + + var nonSolutionFolderProjects = slnFile.Projects + .Where(p => p.TypeGuid != ProjectTypeGuids.SolutionFolderGuid); + + nonSolutionFolderProjects.Count().Should().Be(4); + + var slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "TestApp").Single(); + slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid); + slnProject.FilePath.Should().Be("TestApp.csproj"); + + slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "TestLibrary").Single(); + slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid); + slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj")); + + slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "subdir").Single(); + slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj")); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute($"restore \"{solutionRelPath}\"") + .Should().Pass(); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute($"build \"{solutionRelPath}\"") + .Should().Pass(); + } + private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") { var projectDirectory = TestAssets .Get(groupName, projectName) .CreateInstance(callingMethod: callingMethod, identifier: identifier) .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var solutionRelPath = Path.Combine("TestApp", "TestApp.sln"); @@ -204,11 +256,10 @@ namespace Microsoft.DotNet.Migration.Tests .Execute($"restore \"{solutionRelPath}\"") .Should().Pass(); - //ISSUE: https://github.com/dotnet/cli/issues/5205 - //new DotnetCommand() - // .WithWorkingDirectory(projectDirectory) - // .Execute($"build \"{solutionRelPath}\"") - // .Should().Pass(); + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute($"build \"{solutionRelPath}\"") + .Should().Pass(); SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index c569c6cc6..434065c55 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -34,6 +34,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectName) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; CleanBinObj(projectDirectory); @@ -68,6 +69,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectName) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; CleanBinObj(projectDirectory); @@ -87,6 +89,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; CleanBinObj(projectDirectory); @@ -115,6 +118,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("ProjectJsonConsoleTemplate") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var outputComparisonData = GetComparisonData(projectDirectory); @@ -140,6 +144,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var globalDirectory = projectDirectory.Parent; @@ -168,6 +173,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson(projectName) .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; File.Copy("NuGet.tempaspnetpatch.config", projectDirectory.GetFile("NuGet.Config").FullName); @@ -185,6 +191,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("AppWithPackageNamedAfterFolder") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var appProject = solutionDirectory @@ -209,6 +216,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; MigrateProject(projectDirectory.GetDirectory(dependencyProject).FullName); @@ -224,6 +232,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var globalDirectory = projectDirectory.Parent; @@ -245,6 +254,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectName) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName); @@ -270,6 +280,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectName) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName); @@ -296,6 +307,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectName) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild( @@ -326,6 +338,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance(identifier: $"{projectName}.RefsTest") .WithSourceFiles() + .WithEmptyGlobalJson() .Root; MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName }); @@ -347,6 +360,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance($"{projectName}.SkipRefsTest") .WithSourceFiles() + .WithEmptyGlobalJson() .Root; MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName, "--skip-project-references" }); @@ -363,6 +377,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance(callingMethod: $"MigrateDirectory.SkipRefs.{skipRefs}") .WithSourceFiles() + .WithEmptyGlobalJson() .Root; if (skipRefs) @@ -386,6 +401,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var project = projectDirectory @@ -408,6 +424,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var projectDirectory = assetsDir.GetDirectory("ProjectF"); @@ -443,6 +460,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance(identifier: projectNameSuffix) .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var projectName = $"Project{projectNameSuffix}"; @@ -532,6 +550,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; CleanBinObj(projectDirectory); @@ -551,6 +570,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; CleanBinObj(projectDirectory); @@ -570,6 +590,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson("TestAppDependencyGraph") .CreateInstance() .WithSourceFiles() + .WithEmptyGlobalJson() .Root; var projectDirectory = solutionDirectory.GetDirectory(projectName); @@ -594,6 +615,7 @@ namespace Microsoft.DotNet.Migration.Tests .CreateInstance() .WithSourceFiles() .WithRestoreFiles() + .WithEmptyGlobalJson() .Root; var expectedCsprojPath = projectDirectory.GetFile($"{projectName}.csproj"); @@ -634,6 +656,7 @@ namespace Microsoft.DotNet.Migration.Tests .GetProjectJson(projectName) .CreateInstance(identifier: projectName) .WithSourceFiles() + .WithEmptyGlobalJson() .Root; MigrateProject(projectDirectory.FullName); From 537d78d2a6acea835878b2345dc9e29742374b6f Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 26 Jan 2017 10:06:31 -0800 Subject: [PATCH 34/88] Fixing test failures. One of them, is a known issue that still reproes intermittently. The other was some left over code that was causing problems. --- ...enThatIWantToMigratePackageDependencies.cs | 45 ------------------- .../Rules/PackageDependenciesTestBase.cs | 7 ++- .../GivenThatIWantToMigrateSolutions.cs | 18 ++++---- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs index 3067b567a..755abacde 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs @@ -435,50 +435,5 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.Should().ContainSingle( i => (i.Include == "NETStandard.Library" && i.ItemType == "PackageReference")); } - - new private void EmitsPackageReferences(ProjectRootElement mockProj, params Tuple[] packageSpecs) - { - foreach (var packageSpec in packageSpecs) - { - var packageName = packageSpec.Item1; - var packageVersion = packageSpec.Item2; - var packageTFM = packageSpec.Item3; - - var items = mockProj.Items - .Where(i => i.ItemType == "PackageReference") - .Where(i => string.IsNullOrEmpty(packageTFM) || i.ConditionChain().Any(c => c.Contains(packageTFM))) - .Where(i => i.Include == packageName) - .Where(i => i.GetMetadataWithName("Version").Value == packageVersion && - i.GetMetadataWithName("Version").ExpressedAsAttribute); - - items.Should().HaveCount(1); - } - } - - new private void EmitsToolReferences(ProjectRootElement mockProj, params Tuple[] toolSpecs) - { - foreach (var toolSpec in toolSpecs) - { - var packageName = toolSpec.Item1; - var packageVersion = toolSpec.Item2; - - var items = mockProj.Items - .Where(i => i.ItemType == "DotNetCliToolReference") - .Where(i => i.Include == packageName) - .Where(i => i.GetMetadataWithName("Version").Value == packageVersion && - i.GetMetadataWithName("Version").ExpressedAsAttribute); - - items.Should().HaveCount(1); - } - } - - new private ProjectRootElement RunPackageDependenciesRuleOnPj(string s, string testDirectory = null) - { - testDirectory = testDirectory ?? Temp.CreateDirectory().Path; - return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[] - { - new MigratePackageDependenciesAndToolsRule() - }, s, testDirectory); - } } } \ No newline at end of file diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs index 6df9528cb..9a5526646 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/PackageDependenciesTestBase.cs @@ -24,7 +24,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests .Where(i => i.ItemType == "PackageReference") .Where(i => string.IsNullOrEmpty(packageTFM) || i.ConditionChain().Any(c => c.Contains(packageTFM))) .Where(i => i.Include == packageName) - .Where(i => i.GetMetadataWithName("Version").Value == packageVersion); + .Where(i => i.GetMetadataWithName("Version").Value == packageVersion && + i.GetMetadataWithName("Version").ExpressedAsAttribute); items.Should().HaveCount(1); } @@ -40,7 +41,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests var items = mockProj.Items .Where(i => i.ItemType == "DotNetCliToolReference") .Where(i => i.Include == packageName) - .Where(i => i.GetMetadataWithName("Version").Value == packageVersion); + .Where(i => i.GetMetadataWithName("Version").Value == packageVersion && + i.GetMetadataWithName("Version").ExpressedAsAttribute); items.Should().HaveCount(1); } @@ -51,6 +53,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests testDirectory = testDirectory ?? Temp.CreateDirectory().DirectoryInfo.CreateSubdirectory("project").FullName; + return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[] { new MigratePackageDependenciesAndToolsRule() diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 622f0b27f..330baa6e0 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -229,10 +229,11 @@ namespace Microsoft.DotNet.Migration.Tests .Execute($"restore \"{solutionRelPath}\"") .Should().Pass(); - new DotnetCommand() - .WithWorkingDirectory(projectDirectory) - .Execute($"build \"{solutionRelPath}\"") - .Should().Pass(); + //ISSUE: https://github.com/dotnet/cli/issues/5205 + //new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .Execute($"build \"{solutionRelPath}\"") + // .Should().Pass(); } private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") @@ -256,10 +257,11 @@ namespace Microsoft.DotNet.Migration.Tests .Execute($"restore \"{solutionRelPath}\"") .Should().Pass(); - new DotnetCommand() - .WithWorkingDirectory(projectDirectory) - .Execute($"build \"{solutionRelPath}\"") - .Should().Pass(); + //ISSUE: https://github.com/dotnet/cli/issues/5205 + //new DotnetCommand() + // .WithWorkingDirectory(projectDirectory) + // .Execute($"build \"{solutionRelPath}\"") + // .Should().Pass(); SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath)); From 40c0c41cde38c5694991fbad7ada192311fcba8c Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Thu, 26 Jan 2017 12:40:29 -0800 Subject: [PATCH 35/88] Handling a potential race condition when writing global.json during migration. --- .../TemporaryProjectFileRuleRunner.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs index e2aed119b..e8b7484ed 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/TemporaryProjectFileRuleRunner.cs @@ -30,7 +30,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests if (!File.Exists(globalJson)) { var file = new FileInfo(globalJson); - File.WriteAllText(file.FullName, @"{}"); + try + { + File.WriteAllText(file.FullName, @"{}"); + } + catch (IOException) + { + //this means there is someone else writing to the file already. So, just ignore it. + } } var testPj = new ProjectJsonBuilder(null) From c3e6994728c09b325992466f6cc21c92f2615322 Mon Sep 17 00:00:00 2001 From: Nate Amundson Date: Thu, 26 Jan 2017 12:47:08 -0800 Subject: [PATCH 36/88] Fix yum package conflict in Docker image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running the CLI builds on the new build agents, the CentOS build failed with the following error: 2017-01-26T20:39:30.0800810Z Step 4 : RUN yum -q -y install unzip libunwind gettext libcurl-devel openssl-devel zlib libicu-devel 2017-01-26T20:39:30.3020500Z ---> Running in 97affb106685 2017-01-26T20:39:40.3872390Z Error: libselinux conflicts with fakesystemd-1-17.el7.centos.noarch Swapping the the "fakesystemd" package with the real "systemd" package fixed the issue, which was recommended in http://stackoverflow.com/a/36632668. This issue hasn't been seen on the official builds because the build agents in that pool have the Docker image cached, and they are using an older version of the centos:7.1.1503 image which appears not to have this issue. --- scripts/docker/centos/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/docker/centos/Dockerfile b/scripts/docker/centos/Dockerfile index ae3e87d6a..6bba0fb81 100644 --- a/scripts/docker/centos/Dockerfile +++ b/scripts/docker/centos/Dockerfile @@ -6,6 +6,10 @@ # Dockerfile that creates a container suitable to build dotnet-cli FROM centos:7.1.1503 +# Swap the "fakesystemd" package with the real "systemd" package, because fakesystemd conflicts with openssl-devel. +# The CentOS Docker image uses fakesystemd instead of systemd to reduce disk space. +RUN yum -q -y swap -- remove fakesystemd -- install systemd systemd-libs + RUN yum -q -y install deltarpm RUN yum -q -y install epel-release # RUN yum -y update From 3821d39d6cdc46b64b8b97e1a873e9a69b3c3296 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 12:53:29 -0800 Subject: [PATCH 37/88] Address PR comments --- .../ProjectReader.cs | 30 +++++++-------- .../ProjectMigrator.cs | 38 +++++++++++++------ .../commands/dotnet-migrate/MigrateCommand.cs | 17 +++++++++ .../GivenAProjectMigrator.cs | 26 +++++++++++++ ...venThatIWantToMigrateDeprecatedProjects.cs | 8 ++-- 5 files changed, 88 insertions(+), 31 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs index 1b20a58af..7a2778d9c 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.Internal.ProjectModel/ProjectReader.cs @@ -955,6 +955,21 @@ namespace Microsoft.DotNet.Internal.ProjectModel return (rawProject.SelectToken(jpathToNewFormatObject) != null); } + private static void ConvertFromDeprecatedFormat( + JObject rawProject, + string jpathToObject, + string deprecatedKey, + string newKey + ) + { + var deprecatedValue = rawProject.Value(deprecatedKey); + if (deprecatedValue != null) + { + var objectNode = GetOrCreateObjectHierarchy(rawProject, jpathToObject); + objectNode[newKey] = deprecatedValue.DeepClone(); + } + } + private static JObject GetOrCreateObjectHierarchy(JObject rawProject, string jpath) { var currentObject = rawProject as JObject; @@ -973,21 +988,6 @@ namespace Microsoft.DotNet.Internal.ProjectModel return currentObject; } - - private static void ConvertFromDeprecatedFormat( - JObject rawProject, - string jpathToObject, - string deprecatedKey, - string newKey - ) - { - var deprecatedValue = rawProject.Value(deprecatedKey); - if (deprecatedValue != null) - { - var objectNode = GetOrCreateObjectHierarchy(rawProject, jpathToObject); - objectNode[newKey] = deprecatedValue.DeepClone(); - } - } private static bool TryGetStringEnumerable(JToken token, out IEnumerable result) { diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index 37cc20b50..2554ee9c8 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -42,10 +42,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration IEnumerable projectDependencies = null; var projectMigrationReports = new List(); + List warnings = null; try { // Verify up front so we can prefer these errors over an unresolved project dependency - VerifyInputs(rootInputs, rootSettings); + VerifyInputs(rootInputs, rootSettings, out warnings); projectMigrationReports.Add(MigrateProject(rootSettings)); @@ -68,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration rootSettings.ProjectDirectory, rootInputs?.DefaultProjectContext?.GetProjectName(), new List {e.Error}, - null) + warnings) }); } @@ -144,6 +145,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration var projectName = migrationRuleInputs.DefaultProjectContext.GetProjectName(); var outputProject = Path.Combine(migrationSettings.OutputDirectory, projectName + ".csproj"); + List warnings = null; try { if (File.Exists(outputProject)) @@ -166,7 +168,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration } } - VerifyInputs(migrationRuleInputs, migrationSettings); + VerifyInputs(migrationRuleInputs, migrationSettings, out warnings); SetupOutputDirectory(migrationSettings.ProjectDirectory, migrationSettings.OutputDirectory); @@ -179,7 +181,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration exc.Error }; - return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, null); + return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, warnings); } List csprojDependencies = null; @@ -208,7 +210,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration projectName, outputProject, null, - null, + warnings, csprojDependencies); } @@ -235,13 +237,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration return new MigrationRuleInputs(projectContexts, templateMSBuildProject, itemGroup, propertyGroup, xproj); } - private void VerifyInputs(MigrationRuleInputs migrationRuleInputs, MigrationSettings migrationSettings) + private void VerifyInputs( + MigrationRuleInputs migrationRuleInputs, + MigrationSettings migrationSettings, + out List warningMessages + ) { - VerifyProject(migrationRuleInputs.ProjectContexts, migrationSettings.ProjectDirectory); + VerifyProject(migrationRuleInputs.ProjectContexts, migrationSettings.ProjectDirectory, out warningMessages); } - private void VerifyProject(IEnumerable projectContexts, string projectDirectory) + private void VerifyProject( + IEnumerable projectContexts, + string projectDirectory, + out List warningMessages) { + warningMessages = null; + if (!projectContexts.Any()) { MigrationErrorCodes.MIGRATE1013(String.Format(LocalizableStrings.MIGRATE1013Arg, projectDirectory)).Throw(); @@ -255,11 +266,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration var warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning); if (warnings.Any()) { - var deprecatedProjectJsonWarnings = string.Join( + var migrationError = MigrationErrorCodes.MIGRATE1011(String.Format( + "{0}{1}{2}", + projectDirectory, Environment.NewLine, - diagnostics.Select(d => FormatDiagnosticMessage(d))); - var warningMessage = $"{projectDirectory}{Environment.NewLine}{deprecatedProjectJsonWarnings}"; - Reporter.Output.WriteLine(warningMessage.Yellow()); + string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d))))); + + warningMessages = new List(); + warningMessages.Add(migrationError.GetFormattedErrorMessage()); } var errors = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Error); diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index b50aca8d1..196339c1f 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -262,6 +262,8 @@ namespace Microsoft.DotNet.Tools.Migrate { var errorContent = GetProjectReportErrorContent(projectMigrationReport, colored: true); var successContent = GetProjectReportSuccessContent(projectMigrationReport, colored: true); + var warningContent = GetProjectReportWarningContent(projectMigrationReport, colored: true); + Reporter.Output.WriteLine(warningContent); if (!string.IsNullOrEmpty(errorContent)) { Reporter.Error.WriteLine(errorContent); @@ -290,6 +292,8 @@ namespace Microsoft.DotNet.Tools.Migrate { var errorContent = GetProjectReportErrorContent(projectMigrationReport, colored: colored); var successContent = GetProjectReportSuccessContent(projectMigrationReport, colored: colored); + var warningContent = GetProjectReportWarningContent(projectMigrationReport, colored: colored); + sb.AppendLine(warningContent); if (!string.IsNullOrEmpty(errorContent)) { sb.AppendLine(errorContent); @@ -331,6 +335,19 @@ namespace Microsoft.DotNet.Tools.Migrate projectMigrationReport.ProjectDirectory)); } + private string GetProjectReportWarningContent(ProjectMigrationReport projectMigrationReport, bool colored) + { + StringBuilder sb = new StringBuilder(); + Func YellowIfColored = (str) => colored ? str.Yellow() : str; + + foreach (var warning in projectMigrationReport.Warnings) + { + sb.AppendLine(YellowIfColored(warning)); + } + + return sb.ToString(); + } + private string GetProjectReportErrorContent(ProjectMigrationReport projectMigrationReport, bool colored) { StringBuilder sb = new StringBuilder(); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs index e0111f385..e6ca62262 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs @@ -39,6 +39,32 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } } + [Fact] + public void ItHasWarningWhenMigratingADeprecatedProjectJson() + { + var testProjectDirectory = TestAssets + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .CreateInstance() + .WithSourceFiles() + .Root + .GetDirectory("project") + .FullName; + + var mockProj = ProjectRootElement.Create(); + var testSettings = MigrationSettings.CreateMigrationSettingsTestHook( + testProjectDirectory, + testProjectDirectory, + mockProj); + + var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule()); + var report = projectMigrator.Migrate(testSettings); + + var projectReport = report.ProjectMigrationReports.First(); + var warningMessage = projectReport.Warnings.First(); + warningMessage.Should().Contain("MIGRATE1011::Deprecated Project:"); + warningMessage.Should().Contain("The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead. (line: 3, file:"); + } + [Fact] public void ItHasErrorWhenMigratingADeprecatedNamedResourceOptionProjectJson() { diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index 419f50f29..3229a333e 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -72,12 +72,12 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("pack") + .Execute("pack -c Debug") .Should().Pass(); var outputDir = projectDirectory.GetDirectory("bin", "Debug"); @@ -212,12 +212,12 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("publish") + .Execute("publish -c Debug") .Should().Pass(); var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0"); From d87653a7c67ae2ce2b42fed4f9787d6de92f9992 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 14:32:41 -0800 Subject: [PATCH 38/88] Update tests --- ...venThatIWantToMigrateDeprecatedProjects.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index 3229a333e..ba8b049c1 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -161,7 +161,7 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); } @@ -290,7 +290,7 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); } @@ -336,7 +336,7 @@ namespace Microsoft.DotNet.Migration.Tests //Issue: https://github.com/dotnet/cli/issues/5467 //new DotnetCommand() // .WithWorkingDirectory(projectDirectory) - // .Execute("build") + // .Execute("build -c Debug") // .Should().Pass(); } @@ -381,7 +381,7 @@ namespace Microsoft.DotNet.Migration.Tests // Issue: https://github.com/dotnet/cli/issues/5461 //new DotnetCommand() // .WithWorkingDirectory(projectDirectory) - // .Execute("build") + // .Execute("build -c Debug") // .Should().Pass(); } @@ -429,12 +429,12 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); var cmd = new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .ExecuteWithCapturedOutput("run"); + .ExecuteWithCapturedOutput("run -c Debug"); cmd.Should().Pass(); cmd.StdOut.Should().Contain("3 Resources Found:"); } @@ -481,12 +481,12 @@ namespace Microsoft.DotNet.Migration.Tests new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .Execute("build") + .Execute("build -c Debug") .Should().Pass(); var cmd = new DotnetCommand() .WithWorkingDirectory(projectDirectory) - .ExecuteWithCapturedOutput("run"); + .ExecuteWithCapturedOutput("run -c Debug"); cmd.Should().Pass(); // Issue: https://github.com/dotnet/cli/issues/5467 //cmd.StdOut.Should().Contain("2 Resources Found:"); @@ -533,12 +533,12 @@ namespace Microsoft.DotNet.Migration.Tests // Issue: https://github.com/dotnet/cli/issues/5461 //new DotnetCommand() // .WithWorkingDirectory(projectDirectory) - // .Execute("build") + // .Execute("build -c Debug") // .Should().Pass(); //var cmd = new DotnetCommand() // .WithWorkingDirectory(projectDirectory) - // .ExecuteWithCapturedOutput("run"); + // .ExecuteWithCapturedOutput("run -c Debug"); //cmd.Should().Pass(); //cmd.StdOut.Should().Contain("0 Resources Found:"); } From 0073fc85342049fc97a746cfd21926996e3ecefb Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 4 Jan 2017 15:27:41 -0600 Subject: [PATCH 39/88] Update CLI to run on netcoreapp1.1. --- build.proj | 14 +++++----- build/Microsoft.DotNet.Cli.Compile.targets | 22 +++++++++++---- .../Microsoft.DotNet.Cli.LzmaArchive.targets | 4 +-- .../dotnet-cli-build/dotnet-cli-build.csproj | 6 ++--- ...crosoft.DotNet.ProjectJsonMigration.csproj | 1 + src/dotnet-archive/dotnet-archive.csproj | 4 +-- src/dotnet/dotnet.csproj | 27 ++++++++++--------- src/redist/redist.csproj | 8 +++--- src/tool_msbuild/tool_msbuild.csproj | 4 +-- src/tool_nuget/tool_nuget.csproj | 4 +-- .../ArgumentsReflector.csproj | 11 ++++++-- .../dotnet-add-reference.Tests.csproj | 6 ++--- tools/Archiver/Archiver.csproj | 4 +-- .../MigrationDefaultsConstructor.csproj | 6 ++--- 14 files changed, 71 insertions(+), 50 deletions(-) diff --git a/build.proj b/build.proj index 8e9fd472e..b03807f06 100644 --- a/build.proj +++ b/build.proj @@ -17,14 +17,14 @@ Debug - preview + release/1.1.0 Microsoft.NETCore.App - 1.0.3 - 1.0.1 - 1.0.1 + 1.1.0 + 1.1.0 + 1.1.0 - 1.0.5 - 1.0.5 + 1.1.0 + 1.1.0 .exe @@ -54,7 +54,7 @@ DependsOnTargets="MSBuildWorkaroundTarget; RestoreDotnetCliBuildFramework"> - diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 9718ecf7d..286b07814 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -81,10 +81,16 @@ - - - - + + + + + + + + + + @@ -146,7 +152,11 @@ + AssetPath="$(BinaryToCorehostifyRelDir)/%(RuntimeTargetsAssetsToRemoveFromDeps.Identity).exe" /> + + @@ -160,7 +170,9 @@ + + - - + Build scripts for dotnet-cli 1.0.0 - netcoreapp1.0 + netcoreapp1.1 true bin\$(Configuration) - $(PackageTargetFallback);portable-net45+win8+wp8+wpa81 + $(PackageTargetFallback);portable-net45+win8+wp8+wpa81 @@ -17,7 +17,7 @@ 1.6.0 - 1.0.4 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj index 06346c987..1b96e6ef4 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj @@ -4,6 +4,7 @@ $(CliVersionPrefix) netcoreapp1.0 + netcoreapp1.1 true ../../tools/Key.snk true diff --git a/src/dotnet-archive/dotnet-archive.csproj b/src/dotnet-archive/dotnet-archive.csproj index 1b6c8e41c..3bf1aba42 100644 --- a/src/dotnet-archive/dotnet-archive.csproj +++ b/src/dotnet-archive/dotnet-archive.csproj @@ -2,7 +2,7 @@ - netcoreapp1.0 + netcoreapp1.1 Exe @@ -13,7 +13,7 @@ - 1.0.3 + 1.1.0 diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index c2f1a9fad..6d262e0c4 100755 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -3,13 +3,14 @@ $(CliVersionPrefix) - netcoreapp1.0 + 1.0.0-preview5 + netcoreapp1.1 dotnet Exe ../../tools/Key.snk true true - $(PackageTargetFallback);dotnet5.4 + $(PackageTargetFallback);dotnet5.4 @@ -32,44 +33,44 @@ 9.0.1 - 4.0.1 + 4.3.0 - 4.0.0 + 4.3.0 2.0.0 - 1.0.3 + 1.1.0 - 4.0.0 + 4.3.0 - 4.0.0 + 4.3.0 - 4.0.0 + 4.3.0 - 4.1.1 + 4.3.0 - 4.1.1 + 4.3.0 - 4.1.0 + 4.3.0 - 4.0.0 + 4.3.0 Analyzers;Build;ContentFiles;Native;Runtime $(CLI_MSBuild_Version) - 1.0.1-beta-000933 + 1.1.0 diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 02884fadb..1682bddfc 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -3,13 +3,13 @@ $(CliVersionPrefix) - netcoreapp1.0 + netcoreapp1.1 true - $(PackageTargetFallback);dotnet5.4 + $(PackageTargetFallback);dotnet5.4 - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) @@ -24,7 +24,7 @@ $(CLI_TestPlatform_Version) - + diff --git a/src/tool_msbuild/tool_msbuild.csproj b/src/tool_msbuild/tool_msbuild.csproj index 40082b920..006bbeec2 100644 --- a/src/tool_msbuild/tool_msbuild.csproj +++ b/src/tool_msbuild/tool_msbuild.csproj @@ -3,11 +3,11 @@ $(CliVersionPrefix) - netcoreapp1.0 + netcoreapp1.1 - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/src/tool_nuget/tool_nuget.csproj b/src/tool_nuget/tool_nuget.csproj index a9163b695..163953ae9 100644 --- a/src/tool_nuget/tool_nuget.csproj +++ b/src/tool_nuget/tool_nuget.csproj @@ -3,11 +3,11 @@ $(CliVersionPrefix) - netcoreapp1.0 + netcoreapp1.1 - 1.0.3 + 1.1.0 $(CLI_NuGet_Version) diff --git a/test/ArgumentsReflector/ArgumentsReflector.csproj b/test/ArgumentsReflector/ArgumentsReflector.csproj index 18b1c199a..75dc7fa7c 100644 --- a/test/ArgumentsReflector/ArgumentsReflector.csproj +++ b/test/ArgumentsReflector/ArgumentsReflector.csproj @@ -2,9 +2,10 @@ - netcoreapp1.0 ArgumentsReflector Exe + 1.0.0-preview5 + netcoreapp1.1 @@ -16,7 +17,13 @@ - 1.0.3 + 1.1.0 + + + 2.0.0-beta6-60922-08 + + + 2.0.0-beta6-60922-08 diff --git a/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj b/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj index 09141e8e2..c87f94caa 100644 --- a/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj +++ b/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj @@ -2,7 +2,7 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-add-reference.Tests $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -36,10 +36,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/tools/Archiver/Archiver.csproj b/tools/Archiver/Archiver.csproj index 3d673f7ac..a1d99b659 100644 --- a/tools/Archiver/Archiver.csproj +++ b/tools/Archiver/Archiver.csproj @@ -2,7 +2,7 @@ - netcoreapp1.0 + netcoreapp1.1 Exe win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 @@ -15,7 +15,7 @@ - 1.0.3 + 1.1.0 diff --git a/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj b/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj index c801a1d11..db5f74418 100644 --- a/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj +++ b/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 portable Exe - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 @@ -13,7 +13,7 @@ - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) From cfb4cc3cb90d38e4534b030ae0c6c95e2fd0779f Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 4 Jan 2017 17:57:17 -0600 Subject: [PATCH 40/88] Update tests to netcoreapp1.1. --- .../ArgumentForwardingTests.csproj | 8 +-- .../ArgumentsReflector.csproj | 1 + test/EndToEnd/EndToEnd.csproj | 10 ++-- ...osoft.DotNet.Cli.Sln.Internal.Tests.csproj | 6 +- .../Microsoft.DotNet.Cli.Utils.Tests.csproj | 12 ++-- ...crosoft.DotNet.Configurer.UnitTests.csproj | 8 +-- ...t.DotNet.ProjectJsonMigration.Tests.csproj | 6 +- ...rosoft.DotNet.Tools.Tests.Utilities.csproj | 9 ++- .../Msbuild.Tests.Utilities.csproj | 6 +- test/Performance/Performance.csproj | 55 +++++++++++++++++++ test/crossgen.Tests/crossgen.Tests.csproj | 6 +- .../dotnet-add-reference.Tests.csproj | 2 +- .../dotnet-build.Tests.csproj | 8 +-- .../dotnet-help.Tests.csproj | 6 +- .../dotnet-list-reference.Tests.csproj | 8 +-- .../dotnet-migrate.Tests.csproj | 6 +- .../dotnet-msbuild.Tests.csproj | 6 +- test/dotnet-new.Tests/dotnet-new.Tests.csproj | 6 +- .../dotnet-nuget.UnitTests.csproj | 8 +-- .../dotnet-pack.Tests.csproj | 10 ++-- .../dotnet-publish.Tests.csproj | 8 +-- .../dotnet-remove-reference.Tests.csproj | 8 +-- .../dotnet-restore.Tests.csproj | 6 +- test/dotnet-run.Tests/dotnet-run.Tests.csproj | 8 +-- .../dotnet-sln-add.Tests.csproj | 6 +- .../dotnet-sln-list.Tests.csproj | 6 +- .../dotnet-sln-remove.Tests.csproj | 6 +- .../dotnet-test.Tests.csproj | 8 +-- .../dotnet-vstest.Tests.csproj | 8 +-- test/dotnet.Tests/dotnet.Tests.csproj | 8 +-- .../msbuild.IntegrationTests.csproj | 6 +- 31 files changed, 163 insertions(+), 102 deletions(-) create mode 100644 test/Performance/Performance.csproj diff --git a/test/ArgumentForwardingTests/ArgumentForwardingTests.csproj b/test/ArgumentForwardingTests/ArgumentForwardingTests.csproj index 75377303e..4e2f32f87 100644 --- a/test/ArgumentForwardingTests/ArgumentForwardingTests.csproj +++ b/test/ArgumentForwardingTests/ArgumentForwardingTests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 ArgumentForwardingTests Exe - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -33,10 +33,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/ArgumentsReflector/ArgumentsReflector.csproj b/test/ArgumentsReflector/ArgumentsReflector.csproj index 75dc7fa7c..55412d462 100644 --- a/test/ArgumentsReflector/ArgumentsReflector.csproj +++ b/test/ArgumentsReflector/ArgumentsReflector.csproj @@ -2,6 +2,7 @@ + netcoreapp1.1 ArgumentsReflector Exe 1.0.0-preview5 diff --git a/test/EndToEnd/EndToEnd.csproj b/test/EndToEnd/EndToEnd.csproj index 5949bf3bc..07404de4c 100644 --- a/test/EndToEnd/EndToEnd.csproj +++ b/test/EndToEnd/EndToEnd.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 EndToEnd Exe - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -40,10 +40,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 @@ -52,7 +52,7 @@ 1.0.0-prerelease-00206 - 1.0.1-beta-000933 + 1.1.0 diff --git a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj index 6b5dc5ebd..63f5bd5f6 100644 --- a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj @@ -2,13 +2,13 @@ - netcoreapp1.0 + netcoreapp1.1 true Microsoft.DotNet.Cli.Sln.Internal.Tests ../../tools/test_key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -21,7 +21,7 @@ - 1.0.3 + 1.1.0 $(CLI_TestPlatform_Version) diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj index 479ce5be6..94cf89cb9 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj @@ -2,13 +2,13 @@ - netcoreapp1.0 + netcoreapp1.1 Microsoft.DotNet.Cli.Utils.Tests Exe ../../tools/Key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -48,13 +48,13 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.0.0 + 4.3.0 - 4.1.1 + 4.3.0 $(CLI_NuGet_Version) @@ -75,7 +75,7 @@ 2.2.0-beta4-build3444 - 1.0.1-beta-000933 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj index f4d56da4e..153ac9573 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj +++ b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj @@ -2,13 +2,13 @@ - netcoreapp1.0 + netcoreapp1.1 true Microsoft.DotNet.Configurer.UnitTests ../../tools/Key.snk true true - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -40,10 +40,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.0.0 + 4.3.0 4.0.0 diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj index 9732db55b..1a25cb12b 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj @@ -2,13 +2,13 @@ - netcoreapp1.0 + netcoreapp1.1 true Microsoft.DotNet.ProjectJsonMigration.Tests ../../tools/test_key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -44,7 +44,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj index 32a322248..cce894eb7 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj @@ -3,13 +3,13 @@ Microsoft.DotNet.Tools.Tests.Utilities Class Library - netcoreapp1.0 + netcoreapp1.1 true Microsoft.DotNet.Tools.Tests.Utilities ../../tools/Key.snk true true - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -22,6 +22,11 @@ 4.0.0 + + 1.1.0 + + + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj index 9982648ea..5f97d4ee8 100644 --- a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj +++ b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true Msbuild.Tests.Utilities - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -31,7 +31,7 @@ 1.6.0 - 4.1.1 + 4.3.0 4.0.0 diff --git a/test/Performance/Performance.csproj b/test/Performance/Performance.csproj new file mode 100644 index 000000000..7c295a2be --- /dev/null +++ b/test/Performance/Performance.csproj @@ -0,0 +1,55 @@ + + + + + netcoreapp1.1 + true + Performance + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + + + + + + + true + + + true + + + + + + true + + + + + + 15.0.0-preview-20161024-02 + + + 2.2.0-beta4-build1194 + + + 1.1.0 + + + 4.3.0 + + + 2.2.0-beta4-build3444 + + + 1.0.0-prerelease-00206 + + + 1.0.0-alpha-build0028 + + + + + $(DefineConstants);RELEASE + + diff --git a/test/crossgen.Tests/crossgen.Tests.csproj b/test/crossgen.Tests/crossgen.Tests.csproj index 657fc9dbc..a0db0879b 100644 --- a/test/crossgen.Tests/crossgen.Tests.csproj +++ b/test/crossgen.Tests/crossgen.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true crossgen.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -33,7 +33,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj b/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj index c87f94caa..d7072a465 100644 --- a/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj +++ b/test/dotnet-add-reference.Tests/dotnet-add-reference.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-add-reference.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-build.Tests/dotnet-build.Tests.csproj b/test/dotnet-build.Tests/dotnet-build.Tests.csproj index 3efad2804..3512d696c 100644 --- a/test/dotnet-build.Tests/dotnet-build.Tests.csproj +++ b/test/dotnet-build.Tests/dotnet-build.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-build.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -35,10 +35,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-help.Tests/dotnet-help.Tests.csproj b/test/dotnet-help.Tests/dotnet-help.Tests.csproj index a9b94fe86..0b2aea8f7 100644 --- a/test/dotnet-help.Tests/dotnet-help.Tests.csproj +++ b/test/dotnet-help.Tests/dotnet-help.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-help.Tests - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 @@ -40,7 +40,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj b/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj index e3c8454f4..aa2ce2968 100644 --- a/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj +++ b/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-list-reference.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -36,10 +36,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj index 3dc1cb000..152ae6f53 100644 --- a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj +++ b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-migrate.Tests - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -48,7 +48,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj b/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj index 7907fe5be..cefa0c05a 100644 --- a/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj +++ b/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-msbuild.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -46,7 +46,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 4.1.1 diff --git a/test/dotnet-new.Tests/dotnet-new.Tests.csproj b/test/dotnet-new.Tests/dotnet-new.Tests.csproj index 30e772e67..320d596e4 100644 --- a/test/dotnet-new.Tests/dotnet-new.Tests.csproj +++ b/test/dotnet-new.Tests/dotnet-new.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-new.Tests - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 @@ -46,7 +46,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj index 70805d0f3..d556f90eb 100644 --- a/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj +++ b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-nuget.UnitTests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -46,10 +46,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj b/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj index e0b97e719..721b9ff49 100644 --- a/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj +++ b/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-pack.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -40,13 +40,13 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 - 4.0.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj index fc1d3fad8..8605aeeb5 100644 --- a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj +++ b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-publish.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -42,10 +42,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj b/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj index c03c7c6ae..f05420652 100644 --- a/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj +++ b/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-remove-reference.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -36,10 +36,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj index 0adf2a9de..84bfcdb51 100644 --- a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj +++ b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-restore.Tests - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 @@ -46,7 +46,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 $(CLI_MSBuild_Version) diff --git a/test/dotnet-run.Tests/dotnet-run.Tests.csproj b/test/dotnet-run.Tests/dotnet-run.Tests.csproj index 6fa3f48be..444bb0a5e 100644 --- a/test/dotnet-run.Tests/dotnet-run.Tests.csproj +++ b/test/dotnet-run.Tests/dotnet-run.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-run.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -35,10 +35,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-sln-add.Tests/dotnet-sln-add.Tests.csproj b/test/dotnet-sln-add.Tests/dotnet-sln-add.Tests.csproj index 08a73c20e..29025c38a 100644 --- a/test/dotnet-sln-add.Tests/dotnet-sln-add.Tests.csproj +++ b/test/dotnet-sln-add.Tests/dotnet-sln-add.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-sln-add.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -24,7 +24,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-sln-list.Tests/dotnet-sln-list.Tests.csproj b/test/dotnet-sln-list.Tests/dotnet-sln-list.Tests.csproj index 9c5727e68..6dc24ff30 100644 --- a/test/dotnet-sln-list.Tests/dotnet-sln-list.Tests.csproj +++ b/test/dotnet-sln-list.Tests/dotnet-sln-list.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-sln-list.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -24,7 +24,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj b/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj index 50a6d2592..5e062c352 100644 --- a/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj +++ b/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-sln-remove.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -24,7 +24,7 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-test.Tests/dotnet-test.Tests.csproj b/test/dotnet-test.Tests/dotnet-test.Tests.csproj index 443a67a9d..8dab1f739 100644 --- a/test/dotnet-test.Tests/dotnet-test.Tests.csproj +++ b/test/dotnet-test.Tests/dotnet-test.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-test.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -35,10 +35,10 @@ 2.2.0-beta4-build1194 - 1.0.0 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj b/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj index c0ce2eef3..bd7740760 100644 --- a/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj +++ b/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-vstest.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -35,10 +35,10 @@ 2.2.0-beta4-build1194 - 1.0.0 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index c0861efb2..157669f2c 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -2,13 +2,13 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet.Tests ../../tools/Key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -60,10 +60,10 @@ 2.2.0-beta4-build1194 - 1.0.3 + 1.1.0 - 4.1.1 + 4.3.0 2.2.0-beta4-build3444 diff --git a/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj b/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj index 30faccc85..f0fb54f4b 100644 --- a/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj +++ b/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true msbuild.IntegrationTests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -35,7 +35,7 @@ 2.2.0-beta4-build1194 - 1.0.0 + 1.1.0 2.2.0-beta4-build3444 From d55be626a9a989a327c44c689b896bc0dd2ed82b Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Fri, 20 Jan 2017 18:30:10 -0800 Subject: [PATCH 41/88] netcoreapp1.1 fixes --- .../dotnet-desktop-and-portable.csproj | 8 ++++---- .../v1/dotnet-hello/dotnet-hello.csproj | 4 ++-- .../v2/dotnet-hello/dotnet-hello.csproj | 4 ++-- build/Microsoft.DotNet.Cli.Compile.targets | 5 ++++- ...rosoft.DotNet.Cli.DependencyVersions.props | 2 +- build/Microsoft.DotNet.Cli.Monikers.props | 4 ++-- build/Microsoft.DotNet.Cli.Prepare.targets | 4 ++-- build/Microsoft.DotNet.Cli.Test.targets | 1 + .../Microsoft.DotNet.Cli.Crossgen.targets | 2 +- build/test/TestPackageProjects.targets | 6 +++--- .../Microsoft.DotNet.Cli.Utils.csproj | 2 +- ...crosoft.DotNet.ProjectJsonMigration.csproj | 1 - src/dotnet/dotnet.csproj | 3 +-- src/redist/redist.csproj | 2 +- src/tool_roslyn/tool_roslyn.csproj | 20 +++++++++++-------- .../ArgumentForwardingTests.csproj | 2 +- .../ArgumentsReflector.csproj | 5 ++--- ...osoft.DotNet.Cli.Sln.Internal.Tests.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.Tests.csproj | 2 +- ...crosoft.DotNet.Configurer.UnitTests.csproj | 2 +- ...t.DotNet.ProjectJsonMigration.Tests.csproj | 2 +- ...rosoft.DotNet.Tools.Tests.Utilities.csproj | 2 +- .../Msbuild.Tests.Utilities.csproj | 2 +- .../binding-redirects.Tests.csproj | 2 +- test/crossgen.Tests/crossgen.Tests.csproj | 2 +- .../dotnet-build.Tests.csproj | 2 +- .../dotnet-migrate.Tests.csproj | 2 +- .../dotnet-msbuild.Tests.csproj | 2 +- test/dotnet-new.Tests/dotnet-new.Tests.csproj | 2 +- .../dotnet-nuget.UnitTests.csproj | 2 +- .../dotnet-pack.Tests.csproj | 2 +- .../dotnet-publish.Tests.csproj | 2 +- .../dotnet-restore.Tests.csproj | 4 ++-- test/dotnet-run.Tests/dotnet-run.Tests.csproj | 2 +- .../dotnet-test.Tests.csproj | 2 +- .../dotnet-vstest.Tests.csproj | 2 +- test/dotnet.Tests/dotnet.Tests.csproj | 4 ++-- .../msbuild.IntegrationTests.csproj | 2 +- .../MigrationDefaultsConstructor.csproj | 2 +- 39 files changed, 64 insertions(+), 59 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 8a1e7d530..c9c1f8639 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,21 +1,21 @@  1.0.0-rc - netcoreapp1.0;net451 + netcoreapp1.1;net451 dotnet-desktop-and-portable Exe win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 - + $(ProjectRuntimeConfigFilePath) - + - 1.0.3 + 1.1.0 diff --git a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj index b6603c2d8..c1ec38777 100644 --- a/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj +++ b/TestAssets/TestPackages/dotnet-hello/v1/dotnet-hello/dotnet-hello.csproj @@ -1,6 +1,6 @@  - netcoreapp1.0 + netcoreapp1.1 dotnet-hello Exe 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 @@ -8,7 +8,7 @@ - 1.0.3 + 1.1.0 diff --git a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj index eaa06bf6e..510f6a431 100644 --- a/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj +++ b/TestAssets/TestPackages/dotnet-hello/v2/dotnet-hello/dotnet-hello.csproj @@ -1,7 +1,7 @@  2.0.0 - netcoreapp1.0 + netcoreapp1.1 dotnet-hello Exe 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 @@ -9,7 +9,7 @@ - 1.0.3 + 1.1.0 diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 286b07814..4c2de2f11 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -104,7 +104,10 @@ - + diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index b7ebc8f54..1570ba4ae 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -2,7 +2,7 @@ 15.1.0-preview-000523-01 - 2.0.0-rc3-61212-03 + 2.0.0-rc4-61319-08 1.0.0-alpha-20170117-4 4.0.0-rc3 1.0.0-alpha-20170120-3-249 diff --git a/build/Microsoft.DotNet.Cli.Monikers.props b/build/Microsoft.DotNet.Cli.Monikers.props index 7a8439645..10981406b 100644 --- a/build/Microsoft.DotNet.Cli.Monikers.props +++ b/build/Microsoft.DotNet.Cli.Monikers.props @@ -3,8 +3,8 @@ Microsoft .NET Core 1.0.3 - SDK RC 4 Microsoft .NET Core 1.0.3 - Runtime - Microsoft .NET Core 1.0.1 - Host - Microsoft .NET Core 1.0.1 - Host FX Resolver + Microsoft .NET Core 1.1.0 - Host + Microsoft .NET Core 1.1.0 - Host FX Resolver Microsoft .NET Core 1.1.0 - Runtime Microsoft .NET Core 1.1.0 - Host diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index 28589ed70..cfaaf670f 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -121,8 +121,8 @@ - release/1.1.0 - 1.1.0 + preview + 1.0.3 1.1.0 1.1.0 diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index 59ec2aae9..c4671a824 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -40,6 +40,7 @@ TestResultXmlDir=$(TestResultXmlDir); ToolPath=$(Stage0Directory); WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity))) + ToolPath=$(Stage2Directory); diff --git a/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets b/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets index a38f3d2cc..45316f23d 100644 --- a/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets +++ b/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets @@ -8,9 +8,9 @@ osx.10.10-x64 rhel.7-x64 + runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr runtime.$(CoreCLRRid).microsoft.netcore.jit - runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr $(NuGetPackagesDir)/$(CoreCLRPackageName)/$(CoreCLRVersion)/runtimes/$(CoreCLRRid)/lib/netstandard1.0 $(NuGetPackagesDir)/$(CrossGenPackageName)/$(CoreCLRVersion)/tools/crossgen$(ExeExtension) diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index e09a73bdb..4f1903640 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -129,7 +129,7 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - net451;netcoreapp1.0 + net451;netcoreapp1.1 $(CoreCLRRid) 1.0.0 True - netcoreapp1.0 + netcoreapp1.1 dotnet-hello @@ -163,7 +163,7 @@ 2.0.0 True - netcoreapp1.0 + netcoreapp1.1 dotnet-portable diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index 382259d99..53f8615de 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -15,7 +15,7 @@ 1.0.1-beta-000933 - 1.0.1-beta-000933 + 1.1.0 $(CLI_NuGet_Version) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj index 1b96e6ef4..2704bff36 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj @@ -3,7 +3,6 @@ $(CliVersionPrefix) - netcoreapp1.0 netcoreapp1.1 true ../../tools/Key.snk diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index 6d262e0c4..915e1a36b 100755 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -3,14 +3,13 @@ $(CliVersionPrefix) - 1.0.0-preview5 netcoreapp1.1 dotnet Exe ../../tools/Key.snk true true - $(PackageTargetFallback);dotnet5.4 + $(PackageTargetFallback);dotnet5.4 diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 1682bddfc..c74807583 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -5,7 +5,7 @@ $(CliVersionPrefix) netcoreapp1.1 true - $(PackageTargetFallback);dotnet5.4 + $(PackageTargetFallback);dotnet5.4 diff --git a/src/tool_roslyn/tool_roslyn.csproj b/src/tool_roslyn/tool_roslyn.csproj index 3f52caad6..d02092146 100644 --- a/src/tool_roslyn/tool_roslyn.csproj +++ b/src/tool_roslyn/tool_roslyn.csproj @@ -4,15 +4,15 @@ $(CliVersionPrefix) - netcoreapp1.0 + netcoreapp1.1 true - + - + @@ -37,14 +37,18 @@ AfterTargets="Publish" BeforeTargets="RemoveFilesAfterPublish"> - - + + + - + SectionName="%(AssetsToRemoveFromDeps.SectionName)" + AssetPath="%(AssetsToRemoveFromDeps.Identity)" /> + 2.2.0-beta4-build3444 - 1.0.1-beta-000933 + 1.1.0 diff --git a/test/ArgumentsReflector/ArgumentsReflector.csproj b/test/ArgumentsReflector/ArgumentsReflector.csproj index 55412d462..85e00819d 100644 --- a/test/ArgumentsReflector/ArgumentsReflector.csproj +++ b/test/ArgumentsReflector/ArgumentsReflector.csproj @@ -5,7 +5,6 @@ netcoreapp1.1 ArgumentsReflector Exe - 1.0.0-preview5 netcoreapp1.1 @@ -21,10 +20,10 @@ 1.1.0 - 2.0.0-beta6-60922-08 + $(CLI_Roslyn_Version) - 2.0.0-beta6-60922-08 + $(CLI_Roslyn_Version) diff --git a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj index 63f5bd5f6..504b25c7b 100644 --- a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj @@ -8,7 +8,7 @@ ../../tools/test_key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj index 94cf89cb9..9e1e3201d 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj @@ -8,7 +8,7 @@ ../../tools/Key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj index 153ac9573..4db883334 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj +++ b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj @@ -8,7 +8,7 @@ ../../tools/Key.snk true true - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj index 1a25cb12b..3adb8f19b 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj @@ -8,7 +8,7 @@ ../../tools/test_key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj index cce894eb7..bcb1c3c23 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj @@ -32,7 +32,7 @@ 2.2.0-beta4-build3444 - 1.0.1-beta-000933 + 1.1.0 diff --git a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj index 5f97d4ee8..f06f2124f 100644 --- a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj +++ b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true Msbuild.Tests.Utilities - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/binding-redirects.Tests/binding-redirects.Tests.csproj b/test/binding-redirects.Tests/binding-redirects.Tests.csproj index 9b619c83f..38e7ea4f1 100644 --- a/test/binding-redirects.Tests/binding-redirects.Tests.csproj +++ b/test/binding-redirects.Tests/binding-redirects.Tests.csproj @@ -17,6 +17,6 @@ - + diff --git a/test/crossgen.Tests/crossgen.Tests.csproj b/test/crossgen.Tests/crossgen.Tests.csproj index a0db0879b..c5d314cde 100644 --- a/test/crossgen.Tests/crossgen.Tests.csproj +++ b/test/crossgen.Tests/crossgen.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true crossgen.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-build.Tests/dotnet-build.Tests.csproj b/test/dotnet-build.Tests/dotnet-build.Tests.csproj index 3512d696c..10a181763 100644 --- a/test/dotnet-build.Tests/dotnet-build.Tests.csproj +++ b/test/dotnet-build.Tests/dotnet-build.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-build.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj index 152ae6f53..3455a4855 100644 --- a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj +++ b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-migrate.Tests - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj b/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj index cefa0c05a..a601acd01 100644 --- a/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj +++ b/test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-msbuild.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-new.Tests/dotnet-new.Tests.csproj b/test/dotnet-new.Tests/dotnet-new.Tests.csproj index 320d596e4..fc811a75c 100644 --- a/test/dotnet-new.Tests/dotnet-new.Tests.csproj +++ b/test/dotnet-new.Tests/dotnet-new.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-new.Tests - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 diff --git a/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj index d556f90eb..b67766466 100644 --- a/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj +++ b/test/dotnet-nuget.UnitTests/dotnet-nuget.UnitTests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-nuget.UnitTests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj b/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj index 721b9ff49..b6d0698e3 100644 --- a/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj +++ b/test/dotnet-pack.Tests/dotnet-pack.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-pack.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj index 8605aeeb5..23daaa675 100644 --- a/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj +++ b/test/dotnet-publish.Tests/dotnet-publish.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-publish.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj index 84bfcdb51..cf55f7b8b 100644 --- a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj +++ b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-restore.Tests - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 @@ -55,7 +55,7 @@ 2.2.0-beta4-build3444 - 1.0.1-beta-000933 + 1.1.0 4.0.0 diff --git a/test/dotnet-run.Tests/dotnet-run.Tests.csproj b/test/dotnet-run.Tests/dotnet-run.Tests.csproj index 444bb0a5e..4b3dece00 100644 --- a/test/dotnet-run.Tests/dotnet-run.Tests.csproj +++ b/test/dotnet-run.Tests/dotnet-run.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-run.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-test.Tests/dotnet-test.Tests.csproj b/test/dotnet-test.Tests/dotnet-test.Tests.csproj index 8dab1f739..aa68a2b2b 100644 --- a/test/dotnet-test.Tests/dotnet-test.Tests.csproj +++ b/test/dotnet-test.Tests/dotnet-test.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-test.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj b/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj index bd7740760..99ab8dfcc 100644 --- a/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj +++ b/test/dotnet-vstest.Tests/dotnet-vstest.Tests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true dotnet-vstest.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 157669f2c..afde5c00a 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -8,7 +8,7 @@ ../../tools/Key.snk true true - $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8 @@ -72,7 +72,7 @@ 1.0.0-prerelease-00206 - 1.0.1-beta-000933 + 1.1.0 diff --git a/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj b/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj index f0fb54f4b..c6adb0cd5 100644 --- a/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj +++ b/test/msbuild.IntegrationTests/msbuild.IntegrationTests.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 true msbuild.IntegrationTests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 diff --git a/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj b/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj index db5f74418..090b114cd 100644 --- a/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj +++ b/tools/MigrationDefaultsConstructor/MigrationDefaultsConstructor.csproj @@ -5,7 +5,7 @@ netcoreapp1.1 portable Exe - $(PackageTargetFallback);dnxcore50;portable-net45+win8 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 From 927f0b6dc52a26503429a9eb5001357ef9dbfd6b Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Sun, 22 Jan 2017 18:18:36 -0800 Subject: [PATCH 42/88] rebase fix --- .../Microsoft.DotNet.Tools.Tests.Utilities.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj index bcb1c3c23..44d281ef5 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj @@ -22,6 +22,7 @@ 4.0.0 + 1.1.0 From 9824fa945bae07ca38d7ec449389293ebec76438 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Mon, 23 Jan 2017 11:51:17 -0800 Subject: [PATCH 43/88] FluentAssertions 4.18.0 --- .../Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj | 2 +- .../Microsoft.DotNet.Configurer.UnitTests.csproj | 2 +- .../Microsoft.DotNet.ProjectJsonMigration.Tests.csproj | 2 +- .../Microsoft.DotNet.Tools.Tests.Utilities.csproj | 2 +- test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj | 2 +- .../dotnet-list-reference.Tests.csproj | 2 +- test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj | 2 +- .../dotnet-remove-reference.Tests.csproj | 2 +- test/dotnet-restore.Tests/dotnet-restore.Tests.csproj | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj index 504b25c7b..339fbd222 100644 --- a/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj +++ b/test/Microsoft.DotNet.Cli.Sln.Internal.Tests/Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj @@ -33,7 +33,7 @@ 2.2.0-beta4-build1194 - 4.0.0 + 4.18.0 \ No newline at end of file diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj index 4db883334..793b249b9 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj +++ b/test/Microsoft.DotNet.Configurer.UnitTests/Microsoft.DotNet.Configurer.UnitTests.csproj @@ -46,7 +46,7 @@ 4.3.0 - 4.0.0 + 4.18.0 4.4.0-beta8 diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj index 3adb8f19b..0b76dd001 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Microsoft.DotNet.ProjectJsonMigration.Tests.csproj @@ -50,7 +50,7 @@ 2.2.0-beta4-build3444 - 4.0.0 + 4.18.0 4.4.0-beta8 diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj index 44d281ef5..3f4dfe997 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj @@ -21,7 +21,7 @@ 1.6.0 - 4.0.0 + 4.18.0 1.1.0 diff --git a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj index f06f2124f..91dbcc61a 100644 --- a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj +++ b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj @@ -34,7 +34,7 @@ 4.3.0 - 4.0.0 + 4.18.0 2.2.0-beta4-build3444 diff --git a/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj b/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj index aa2ce2968..4fbc41e22 100644 --- a/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj +++ b/test/dotnet-list-reference.Tests/dotnet-list-reference.Tests.csproj @@ -45,7 +45,7 @@ 2.2.0-beta4-build3444 - 4.0.0 + 4.18.0 diff --git a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj index 3455a4855..64e43d38a 100644 --- a/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj +++ b/test/dotnet-migrate.Tests/dotnet-migrate.Tests.csproj @@ -54,7 +54,7 @@ 2.2.0-beta4-build3444 - 4.0.0 + 4.18.0 4.4.0-beta8 diff --git a/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj b/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj index f05420652..a339974dd 100644 --- a/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj +++ b/test/dotnet-remove-reference.Tests/dotnet-remove-reference.Tests.csproj @@ -48,7 +48,7 @@ $(CLI_MSBuild_Version) - 4.0.0 + 4.18.0 diff --git a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj index cf55f7b8b..2cc814fb5 100644 --- a/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj +++ b/test/dotnet-restore.Tests/dotnet-restore.Tests.csproj @@ -58,7 +58,7 @@ 1.1.0 - 4.0.0 + 4.18.0 From 0c809923847fe216daed711a4d78c1a96dad0f39 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Mon, 23 Jan 2017 11:51:30 -0800 Subject: [PATCH 44/88] move additional tests to netcoreapp1.1 --- .../AppWithDirectDep/AppWithDirectDep.csproj | 4 ++-- build/Microsoft.DotNet.Cli.Test.targets | 2 +- .../GivenAProjectToolsCommandResolver.cs | 2 +- .../binding-redirects.Tests.csproj | 6 +++--- .../dotnet-add-package.Tests.csproj | 4 ++-- test/dotnet.Tests/PackagedCommandTests.cs | 1 - .../1.0.0-rc4-004536/osx.10.11-x64/dotnet | Bin 64 -> 0 bytes 7 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet diff --git a/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj b/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj index bbfb9be11..1f2bc2278 100755 --- a/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj +++ b/TestAssets/TestProjects/AppWithDirectDep/AppWithDirectDep.csproj @@ -1,14 +1,14 @@  1.0.0 - netcoreapp1.0 + netcoreapp1.1 AppWithDirectDep Exe false - 1.0.3 + 1.1.0 1.0.0 diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index c4671a824..3193bf2c2 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -38,7 +38,7 @@ EnvironmentVariables=$(RunTestEnvironmentVariables); TestProject=%(TestProjects.Identity); TestResultXmlDir=$(TestResultXmlDir); - ToolPath=$(Stage0Directory); + ToolPath=$(Stage2Directory); WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity))) ToolPath=$(Stage2Directory); diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 26640ab59..be5c756b6 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -282,7 +282,7 @@ namespace Microsoft.DotNet.Tests result.Should().NotBeNull(); - result.Args.Should().Contain("--fx-version 1.0.3"); + result.Args.Should().Contain("--fx-version 1.1.0"); } [Fact] diff --git a/test/binding-redirects.Tests/binding-redirects.Tests.csproj b/test/binding-redirects.Tests/binding-redirects.Tests.csproj index 38e7ea4f1..5e1b681d2 100644 --- a/test/binding-redirects.Tests/binding-redirects.Tests.csproj +++ b/test/binding-redirects.Tests/binding-redirects.Tests.csproj @@ -2,10 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 true binding-redirects.Tests - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -13,7 +13,7 @@ - + diff --git a/test/dotnet-add-package.Tests/dotnet-add-package.Tests.csproj b/test/dotnet-add-package.Tests/dotnet-add-package.Tests.csproj index 6a052db05..63c5eff1c 100644 --- a/test/dotnet-add-package.Tests/dotnet-add-package.Tests.csproj +++ b/test/dotnet-add-package.Tests/dotnet-add-package.Tests.csproj @@ -2,7 +2,7 @@ - netcoreapp1.0 + netcoreapp1.1 true dotnet-add-package.Tests $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -17,7 +17,7 @@ - + diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index b08cc2eeb..d1f8b0c93 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -267,7 +267,6 @@ namespace Microsoft.DotNet.Tests new BuildCommand() .WithWorkingDirectory(testInstance.Root) - .WithFramework(NuGet.Frameworks.FrameworkConstants.CommonFrameworks.NetCoreApp10) .Execute() .Should().Pass(); diff --git a/test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet b/test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet deleted file mode 100644 index 30393cb6d3d0ac546f8ec8c1021af9d891103b72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64 PcmZ=@U|>vTARhn#C@BD^ From 3cba07288d31072b646801e13c00f400a6cf01a0 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Mon, 23 Jan 2017 12:14:46 -0800 Subject: [PATCH 45/88] remove redundant ToolPath setting --- build/Microsoft.DotNet.Cli.Test.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index 3193bf2c2..cdd2c2ca3 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -40,7 +40,6 @@ TestResultXmlDir=$(TestResultXmlDir); ToolPath=$(Stage2Directory); WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity))) - ToolPath=$(Stage2Directory); From 573c4efea53c911be3be299d2075c9a28cab997e Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Tue, 24 Jan 2017 14:10:45 -0800 Subject: [PATCH 46/88] test fixes --- .../AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj | 4 ++-- .../GivenThatIWantANewAppWithSpecifiedType.cs | 3 ++- .../New3/GivenThatIWantANewAppWithSpecifiedType.cs | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj index fe4c0e02c..9c9243987 100755 --- a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj +++ b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj @@ -1,12 +1,12 @@  - netcoreapp1.0 + netcoreapp1.1 Exe - 1.0.3 + 1.1.0 1.0.0 diff --git a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs index 80aed33d3..00621c34a 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs @@ -41,7 +41,8 @@ namespace Microsoft.DotNet.New.Tests if (useNuGetConfigForAspNet) { - File.Copy("NuGet.tempaspnetpatch.config", Path.Combine(rootPath, "NuGet.Config")); + var configFile = new FileInfo(Path.Combine(rootPath,"..","..","..","..","NuGet.tempaspnetpatch.config")); + File.Copy(configFile.FullName, Path.Combine(rootPath, "NuGet.Config")); } new TestCommand("dotnet") diff --git a/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs index b61565d83..f89bca7cd 100644 --- a/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/New3/GivenThatIWantANewAppWithSpecifiedType.cs @@ -38,7 +38,8 @@ namespace Microsoft.DotNet.New3.Tests if (useNuGetConfigForAspNet) { - File.Copy("NuGet.tempaspnetpatch.config", Path.Combine(rootPath, "NuGet.Config")); + var configFile = new FileInfo(Path.Combine(rootPath,"..","..","..","..","NuGet.tempaspnetpatch.config")); + File.Copy(configFile.FullName, Path.Combine(rootPath, "NuGet.Config")); } string globalJsonPath = Path.Combine(rootPath, "global.json"); From bed3d974d6a5c0465f7e226c836eab9234f242da Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Tue, 24 Jan 2017 15:21:10 -0800 Subject: [PATCH 47/88] add netcoreapp1.1 to Ubuntu installer --- build/package/Microsoft.DotNet.Cli.Installer.DEB.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets b/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets index d3d11daf0..ca94cf99f 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets @@ -15,7 +15,7 @@ - + From cc30bdde8a2078fa1ca0554e5ec234c58283b5d2 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Wed, 25 Jan 2017 11:43:07 -0800 Subject: [PATCH 48/88] Make Deb tests test Deb --- build/Microsoft.DotNet.Cli.Prepare.targets | 4 ++-- .../Microsoft.DotNet.Cli.Installer.DEB.proj | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index cfaaf670f..b48f41697 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -123,8 +123,8 @@ preview 1.0.3 - 1.1.0 - 1.1.0 + 1.0.1 + 1.0.1 dotnet-host-$(ProductMonikerRid).$(AdditionalSharedHostVersion)$(InstallerExtension) diff --git a/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj b/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj index 0be24d98c..b1b375a98 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj +++ b/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj @@ -90,23 +90,23 @@ Outputs="$(DebianTestResultsXmlFile)" > - - - - + + + + - - - + + + From 25e33956847dc7f28469aeaa4f89657d1a7a460a Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 25 Jan 2017 14:47:22 -0800 Subject: [PATCH 49/88] dotnet-desktop-and-portable.csproj to netcoreapp1.0 --- .../dotnet-desktop-and-portable.csproj | 8 ++++---- build/test/TestPackageProjects.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index c9c1f8639..8a1e7d530 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,21 +1,21 @@  1.0.0-rc - netcoreapp1.1;net451 + netcoreapp1.0;net451 dotnet-desktop-and-portable Exe win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 - + $(ProjectRuntimeConfigFilePath) - + - 1.1.0 + 1.0.3 diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index 4f1903640..1419922c7 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -129,7 +129,7 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - net451;netcoreapp1.1 + net451;netcoreapp1.0 $(CoreCLRRid) Date: Wed, 25 Jan 2017 15:11:17 -0800 Subject: [PATCH 50/88] dotnet-desktop-and-portable.csproj to netcoreapp1.1 --- .../dotnet-desktop-and-portable.csproj | 8 ++++---- build/test/TestPackageProjects.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 8a1e7d530..c9c1f8639 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,21 +1,21 @@  1.0.0-rc - netcoreapp1.0;net451 + netcoreapp1.1;net451 dotnet-desktop-and-portable Exe win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 - + $(ProjectRuntimeConfigFilePath) - + - 1.0.3 + 1.1.0 diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index 1419922c7..4f1903640 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -129,7 +129,7 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - net451;netcoreapp1.0 + net451;netcoreapp1.1 $(CoreCLRRid) Date: Wed, 25 Jan 2017 16:28:35 -0800 Subject: [PATCH 51/88] only build desktop-and-portable TestPackage on Windows --- build/Microsoft.DotNet.Cli.Test.targets | 10 ++-------- build/test/TestPackageProjects.targets | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index cdd2c2ca3..1d0944290 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -100,15 +100,9 @@ Source="$(TestPackagesDir)" ConfigFile="$(RepoRoot)\NuGet.Config" ProjectPath="%(TestPackageProject.ProjectPath)" /> - - - + - True netcoreapp1.0 - + dotnet-desktop-and-portable dotnet-desktop-and-portable.csproj True From 4985804ba2403e4d4ed5b97f7d7c175866bb0ac8 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 25 Jan 2017 17:03:39 -0800 Subject: [PATCH 52/88] update Roslyn to 2.0.0-rc4-61325-08 --- 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 1570ba4ae..16437ac5e 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -2,7 +2,7 @@ 15.1.0-preview-000523-01 - 2.0.0-rc4-61319-08 + 2.0.0-rc4-61325-08 1.0.0-alpha-20170117-4 4.0.0-rc3 1.0.0-alpha-20170120-3-249 From e089f8753eb62787582e29924d4126ba44440622 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Thu, 26 Jan 2017 00:23:51 -0800 Subject: [PATCH 53/88] Account for NuGet/Home#4404 --- build/test/TestPackageProjects.targets | 2 +- dir.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index 9d0fa652f..19e4d93ce 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -133,7 +133,7 @@ $(CoreCLRRid) + Condition=" '$(IsDesktopAvailable)' == 'True' "> dotnet-desktop-binding-redirects dotnet-desktop-binding-redirects.csproj True diff --git a/dir.props b/dir.props index 425b5d385..0c8714f22 100644 --- a/dir.props +++ b/dir.props @@ -13,6 +13,6 @@ true - 1.0.0-rc4 + 1.0.0 From e0f46f9de4d3f1451a7de045f7a0504735b8b1cc Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Thu, 26 Jan 2017 00:40:16 -0800 Subject: [PATCH 54/88] add missing suffix component --- build/Microsoft.DotNet.Cli.Compile.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 4c2de2f11..b0785a0f7 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -116,7 +116,7 @@ @@ -124,7 +124,7 @@ From add5f725735c0ee237b3578dc01612aa1fcab5e0 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Thu, 26 Jan 2017 01:32:28 -0800 Subject: [PATCH 55/88] Simplify desktop test packaging --- .../dotnet-desktop-and-portable.csproj | 6 +++--- build/Microsoft.DotNet.Cli.Test.targets | 5 +---- build/test/TestPackageProjects.targets | 18 ++++-------------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index c9c1f8639..7b2f17431 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,7 +1,7 @@  1.0.0-rc - netcoreapp1.1;net451 + netcoreapp1.0;net451 dotnet-desktop-and-portable Exe win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 @@ -13,9 +13,9 @@ - + - 1.1.0 + 1.0.3 diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index 1d0944290..ecb4b15b5 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -90,10 +90,7 @@ Outputs="%(TestPackageProject.PackOutputs)"> - %(TestPackageProject.Framework) - true - /p:TargetFramework=$(Framework) - /p:RuntimeIdentifier=%(TestPackageProject.PackRuntime) + /p:RuntimeIdentifier=%(TestPackageProject.PackRuntime) $(CliVersionPrefix)- rc4-$(TestPackageBuildVersionSuffix) False - netstandard1.5 Microsoft.DotNet.InternalAbstractions @@ -88,9 +87,9 @@ 2.0.0-beta- beta-$(TestPackageBuildVersionSuffix) False - netstandard1.3 - + PackageWithFakeNativeDep PackageWithFakeNativeDep.csproj False @@ -98,7 +97,6 @@ 1.0.0 True - net45 $(CoreCLRRid) @@ -109,7 +107,6 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - netcoreapp1.0 dotnet-dependency-tool-invoker @@ -119,9 +116,9 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - netcoreapp1.0 - + dotnet-desktop-and-portable dotnet-desktop-and-portable.csproj True @@ -129,7 +126,6 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - net451;netcoreapp1.1 $(CoreCLRRid) 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - net451 $(CoreCLRRid) @@ -153,7 +148,6 @@ 1.0.0 True - netcoreapp1.1 dotnet-hello @@ -163,7 +157,6 @@ 2.0.0 True - netcoreapp1.1 dotnet-portable @@ -173,7 +166,6 @@ 1.0.0 True - netcoreapp1.0 dotnet-prefercliruntime @@ -183,7 +175,6 @@ 1.0.0 True - netcoreapp1.0 dotnet-tool-with-output-name @@ -194,7 +185,6 @@ 1.0.0 True - netcoreapp1.0 From 473e28c26b1a3779e727be4cd1c4445c52fb8f7b Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Thu, 26 Jan 2017 08:41:46 -0800 Subject: [PATCH 56/88] remove tool_csc cleanup --- build/Microsoft.DotNet.Cli.Compile.targets | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index b0785a0f7..effb2348c 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -88,7 +88,6 @@ - @@ -173,7 +172,6 @@ - From d63e0dd74a7791cfe94e2bce2c925b5d92eda52d Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Thu, 26 Jan 2017 10:56:30 -0800 Subject: [PATCH 57/88] reduce abstraction in building test packages --- build/Microsoft.DotNet.Cli.Test.targets | 13 ++-- build/test/TestPackageProjects.targets | 83 ++++++------------------- 2 files changed, 22 insertions(+), 74 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index ecb4b15b5..f34762796 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -85,15 +85,9 @@ + DependsOnTargets="SetupTestPackageProjectData;"> - - /p:RuntimeIdentifier=%(TestPackageProject.PackRuntime) - - - @@ -103,6 +97,7 @@ ProjectPath="%(TestPackageProject.ProjectPath)" ToolPath="$(Stage0Directory)" VersionSuffix="%(TestPackageProject.VersionSuffix)" - MsbuildArgs="$(DotNetPackMsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" /> + MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" /> + diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index f53fec5ef..a8c6c0bea 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -1,76 +1,23 @@ + DependsOnTargets="SetupTestPackageProjectFrameworks"> - - %(Name) - - - - %(BuildOutputs) - $(TestPackagesDir)%(NuPkgName).%(VersionPrefix)%(VersionSuffix).nupkg - - - - - - - - %(TestPackageProject.OutputPath)%(TestPackageProject.Name).dll - - - %(TestPackageProjectFrameworks.Identity) - - + DependsOnTargets="SetupTestPackageProjectBaseData"> - - $(CurrentBuildFramework) - $(CoreCLRRid) - %(OutputPath)$(CurrentBuildFramework)/ + - - - %(BaseTestPackageProject.ProjectPath) - - - - - @(__TestPackageProjectInputs) - - - - - - - <__TestPackageProjectInputs Include="%(BaseTestPackageProject.BuildInputIncludeFilter)" - Exclude="%(BaseTestPackageProject.BuildInputExcludeFilter)"> - %(BaseTestPackageProject.ProjectPath) - - - - - + Microsoft.DotNet.Cli.Utils Microsoft.DotNet.Cli.Utils.csproj True @@ -78,6 +25,18 @@ $(CliVersionPrefix)- rc4-$(TestPackageBuildVersionSuffix) False + /p:RuntimeIdentifier=$(CoreCLRRid) + + + Microsoft.DotNet.Cli.Utils + Microsoft.DotNet.Cli.Utils.csproj + True + True + $(CliVersionPrefix)- + rc4-$(TestPackageBuildVersionSuffix) + False + /p:TargetFramework=netstandard1.5 Microsoft.DotNet.InternalAbstractions @@ -187,10 +146,6 @@ True - - - - $(RepoRoot)%(Identity)/ $(TestPackagesBuildDir)%(Identity)/bin/$(Configuration)/ @@ -198,8 +153,6 @@ %(ProjectDir)%(ProjectName) - %(ProjectDir)**/*.* - %(ProjectDir)bin/**/*.*;%(ProjectDir)obj/**/*.* @@ -209,4 +162,4 @@ %(Name) - \ No newline at end of file + From a14195f76dde7f10af21a19b9389621c4224814a Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Thu, 26 Jan 2017 11:47:06 -0800 Subject: [PATCH 58/88] hoist task batching to target batching --- build/Microsoft.DotNet.Cli.Test.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index f34762796..d7d4c28bd 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -85,7 +85,8 @@ + DependsOnTargets="SetupTestPackageProjectData;" + Outputs="%(TestPackageProject.Identity)"> Date: Thu, 26 Jan 2017 12:44:14 -0800 Subject: [PATCH 59/88] remove rid for Microsoft.DotNet.Cli.Utils test package build --- build/test/TestPackageProjects.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index a8c6c0bea..fe05bfb1c 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -25,7 +25,6 @@ $(CliVersionPrefix)- rc4-$(TestPackageBuildVersionSuffix) False - /p:RuntimeIdentifier=$(CoreCLRRid) From 090c8e2e092cb23f37460fa552b1e3e58bf07e26 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Thu, 26 Jan 2017 13:18:24 -0800 Subject: [PATCH 60/88] hoist CoreCLRRid definition to Prepare.targets --- build/Microsoft.DotNet.Cli.Prepare.targets | 4 ++++ build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets | 5 ----- build/test/TestPackageProjects.targets | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index b48f41697..84b8ac3fc 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -43,6 +43,10 @@ $(BaseOutputDirectory)/intermediate $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish + $(Rid) + win7-$(Architecture) + osx.10.10-x64 + rhel.7-x64 diff --git a/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets b/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets index 45316f23d..3d2b29310 100644 --- a/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets +++ b/build/crossgen/Microsoft.DotNet.Cli.Crossgen.targets @@ -3,11 +3,6 @@ - $(Rid) - win7-$(Architecture) - osx.10.10-x64 - rhel.7-x64 - runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr runtime.$(CoreCLRRid).microsoft.netcore.jit diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index fe05bfb1c..a12580b82 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -55,7 +55,7 @@ 1.0.0 True - $(CoreCLRRid) + /p:RuntimeIdentifier=$(CoreCLRRid) dotnet-dependency-context-test @@ -84,7 +84,7 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - $(CoreCLRRid) + /p:RuntimeIdentifier=$(CoreCLRRid) @@ -96,7 +96,7 @@ 1.0.0-rc- rc-$(TestPackageBuildVersionSuffix) True - $(CoreCLRRid) + /p:RuntimeIdentifier=$(CoreCLRRid) dotnet-hello From 8a79abe4c954e46f638f5af6240f3116436a8f47 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Thu, 26 Jan 2017 14:33:49 -0800 Subject: [PATCH 61/88] fix conditional --- .../dotnet-desktop-and-portable.csproj | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 7b2f17431..11e93e15a 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,13 +1,13 @@ - + 1.0.0-rc netcoreapp1.0;net451 dotnet-desktop-and-portable Exe - win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 + win7-x64;win7-x86 - + $(ProjectRuntimeConfigFilePath) @@ -23,8 +23,4 @@ - - - $(DefineConstants);RELEASE - From 835bc5bae1a0114186d3aa8be01db17d7a8d3900 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Thu, 26 Jan 2017 15:26:55 -0800 Subject: [PATCH 62/88] Shorten test name --- .../GivenThatIWantToMigrateDeprecatedProjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index ba8b049c1..c80911fc7 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -460,7 +460,7 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceBuiltInOptionsItSucceeds() + public void WhenMigratingDeprecatedBuiltInResItSucceeds() { var projectDirectory = TestAssets .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions") From b4b4fa64feed0763c94f470b2761d24917078003 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Thu, 26 Jan 2017 17:04:50 -0800 Subject: [PATCH 63/88] Bump MSBuild to 15.1.0-preview-000539-01 --- 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 16437ac5e..826c4da6c 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -1,7 +1,7 @@ - 15.1.0-preview-000523-01 + 15.1.0-preview-000539-01 2.0.0-rc4-61325-08 1.0.0-alpha-20170117-4 4.0.0-rc3 From c849e8ba4ced2141416cd92073cae178ca42bdd9 Mon Sep 17 00:00:00 2001 From: Parallels Date: Thu, 26 Jan 2017 20:44:31 -0800 Subject: [PATCH 64/88] Updating the template engine version to a version that depends on 1.6.0 and updating our build scripts to allow for a commit count override. --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- build/Microsoft.DotNet.Cli.Prepare.targets | 11 +++++++---- scripts/dockerrun.sh | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index a064745ff..fec7fca24 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,6 +6,6 @@ 1.0.0-alpha-20170123-1 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 - 1.0.0-beta1-20170123-94 + 1.0.0-beta1-20170126-99 diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index 2b0282626..e1e4d6845 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -53,11 +53,8 @@ - + - - - @@ -69,6 +66,12 @@ + $(DefaultCommitCount) + + $(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount) + $(ReleaseSuffix)-$(CommitCount) + $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(VersionSuffix) + $(BaseOutputDirectory)/$(VersionBadgeMoniker)_$(Configuration)_version_badge.svg $(NugetVersion) diff --git a/scripts/dockerrun.sh b/scripts/dockerrun.sh index 3b6b4133a..b478a2a10 100755 --- a/scripts/dockerrun.sh +++ b/scripts/dockerrun.sh @@ -133,5 +133,6 @@ docker run $INTERACTIVE -t --rm --sig-proxy=true \ -e CHECKSUM_STORAGE_ACCOUNT \ -e CHECKSUM_STORAGE_CONTAINER \ -e CLIBUILD_SKIP_TESTS \ + -e CommitCount \ $DOTNET_BUILD_CONTAINER_TAG \ $BUILD_COMMAND "$@" From ef95add8f66064eeb19899665d5a057af39a1867 Mon Sep 17 00:00:00 2001 From: Livar Date: Thu, 26 Jan 2017 20:55:41 -0800 Subject: [PATCH 65/88] Update the template engine to the correct build. --- 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 fec7fca24..11ba581fa 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,6 +6,6 @@ 1.0.0-alpha-20170123-1 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 - 1.0.0-beta1-20170126-99 + 1.0.0-beta1-20170126-101 From 422b03cee48a516c2b888cd1bc33006218e413a3 Mon Sep 17 00:00:00 2001 From: Livar Date: Thu, 26 Jan 2017 22:55:16 -0800 Subject: [PATCH 66/88] Update the template engine version again. --- 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 11ba581fa..f2ad57ab5 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,6 +6,6 @@ 1.0.0-alpha-20170123-1 1.0.0-alpha-20170114-1-223 15.0.0-preview-20170106-08 - 1.0.0-beta1-20170126-101 + 1.0.0-beta1-20170126-102 From 19ed5a558b14d7b542498b9541dd572cd18d10f2 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 24 Jan 2017 21:59:18 -0800 Subject: [PATCH 67/88] WiP --- build_projects/dotnet-cli-build/DotNetTool.cs | 5 ++ .../EnvironmentVariableFilter.cs | 54 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index d074856b0..58f813cab 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -1,5 +1,6 @@ // 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.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -12,6 +13,10 @@ namespace Microsoft.DotNet.Cli.Build { public DotNetTool() { + EnvironmentVariables = new EnvironmentFilter() + .GetEnvironmentVariableNamesToRemove() + .Select(e => $"{e}=") + .ToArray(); } protected abstract string Command { get; } diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs new file mode 100644 index 000000000..54f5272f7 --- /dev/null +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -0,0 +1,54 @@ +// 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; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.DotNet.Cli.Build +{ + public class EnvironmentFilter + { + private const string _MSBuildEnvironmentVariablePrefix = "MSBuild"; + private const string _DotNetEnvironmentVariablePrefix = "DOTNET"; + private const string _NugetEnvironmentVariablePrefix = "NUGET"; + + private IEnumerable _prefixesOfEnvironmentVariablesToRemove = new string [] + { + _MSBuildEnvironmentVariablePrefix, + _DotNetEnvironmentVariablePrefix, + _NugetEnvironmentVariablePrefix + }; + + private IEnumerable _environmentVariablesToRemove = new string [] + { + "CscToolExe" + }; + + private IEnumerable _environmentVariablesToKeep = new string [] + { + "DOTNET_CLI_TELEMETRY_SESSIONID" + }; + + public IEnumerable GetEnvironmentVariableNamesToRemove() + { + var allEnvironmentVariableNames = (IEnumerable)Environment + .GetEnvironmentVariables() + .Keys + .Cast(); + + var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames + .Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p))); + + var environmentVariablesToRemoveByName = allEnvironmentVariableNames + .Where(e => _environmentVariablesToRemove.Contains(e)); + + var environmentVariablesToRemove = environmentVariablesToRemoveByName + .Concat(environmentVariablesToRemoveByPrefix) + .Distinct() + .Except(_environmentVariablesToKeep); + + return environmentVariablesToRemoveByName; + } + } +} From c25abfb7c7fb559ddeeaeff633ad6942abd1db8e Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Wed, 25 Jan 2017 10:34:50 -0800 Subject: [PATCH 68/88] WiP --- build/Microsoft.DotNet.Cli.tasks | 1 + .../InvokeWithStage0.proj | 11 +++++++ .../InvokeWithStage2.proj | 25 ++++++++++++++++ .../dotnet-cli-build/DotNetMSBuild.cs | 30 +++++++++++++++++++ build_projects/dotnet-cli-build/DotNetTool.cs | 11 +++++++ 5 files changed, 78 insertions(+) create mode 100644 build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj create mode 100644 build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj create mode 100644 build_projects/dotnet-cli-build/DotNetMSBuild.cs diff --git a/build/Microsoft.DotNet.Cli.tasks b/build/Microsoft.DotNet.Cli.tasks index 49553a226..89c188c72 100644 --- a/build/Microsoft.DotNet.Cli.tasks +++ b/build/Microsoft.DotNet.Cli.tasks @@ -9,6 +9,7 @@ + diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj new file mode 100644 index 000000000..3437872d9 --- /dev/null +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj new file mode 100644 index 000000000..c27f097ea --- /dev/null +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj @@ -0,0 +1,25 @@ + + + + false + true + false + true + false + true + + + + + + + + + + + + \ No newline at end of file diff --git a/build_projects/dotnet-cli-build/DotNetMSBuild.cs b/build_projects/dotnet-cli-build/DotNetMSBuild.cs new file mode 100644 index 000000000..c5531b802 --- /dev/null +++ b/build_projects/dotnet-cli-build/DotNetMSBuild.cs @@ -0,0 +1,30 @@ +// 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. + +namespace Microsoft.DotNet.Cli.Build +{ + public class DotNetMSBuild : DotNetTool + { + protected override string Command + { + get { return "msbuild"; } + } + + protected override string Args + { + get { return $"{GetArguments()}"; } + } + + public string Arguments { get; set; } + + private string GetArguments() + { + if (!string.IsNullOrEmpty(Arguments)) + { + return $"{Arguments}"; + } + + return null; + } + } +} diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index 58f813cab..7a12d0355 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -1,5 +1,6 @@ // 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; using System.Linq; using Microsoft.Build.Framework; @@ -13,10 +14,20 @@ namespace Microsoft.DotNet.Cli.Build { public DotNetTool() { +Log.LogMessage(MessageImportance.High, "STARTING "); EnvironmentVariables = new EnvironmentFilter() .GetEnvironmentVariableNamesToRemove() .Select(e => $"{e}=") .ToArray(); + +Log.LogMessage(MessageImportance.High, "OVERRIDING "); + + foreach (var ev in EnvironmentVariables) + { + Log.LogMessage(MessageImportance.High, $"{ev}"); + } + + throw new Exception($"{EnvironmentVariables.Count()}"); } protected abstract string Command { get; } From 94e74d846a7e30772957b43dbab9091ebe6a8da0 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Wed, 25 Jan 2017 17:14:07 -0800 Subject: [PATCH 69/88] WiP --- build_projects/dotnet-cli-build/DotNetTool.cs | 45 ++++++++++++++----- .../EnvironmentVariableFilter.cs | 25 ++++++++++- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index 7a12d0355..d433c526a 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.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; +using System.Collections.Generic; using System.Linq; using Microsoft.Build.Framework; @@ -14,26 +15,38 @@ namespace Microsoft.DotNet.Cli.Build { public DotNetTool() { -Log.LogMessage(MessageImportance.High, "STARTING "); - EnvironmentVariables = new EnvironmentFilter() - .GetEnvironmentVariableNamesToRemove() - .Select(e => $"{e}=") - .ToArray(); - -Log.LogMessage(MessageImportance.High, "OVERRIDING "); + // var ev2r = new EnvironmentFilter() + // .GetEnvironmentVariableNamesToRemove(); - foreach (var ev in EnvironmentVariables) - { - Log.LogMessage(MessageImportance.High, $"{ev}"); - } + // foreach (var ev in ev2r) + // { + // Console.WriteLine($"EV {ev}"); + // } - throw new Exception($"{EnvironmentVariables.Count()}"); + // EnvironmentVariables = ev2r + // .Select(e => $"{e}=") + // .ToArray(); + + // foreach (var ev in EnvironmentVariables) + // { + // Console.WriteLine($"EV {ev}"); + // } } protected abstract string Command { get; } protected abstract string Args { get; } + protected override Dictionary EnvironmentOverride + { + get + { + return new EnvironmentFilter() + .GetEnvironmentVariableNamesToRemove() + .ToDictionary(e => e, e => (string)null); + } + } + public string WorkingDirectory { get; set; } protected override string ToolName @@ -63,6 +76,14 @@ Log.LogMessage(MessageImportance.High, "OVERRIDING "); protected override string GetWorkingDirectory() { + +Log.LogMessage(MessageImportance.High, "OVERRIDING "); + + foreach (var ev in EnvironmentVariables) + { + Log.LogMessage(MessageImportance.High, $"{ev}"); + } + return WorkingDirectory ?? base.GetWorkingDirectory(); } diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs index 54f5272f7..183ad58d6 100644 --- a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -27,7 +27,8 @@ namespace Microsoft.DotNet.Cli.Build private IEnumerable _environmentVariablesToKeep = new string [] { - "DOTNET_CLI_TELEMETRY_SESSIONID" + "DOTNET_CLI_TELEMETRY_SESSIONID", + "NUGET_PACKAGES" }; public IEnumerable GetEnvironmentVariableNamesToRemove() @@ -36,19 +37,39 @@ namespace Microsoft.DotNet.Cli.Build .GetEnvironmentVariables() .Keys .Cast(); + + foreach (var envVar in allEnvironmentVariableNames) + { + Console.WriteLine($"ev: {envVar}"); + } var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames .Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p))); + foreach (var envVar in environmentVariablesToRemoveByPrefix) + { + Console.WriteLine($"evp: {envVar}"); + } + var environmentVariablesToRemoveByName = allEnvironmentVariableNames .Where(e => _environmentVariablesToRemove.Contains(e)); + foreach (var envVar in environmentVariablesToRemoveByName) + { + Console.WriteLine($"evn: {envVar}"); + } + var environmentVariablesToRemove = environmentVariablesToRemoveByName .Concat(environmentVariablesToRemoveByPrefix) .Distinct() .Except(_environmentVariablesToKeep); + + foreach (var envVar in environmentVariablesToRemove) + { + Console.WriteLine($"evr: {envVar}"); + } - return environmentVariablesToRemoveByName; + return environmentVariablesToRemove; } } } From a473c2bad74c4beeeb0042fb196bc8321e6c1b08 Mon Sep 17 00:00:00 2001 From: PiotrP Date: Wed, 25 Jan 2017 18:23:42 -0800 Subject: [PATCH 70/88] WiP --- .../InvokeWithStage0.proj | 2 +- build_projects/dotnet-cli-build/DotNetTool.cs | 35 +++++-------------- .../EnvironmentVariableFilter.cs | 23 ++---------- 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj index 3437872d9..71dc8d373 100644 --- a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj @@ -4,7 +4,7 @@ - diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index d433c526a..478c1139e 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -15,22 +15,6 @@ namespace Microsoft.DotNet.Cli.Build { public DotNetTool() { - // var ev2r = new EnvironmentFilter() - // .GetEnvironmentVariableNamesToRemove(); - - // foreach (var ev in ev2r) - // { - // Console.WriteLine($"EV {ev}"); - // } - - // EnvironmentVariables = ev2r - // .Select(e => $"{e}=") - // .ToArray(); - - // foreach (var ev in EnvironmentVariables) - // { - // Console.WriteLine($"EV {ev}"); - // } } protected abstract string Command { get; } @@ -41,8 +25,15 @@ namespace Microsoft.DotNet.Cli.Build { get { - return new EnvironmentFilter() - .GetEnvironmentVariableNamesToRemove() + var ev2r = new EnvironmentFilter() + .GetEnvironmentVariableNamesToRemove(); + + foreach (var ev in ev2r) + { + Console.WriteLine($"EV {ev}"); + } + + return ev2r .ToDictionary(e => e, e => (string)null); } } @@ -76,14 +67,6 @@ namespace Microsoft.DotNet.Cli.Build protected override string GetWorkingDirectory() { - -Log.LogMessage(MessageImportance.High, "OVERRIDING "); - - foreach (var ev in EnvironmentVariables) - { - Log.LogMessage(MessageImportance.High, $"{ev}"); - } - return WorkingDirectory ?? base.GetWorkingDirectory(); } diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs index 183ad58d6..87a965b22 100644 --- a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build private IEnumerable _environmentVariablesToKeep = new string [] { "DOTNET_CLI_TELEMETRY_SESSIONID", + "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "NUGET_PACKAGES" }; @@ -37,38 +38,18 @@ namespace Microsoft.DotNet.Cli.Build .GetEnvironmentVariables() .Keys .Cast(); - - foreach (var envVar in allEnvironmentVariableNames) - { - Console.WriteLine($"ev: {envVar}"); - } var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames .Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p))); - - foreach (var envVar in environmentVariablesToRemoveByPrefix) - { - Console.WriteLine($"evp: {envVar}"); - } - + var environmentVariablesToRemoveByName = allEnvironmentVariableNames .Where(e => _environmentVariablesToRemove.Contains(e)); - foreach (var envVar in environmentVariablesToRemoveByName) - { - Console.WriteLine($"evn: {envVar}"); - } - var environmentVariablesToRemove = environmentVariablesToRemoveByName .Concat(environmentVariablesToRemoveByPrefix) .Distinct() .Except(_environmentVariablesToKeep); - foreach (var envVar in environmentVariablesToRemove) - { - Console.WriteLine($"evr: {envVar}"); - } - return environmentVariablesToRemove; } } From d70aeb950bfb1c71544c57180fa7e2556d119af2 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 00:32:13 -0800 Subject: [PATCH 71/88] Success! --- build_projects/dotnet-cli-build/DotNetTool.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index 478c1139e..f14bc9b15 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.Build.Framework; @@ -21,21 +22,22 @@ namespace Microsoft.DotNet.Cli.Build protected abstract string Args { get; } - protected override Dictionary EnvironmentOverride + protected override ProcessStartInfo GetProcessStartInfo( + string pathToTool, + string commandLineCommands, + string responseFileSwitch) { - get + var psi = base.GetProcessStartInfo( + pathToTool, + commandLineCommands, + responseFileSwitch); + + foreach (var environmentVariableName in new EnvironmentFilter().GetEnvironmentVariableNamesToRemove()) { - var ev2r = new EnvironmentFilter() - .GetEnvironmentVariableNamesToRemove(); - - foreach (var ev in ev2r) - { - Console.WriteLine($"EV {ev}"); - } - - return ev2r - .ToDictionary(e => e, e => (string)null); + psi.Environment.Remove(environmentVariableName); } + + return psi; } public string WorkingDirectory { get; set; } From c4e928a18ddd6d719229404aac7c05dbf239d339 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 00:45:59 -0800 Subject: [PATCH 72/88] Cleanup --- build/Microsoft.DotNet.Cli.Test.targets | 8 +++++++- .../InvokeWithStage0.proj | 6 ++---- build_projects/dotnet-cli-build/DotNetTool.cs | 3 --- run-build.ps1 | 4 ++-- run-build.sh | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index d7d4c28bd..bfe39ba14 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -11,7 +11,8 @@ + DependsOnTargets="EnsureStageSeparation; + BuildTests;"> : @@ -101,4 +102,9 @@ MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" /> + + + + diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj index 71dc8d373..4175b21fc 100644 --- a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj @@ -3,9 +3,7 @@ - - - + \ No newline at end of file diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index f14bc9b15..cc3d1cd83 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -1,9 +1,6 @@ // 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; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; diff --git a/run-build.ps1 b/run-build.ps1 index 3e16346ce..f70516668 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -103,8 +103,8 @@ if ($LastExitCode -ne 0) # install the post-PJnistic stage0 $dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1" -Write-Host "$dotnetInstallPath -Version ""1.0.0-preview5-004422"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -Version ""1.0.0-preview5-004422"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Write-Host "$dotnetInstallPath -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Invoke-Expression "$dotnetInstallPath -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" diff --git a/run-build.sh b/run-build.sh index 399099364..8ca76a05b 100755 --- a/run-build.sh +++ b/run-build.sh @@ -163,8 +163,8 @@ if [ $? != 0 ]; then fi # now execute the script -echo "installing CLI: $dotnetInstallPath --version \"1.0.0-preview5-004422\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" -$dotnetInstallPath --version "1.0.0-preview5-004422" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" +echo "installing CLI: $dotnetInstallPath --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" +$dotnetInstallPath --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" if [ $? != 0 ]; then echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $?." >&2 exit $? From 401a2dd2ce59e6b6924b50fe08594cbb0bc8b770 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 00:56:51 -0800 Subject: [PATCH 73/88] pr feedback --- build/Microsoft.DotNet.Cli.Test.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index bfe39ba14..5de38045d 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -104,7 +104,7 @@ - + From 0ab87924b2a99791f8331747c723873845de6037 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 01:18:50 -0800 Subject: [PATCH 74/88] Add DOTNET_RUNTIME_ID to kept environment variables --- build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs index 87a965b22..d5a7a5acf 100644 --- a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build private IEnumerable _environmentVariablesToKeep = new string [] { "DOTNET_CLI_TELEMETRY_SESSIONID", + "DOTNET_RUNTIME_ID", "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "NUGET_PACKAGES" }; From bbac129c0406ce138280b27a80c2cfdb4e8679f8 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 01:45:31 -0800 Subject: [PATCH 75/88] Account for Windows slashes --- .../InvokeWithStage2.proj | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj index c27f097ea..1493128e7 100644 --- a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage2.proj @@ -1,12 +1,16 @@ - + + + $([System.IO.Path]::GetDirectoryName($(ToolPath)/)) + + false - true + true false - true + true false - true + true @@ -14,12 +18,12 @@ Text="ToolPath not set" /> + Text="MSBuildExtensionsPath '$(MSBuildExtensionsPath)' not in ToolPath '$(NormalizedToolPath)'" /> + Text="CscToolExe '$(CscToolExe)' not in ToolPath '$(NormalizedToolPath)'" /> + Text="MSBuildSDKsPath '$(MSBuildSDKsPath)' not in ToolPath '$(NormalizedToolPath)'" /> \ No newline at end of file From c83d8797bc3dd9718c83c3557e1b15a0bba58d9b Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 02:12:44 -0800 Subject: [PATCH 76/88] Update run-build.ps1 --- run-build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index c035eb343..f70516668 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -103,8 +103,8 @@ if ($LastExitCode -ne 0) # install the post-PJnistic stage0 $dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1" -Write-Host "$dotnetInstallPath -Channel ""rel-1.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -Channel ""rel-1.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Write-Host "$dotnetInstallPath -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Invoke-Expression "$dotnetInstallPath -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" From d4aec7c197c0397bd498e35f7310a4454cfd438b Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 02:14:05 -0800 Subject: [PATCH 77/88] Update run-build.sh --- run-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-build.sh b/run-build.sh index 5eb8e7ed2..8ca76a05b 100755 --- a/run-build.sh +++ b/run-build.sh @@ -163,8 +163,8 @@ if [ $? != 0 ]; then fi # now execute the script -echo "installing CLI: $dotnetInstallPath --channel \"rel-1.0.0\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" -$dotnetInstallPath --channel "rel-1.0.0" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" +echo "installing CLI: $dotnetInstallPath --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\"" +$dotnetInstallPath --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" if [ $? != 0 ]; then echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $?." >&2 exit $? From 31a6da880fb6b944630573b98cd11f068afd390a Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 27 Jan 2017 11:49:54 -0800 Subject: [PATCH 78/88] Reverse installation order of shared frameworks --- build/package/Microsoft.DotNet.Cli.Installer.MSI.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets index b0c1a17a4..c1d1474d3 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets @@ -108,12 +108,12 @@ Date: Fri, 27 Jan 2017 17:13:04 -0800 Subject: [PATCH 80/88] Work around `build test.sln` race condition until fixed (#5490) * Remove GenerateRuntimeConfigurationFiles from this library * Disable parallel build of test.sln * PR feedback --- build/Microsoft.DotNet.Cli.Test.targets | 3 +- .../dotnet-cli-build/DotNetBuild.cs | 4 +- .../dotnet-cli-build/DotNetMSBuild.cs | 4 +- .../dotnet-cli-build/DotNetMSBuildTool.cs | 32 ++++++++++++++ build_projects/dotnet-cli-build/DotNetPack.cs | 4 +- .../dotnet-cli-build/DotNetPublish.cs | 4 +- .../dotnet-cli-build/DotNetRestore.cs | 4 +- build_projects/dotnet-cli-build/DotNetTest.cs | 4 +- .../Msbuild.Tests.Utilities.csproj | 44 +++++-------------- 9 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 build_projects/dotnet-cli-build/DotNetMSBuildTool.cs diff --git a/build/Microsoft.DotNet.Cli.Test.targets b/build/Microsoft.DotNet.Cli.Test.targets index fcbd1a668..2b85daa3e 100644 --- a/build/Microsoft.DotNet.Cli.Test.targets +++ b/build/Microsoft.DotNet.Cli.Test.targets @@ -82,7 +82,8 @@ + ProjectPath=""$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln"" + MaxCpuCount="1" /> 0) + { + return $"/m:{MaxCpuCount}"; + } + + return null; + } + } +} diff --git a/build_projects/dotnet-cli-build/DotNetPack.cs b/build_projects/dotnet-cli-build/DotNetPack.cs index 96bcbc884..bf4bef93d 100644 --- a/build_projects/dotnet-cli-build/DotNetPack.cs +++ b/build_projects/dotnet-cli-build/DotNetPack.cs @@ -3,7 +3,7 @@ namespace Microsoft.DotNet.Cli.Build { - public class DotNetPack : DotNetTool + public class DotNetPack : DotNetMSBuildTool { protected override string Command { @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {MsbuildArgs}"; } + get { return $"{base.Args} {GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {MsbuildArgs}"; } } public string Configuration { get; set; } diff --git a/build_projects/dotnet-cli-build/DotNetPublish.cs b/build_projects/dotnet-cli-build/DotNetPublish.cs index 8fbb88cbc..f4c2aec24 100644 --- a/build_projects/dotnet-cli-build/DotNetPublish.cs +++ b/build_projects/dotnet-cli-build/DotNetPublish.cs @@ -3,7 +3,7 @@ namespace Microsoft.DotNet.Cli.Build { - public class DotNetPublish : DotNetTool + public class DotNetPublish : DotNetMSBuildTool { protected override string Command { @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {GetMSBuildArgs()}"; } + get { return $"{base.Args} {GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {GetMSBuildArgs()}"; } } public string BuildBasePath { get; set; } diff --git a/build_projects/dotnet-cli-build/DotNetRestore.cs b/build_projects/dotnet-cli-build/DotNetRestore.cs index d3f1a2b4d..88bca5e22 100644 --- a/build_projects/dotnet-cli-build/DotNetRestore.cs +++ b/build_projects/dotnet-cli-build/DotNetRestore.cs @@ -3,7 +3,7 @@ namespace Microsoft.DotNet.Cli.Build { - public class DotNetRestore : DotNetTool + public class DotNetRestore : DotNetMSBuildTool { protected override string Command { @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } + get { return $"{base.Args} {GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } } public string ConfigFile { get; set; } diff --git a/build_projects/dotnet-cli-build/DotNetTest.cs b/build_projects/dotnet-cli-build/DotNetTest.cs index fd10ed7ea..6ed55055c 100644 --- a/build_projects/dotnet-cli-build/DotNetTest.cs +++ b/build_projects/dotnet-cli-build/DotNetTest.cs @@ -3,7 +3,7 @@ namespace Microsoft.DotNet.Cli.Build { - public class DotNetTest : DotNetTool + public class DotNetTest : DotNetMSBuildTool { protected override string Command { @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build protected override string Args { - get { return $"{GetProjectPath()} {GetConfiguration()} {GetLogger()} {GetNoBuild()}"; } + get { return $"{base.Args} {GetProjectPath()} {GetConfiguration()} {GetLogger()} {GetNoBuild()}"; } } public string Configuration { get; set; } diff --git a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj index 91dbcc61a..7d17cd6c5 100644 --- a/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj +++ b/test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj @@ -1,49 +1,29 @@ - + netcoreapp1.1 - true Msbuild.Tests.Utilities $(PackageTargetFallback);dotnet5.4;portable-net451+win8 - - true - + - - true - - - true - + + + - - true - + + - - 1.6.0 - - - 4.3.0 - - - 4.18.0 - - - 2.2.0-beta4-build3444 - - - $(CLI_MSBuild_Version) - + + + + + - - $(DefineConstants);RELEASE - From d6d39a5c9db6494694b01954ca20ca5576049340 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Fri, 27 Jan 2017 18:39:44 -0800 Subject: [PATCH 81/88] fix 5466: explicity including a file causes a build break (#5475) * fix 5466: explicity including a file causes a build break * fix failing unit tests * Add unit tests and apply fix also to includeFiles * apply review feedback --- .../TestAppWithExplicitInclude/Program.cs | 9 +++ .../TestAppWithExplicitInclude/project.json | 24 ++++++++ .../Rules/MigrateBuildOptionsRule.cs | 13 ++++- .../transforms/IncludeContextTransform.cs | 21 +++---- .../GivenThatIWantToMigrateBuildOptions.cs | 56 +++++++++++++++---- .../GivenThatIWantToMigrateTestApps.cs | 14 +++++ 6 files changed, 112 insertions(+), 25 deletions(-) create mode 100644 TestAssets/TestProjects/TestAppWithExplicitInclude/Program.cs create mode 100644 TestAssets/TestProjects/TestAppWithExplicitInclude/project.json diff --git a/TestAssets/TestProjects/TestAppWithExplicitInclude/Program.cs b/TestAssets/TestProjects/TestAppWithExplicitInclude/Program.cs new file mode 100644 index 000000000..c81448f54 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithExplicitInclude/Program.cs @@ -0,0 +1,9 @@ +using System; + +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } +} diff --git a/TestAssets/TestProjects/TestAppWithExplicitInclude/project.json b/TestAssets/TestProjects/TestAppWithExplicitInclude/project.json new file mode 100644 index 000000000..c29a3797c --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithExplicitInclude/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true, + "compile": { + "include": [ + "Program.cs" + ] + } + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index b243be518..a97fe441e 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -114,11 +114,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules "**/*.cs" }; + private static bool IsPlainFileName(string fileName) + { + return !fileName.Contains('/') && !fileName.Contains('\\'); + } + + private bool CompileFilesExcludeRule(string pattern) + { + return _compilePatternsToExclude.Contains(pattern.Replace('\\', '/')) + || IsPlainFileName(pattern); + } + private IncludeContextTransform CompileFilesTransform => new IncludeContextTransform( "Compile", transformMappings: false, - patternsToExclude: _compilePatternsToExclude, + excludePatternsRule: CompileFilesExcludeRule, condition: ic => ic != null, emitBuiltInIncludes: false); diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs index 80a671cd1..6fd504107 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs @@ -19,16 +19,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms (itemName) => new AddItemTransform( itemName, - includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles, includeContext.SourceBasePath), + includeContext => FormatGlobPatternsForMsbuild(includeContext.IncludeFiles.OrEmptyIfNull() + .Where((pattern) => !_excludePatternRule(pattern)), + includeContext.SourceBasePath), includeContext => FormatGlobPatternsForMsbuild(includeContext.ExcludeFiles, includeContext.SourceBasePath), includeContext => includeContext != null && includeContext.IncludeFiles != null - && includeContext.IncludeFiles.Count > 0); - - private bool IsPatternExcluded(string pattern) - { - return _patternsToExclude.Contains(pattern.Replace('\\', '/')); - } + && includeContext.IncludeFiles.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0); protected virtual Func> IncludeExcludeTransformGetter => (itemName) => new AddItemTransform( @@ -41,7 +38,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms fullIncludeSet = fullIncludeSet.Union(includeContext.BuiltInsInclude.OrEmptyIfNull()); } - fullIncludeSet = fullIncludeSet.Where((pattern) => !IsPatternExcluded(pattern)); + fullIncludeSet = fullIncludeSet.Where((pattern) => !_excludePatternRule(pattern)); return FormatGlobPatternsForMsbuild(fullIncludeSet, includeContext.SourceBasePath); }, @@ -57,7 +54,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms { return includeContext != null && ( - (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !IsPatternExcluded(pattern)).Count() > 0) + (includeContext.IncludePatterns != null && includeContext.IncludePatterns.Where((pattern) => !_excludePatternRule(pattern)).Count() > 0) || (_emitBuiltInIncludes && includeContext.BuiltInsInclude != null && @@ -75,7 +72,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms private readonly string _itemName; private bool _transformMappings; - private string[] _patternsToExclude; + private Func _excludePatternRule; private bool _emitBuiltInIncludes; private readonly List> _metadata = new List>(); @@ -84,12 +81,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms bool transformMappings = true, Func condition = null, bool emitBuiltInIncludes = true, - string[] patternsToExclude = null) : base(condition) + Func excludePatternsRule = null) : base(condition) { _itemName = itemName; _transformMappings = transformMappings; _emitBuiltInIncludes = emitBuiltInIncludes; - _patternsToExclude = patternsToExclude ?? Array.Empty(); + _excludePatternRule = excludePatternsRule ?? ((pattern) => false); _mappingsToTransfrom = (addItemTransform, targetPath) => { diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index 50819632c..e2dd297fc 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -420,12 +420,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } [Theory] - [InlineData("compile", "Compile")] - [InlineData("embed", "EmbeddedResource")] - [InlineData("copyToOutput", "Content")] + [InlineData("compile", "Compile", "")] + [InlineData("embed", "EmbeddedResource", ";rootfile.cs")] + [InlineData("copyToOutput", "Content", ";rootfile.cs")] private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement( string group, - string itemName) + string itemName, + string expectedRootFiles) { var testDirectory = Temp.CreateDirectory().Path; WriteExtraFiles(testDirectory); @@ -464,12 +465,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests if (defaultIncludePatterns.Any()) { item.Include.Should() - .Be(@"root\**\*;src\**\*;rootfile.cs;" + string.Join(";", defaultIncludePatterns).Replace("/", "\\")); + .Be($@"root\**\*;src\**\*{expectedRootFiles};" + string.Join(";", defaultIncludePatterns).Replace("/", "\\")); } else { item.Include.Should() - .Be(@"root\**\*;src\**\*;rootfile.cs"); + .Be($@"root\**\*;src\**\*{expectedRootFiles}"); } if (defaultExcludePatterns.Any()) @@ -488,12 +489,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } [Theory] - [InlineData("compile", "Compile")] - [InlineData("embed", "EmbeddedResource")] - [InlineData("copyToOutput", "Content")] + [InlineData("compile", "Compile", "")] + [InlineData("embed", "EmbeddedResource", ";rootfile.cs")] + [InlineData("copyToOutput", "Content", ";rootfile.cs")] private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement( string group, - string itemName) + string itemName, + string expectedRootFiles) { var testDirectory = Temp.CreateDirectory().Path; WriteExtraFiles(testDirectory); @@ -522,12 +524,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests if (defaultIncludePatterns.Any()) { item.Include.Should() - .Be(@"root\**\*;src\**\*;rootfile.cs;" + string.Join(";", defaultIncludePatterns).Replace("/", "\\")); + .Be($@"root\**\*;src\**\*{expectedRootFiles};" + string.Join(";", defaultIncludePatterns).Replace("/", "\\")); } else { item.Include.Should() - .Be(@"root\**\*;src\**\*;rootfile.cs"); + .Be($@"root\**\*;src\**\*{expectedRootFiles}"); } if (defaultExcludePatterns.Any()) @@ -579,6 +581,36 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests mockProj.Items.First(i => i.ItemType == "None").Include.Should().Be("App.config"); } + [Fact] + public void MigratingCompileIncludeWithPlainFileNamesRemovesThem() + { + var mockProj = RunBuildOptionsRuleOnPj(@" + { + ""buildOptions"": { + ""compile"": { + ""include"": [""filename1.cs"", ""filename2.cs""], + } + } + }"); + + mockProj.Items.Count(i => i.ItemType.Equals("Compile", StringComparison.Ordinal)).Should().Be(0); + } + + [Fact] + public void MigratingCompileIncludeFilesWithPlainFileNamesRemovesThem() + { + var mockProj = RunBuildOptionsRuleOnPj(@" + { + ""buildOptions"": { + ""compile"": { + ""includeFiles"": [""filename1.cs"", ""filename2.cs""], + } + } + }"); + + mockProj.Items.Count(i => i.ItemType.Equals("Compile", StringComparison.Ordinal)).Should().Be(0); + } + private static IEnumerable GetDefaultExcludePatterns(string group) { var defaultExcludePatterns = new List(group == "copyToOutput" ? diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index b2a51bf2b..e06637cf4 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -664,6 +664,20 @@ namespace Microsoft.DotNet.Migration.Tests BuildMSBuild(projectDirectory, projectName); } + [Fact] + public void ItMigratesAndBuildsAppWithExplicitInclude() + { + const string projectName = "TestAppWithExplicitInclude"; + var projectDirectory = TestAssets.Get(projectName) + .CreateInstance() + .WithSourceFiles() + .Root; + + MigrateProject(projectDirectory.FullName); + Restore(projectDirectory, projectName); + BuildMSBuild(projectDirectory, projectName); + } + [Fact] public void ItMigratesAndBuildsAppWithExplicitIncludeGlob() { From 4c55fb62117ee5b250f6c83e728c4f885df7936b Mon Sep 17 00:00:00 2001 From: Rohit Agrawal Date: Fri, 27 Jan 2017 19:12:35 -0800 Subject: [PATCH 82/88] update nuget and sdk rtm-2241 (#5447) * update nuget and sdk rtm-2241 * Applying the no packagereference workaround. * Fix merge issue * add comments for restore related workarounds added in test assets --- .../dotnet-desktop-and-portable.csproj | 6 ++++++ .../DependencyContextFromTool.csproj | 5 +++++ build/Microsoft.DotNet.Cli.DependencyVersions.props | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 11e93e15a..b2d04e484 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -19,6 +19,12 @@ + + + + + diff --git a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj index 6a76893df..cf78cd7a8 100755 --- a/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj +++ b/TestAssets/TestProjects/DependencyContextFromTool/DependencyContextFromTool.csproj @@ -18,6 +18,11 @@ 1.0.0-* + + + + $(DefineConstants);RELEASE;TRACE true diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 29aeeef9b..cadfcb6df 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -3,8 +3,8 @@ 15.1.0-preview-000539-01 2.0.0-rc4-61325-08 - 1.0.0-alpha-20170123-1 - 4.0.0-rc3 + 1.0.0-alpha-20170125-1 + 4.0.0-rtm-2241 1.0.0-alpha-20170120-3-249 15.0.0-preview-20170123-02 1.0.0-beta1-20170108-83 From e38bc4950c8bb74d650f707b0488ceb37c34a28a Mon Sep 17 00:00:00 2001 From: Livar Date: Fri, 27 Jan 2017 19:47:57 -0800 Subject: [PATCH 83/88] Migrating Microsoft.NetCore.App and NETStandard.Library to RuntimeFrameworkVersion and NetStandardImplicitPackageVersion, respectively. (#5478) --- .../MigratePackageDependenciesAndToolsRule.cs | 82 +++++++---- .../SupportedPackageVersions.cs | 10 ++ ...enThatIWantToMigratePackageDependencies.cs | 134 ++++++++++++++---- ...WantToMigratePackagesToTheirLTSVersions.cs | 60 ++++++-- 4 files changed, 222 insertions(+), 64 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigratePackageDependenciesAndToolsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigratePackageDependenciesAndToolsRule.cs index 3c07316e0..f95260149 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigratePackageDependenciesAndToolsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigratePackageDependenciesAndToolsRule.cs @@ -53,10 +53,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules // Migrate Direct Deps first MigrateDependencies( project, - migrationRuleInputs.OutputMSBuildProject, + migrationRuleInputs, null, project.Dependencies, - migrationRuleInputs.ProjectXproj, migrationSettings.SolutionFile, itemGroup: noFrameworkPackageReferenceItemGroup); @@ -72,10 +71,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules MigrateDependencies( project, - migrationRuleInputs.OutputMSBuildProject, + migrationRuleInputs, targetFramework.FrameworkName, targetFramework.Dependencies, - migrationRuleInputs.ProjectXproj, migrationSettings.SolutionFile); } @@ -147,21 +145,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules mergeExisting: false); } break; - case ProjectType.Library: - if (!project.HasDependency( - (dep) => dep.Name.Trim().ToLower() == SupportedPackageVersions.NetStandardPackageName.ToLower())) - { - _transformApplicator.Execute( - PackageDependencyInfoTransform().Transform( - new PackageDependencyInfo - { - Name = SupportedPackageVersions.NetStandardPackageName, - Version = SupportedPackageVersions.NetStandardPackageVersion - }), - noFrameworkPackageReferenceItemGroup, - mergeExisting: true); - } - break; default: break; } @@ -221,20 +204,23 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules private void MigrateDependencies( Project project, - ProjectRootElement output, + MigrationRuleInputs migrationRuleInputs, NuGetFramework framework, - IEnumerable dependencies, - ProjectRootElement xproj, + IEnumerable dependencies, SlnFile solutionFile, ProjectItemGroupElement itemGroup=null) { - var projectDependencies = new HashSet(GetAllProjectReferenceNames(project, framework, xproj, solutionFile)); + var projectDependencies = new HashSet(GetAllProjectReferenceNames( + project, + framework, + migrationRuleInputs.ProjectXproj, + solutionFile)); var packageDependencies = dependencies.Where(d => !projectDependencies.Contains(d.Name)).ToList(); string condition = framework?.GetMSBuildCondition() ?? ""; itemGroup = itemGroup - ?? output.ItemGroups.FirstOrDefault(i => i.Condition == condition) - ?? output.AddItemGroup(); + ?? migrationRuleInputs.OutputMSBuildProject.ItemGroups.FirstOrDefault(i => i.Condition == condition) + ?? migrationRuleInputs.OutputMSBuildProject.AddItemGroup(); itemGroup.Condition = condition; AutoInjectImplicitProjectJsonAssemblyReferences(framework, packageDependencies); @@ -268,12 +254,36 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules } } - _transformApplicator.Execute( - transform.Transform(ToPackageDependencyInfo( + var packageDependencyInfo = ToPackageDependencyInfo( packageDependency, - _supportedPackageVersions.ProjectDependencyPackages)), - itemGroup, - mergeExisting: true); + _supportedPackageVersions.ProjectDependencyPackages); + + if (packageDependencyInfo != null && packageDependencyInfo.IsMetaPackage) + { + var metaPackageTransform = RuntimeFrameworkVersionTransformation.Transform(packageDependencyInfo); + if(metaPackageTransform == null) + { + metaPackageTransform = + NetStandardImplicitPackageVersionTransformation.Transform(packageDependencyInfo); + } + + if (migrationRuleInputs.IsMultiTFM) + { + metaPackageTransform.Condition = condition; + } + + _transformApplicator.Execute( + metaPackageTransform, + migrationRuleInputs.CommonPropertyGroup, + mergeExisting: true); + } + else + { + _transformApplicator.Execute( + transform.Transform(packageDependencyInfo), + itemGroup, + mergeExisting: true); + } } } @@ -432,5 +442,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules "PackageTargetFallback", t => $"$(PackageTargetFallback);{string.Join(";", t.Imports)}", t => t.Imports.OrEmptyIfNull().Any()); + + private AddPropertyTransform RuntimeFrameworkVersionTransformation => + new AddPropertyTransform( + "RuntimeFrameworkVersion", + p => p.Version, + p => p.Name.Equals("Microsoft.NETCore.App", StringComparison.OrdinalIgnoreCase)); + + private AddPropertyTransform NetStandardImplicitPackageVersionTransformation => + new AddPropertyTransform( + "NetStandardImplicitPackageVersion", + p => p.Version, + p => p.Name.Equals("NETStandard.Library", StringComparison.OrdinalIgnoreCase)); } } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/SupportedPackageVersions.cs b/src/Microsoft.DotNet.ProjectJsonMigration/SupportedPackageVersions.cs index 28ff6336f..f1feedeb0 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/SupportedPackageVersions.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/SupportedPackageVersions.cs @@ -12,6 +12,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration public string Name { get; set; } public string Version { get; set; } public string PrivateAssets { get; set; } + + public bool IsMetaPackage + { + get + { + return !string.IsNullOrEmpty(Name) && + (Name.Equals("Microsoft.NETCore.App", StringComparison.OrdinalIgnoreCase) || + Name.Equals("NETStandard.Library", StringComparison.OrdinalIgnoreCase)); + } + } } internal class SupportedPackageVersions diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs index 755abacde..1bc10c03a 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackageDependencies.cs @@ -406,34 +406,116 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests i => (i.Include == "xunit.runner.visualstudio" && i.ItemType == "PackageReference")); } - [Theory] - [InlineData(@" - { - ""frameworks"": { - ""netstandard1.3"": { - ""dependencies"": { - ""System.AppContext"": ""4.1.0"", - ""NETStandard.Library"": ""1.5.0"" - } - } - } - }")] - [InlineData(@" - { - ""frameworks"": { - ""netstandard1.3"": { - ""dependencies"": { - ""System.AppContext"": ""4.1.0"" - } - } - } - }")] - public void ItMigratesLibraryAndDoesNotDoubleNetstandardRef(string pjContent) + [Fact] + public void ItMigratesMicrosoftNETCoreAppMetaPackageToRuntimeFrameworkVersionProperty() { - var mockProj = RunPackageDependenciesRuleOnPj(pjContent); + var mockProj = RunPackageDependenciesRuleOnPj( + @"{ ""dependencies"": { ""Microsoft.NETCore.App"" : { ""version"": ""1.1.0"", ""type"": ""build"" } } }"); - mockProj.Items.Should().ContainSingle( - i => (i.Include == "NETStandard.Library" && i.ItemType == "PackageReference")); + mockProj.Items.Should().NotContain( + i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); + mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which.Value.Should().Be("1.1.0"); + } + + [Fact] + public void ItMigratesMicrosoftNETCoreAppMetaPackageToRuntimeFrameworkVersionPropertyConditionedOnTFMWhenMultiTFM() + { + var mockProj = RunPackageDependenciesRuleOnPj(@" + { + ""frameworks"": { + ""netcoreapp1.0"": { + ""dependencies"": { + ""Microsoft.NETCore.App"": ""1.1.0"" + } + }, + ""netcoreapp1.1"": { + } + } + }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); + var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which; + runtimeFrameworkVersion.Value.Should().Be("1.1.0"); + runtimeFrameworkVersion.Condition.Should().Contain("netcoreapp1.0"); + } + + [Fact] + public void ItMigratesMicrosoftNETCoreAppMetaPackageToRuntimeFrameworkVersionPropertyWithNoConditionedOnTFMWhenSingleTFM() + { + var mockProj = RunPackageDependenciesRuleOnPj(@" + { + ""frameworks"": { + ""netcoreapp1.0"": { + ""dependencies"": { + ""Microsoft.NETCore.App"": ""1.1.0"" + } + } + } + }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); + var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which; + runtimeFrameworkVersion.Value.Should().Be("1.1.0"); + runtimeFrameworkVersion.Condition.Should().BeEmpty(); + } + + [Fact] + public void ItMigratesNETStandardLibraryMetaPackageToNetStandardImplicitPackageVersionProperty() + { + var mockProj = RunPackageDependenciesRuleOnPj( + @"{ ""dependencies"": { ""NETStandard.Library"" : { ""version"": ""1.6.0"", ""type"": ""build"" } } }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"); + mockProj.Properties.Should().ContainSingle(p => p.Name == "NetStandardImplicitPackageVersion").Which.Value.Should().Be("1.6.0"); + } + + [Fact] + public void ItMigratesNETStandardLibraryMetaPackageToNetStandardImplicitPackageVersionPropertyConditionedOnTFMWhenMultiTFM() + { + var mockProj = RunPackageDependenciesRuleOnPj(@" + { + ""frameworks"": { + ""netstandard1.3"": { + ""dependencies"": { + ""NETStandard.Library"": ""1.6.0"" + } + }, + ""netstandard1.5"": { + } + } + }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"); + var netStandardImplicitPackageVersion = + mockProj.Properties.Should().ContainSingle(p => p.Name == "NetStandardImplicitPackageVersion").Which; + netStandardImplicitPackageVersion.Value.Should().Be("1.6.0"); + netStandardImplicitPackageVersion.Condition.Should().Contain("netstandard1.3"); + } + + [Fact] + public void ItMigratesNETStandardLibraryMetaPackageToNetStandardImplicitPackageVersionPropertyWithNoConditionOnTFMWhenSingleTFM() + { + var mockProj = RunPackageDependenciesRuleOnPj(@" + { + ""frameworks"": { + ""netstandard1.3"": { + ""dependencies"": { + ""NETStandard.Library"": ""1.6.0"" + } + } + } + }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"); + var netStandardImplicitPackageVersion = + mockProj.Properties.Should().ContainSingle(p => p.Name == "NetStandardImplicitPackageVersion").Which; + netStandardImplicitPackageVersion.Value.Should().Be("1.6.0"); + netStandardImplicitPackageVersion.Condition.Should().BeEmpty(); } } } \ No newline at end of file diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackagesToTheirLTSVersions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackagesToTheirLTSVersions.cs index c8ab19dde..d2e17fe0b 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackagesToTheirLTSVersions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigratePackagesToTheirLTSVersions.cs @@ -12,20 +12,38 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests public class GivenThatIWantToMigratePackagesToTheirLTSVersions : PackageDependenciesTestBase { [Theory] - [InlineData("Microsoft.NETCore.App", "1.0.0", "Microsoft.NETCore.App", "1.0.3")] - [InlineData("Microsoft.NETCore.App", "1.0.3-preview2", "Microsoft.NETCore.App", "1.0.3")] - [InlineData("NETStandard.Library", "1.4.0", "NETStandard.Library", "1.6.0")] - public void ItUpliftsMetaPackages( - string sourcePackageName, + [InlineData("1.0.0", "1.0.3")] + [InlineData("1.0.3-preview2", "1.0.3")] + public void ItUpliftsMicrosoftNETCoreAppMetaPackages( string sourceVersion, - string targetPackageName, string targetVersion) { - ValidatePackageMigration(sourcePackageName, sourceVersion, targetPackageName, targetVersion); + ValidateNetCoreAppMetaPackageMigration(sourceVersion, targetVersion); + } + + [Fact] + public void ItDoesNotDropMicrosoftNETCoreAppMetapackageThatDoNotHaveAMatchingVersionInTheMapping() + { + ValidateNetCoreAppMetaPackageMigration("1.2.0-*", "1.2.0-*"); + } + + [Theory] + [InlineData("1.4.0", "1.6.0")] + [InlineData("1.5.0", "1.6.0")] + public void ItUpliftsNetStandardMetaPackages( + string sourceVersion, + string targetVersion) + { + ValidateNetStandardMetaPackageMigration(sourceVersion, targetVersion); + } + + [Fact] + public void ItDoesNotDropNetStandardMetapackageThatDoNotHaveAMatchingVersionInTheMapping() + { + ValidateNetStandardMetaPackageMigration("1.6.2-*", "1.6.2-*"); } [Theory] - [InlineData("NETStandard.Library", "1.6.2-*", "NETStandard.Library", "1.6.2-*")] [InlineData("System.Text.Encodings.Web", "4.4.0-*", "System.Text.Encodings.Web", "4.4.0-*")] public void ItDoesNotDropDependenciesThatDoNotHaveAMatchingVersionInTheMapping( string sourcePackageName, @@ -236,5 +254,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests packageRef.GetMetadataWithName("Version").Value.Should().Be(targetVersion); } + + private void ValidateNetStandardMetaPackageMigration( + string sourceVersion, + string targetVersion) + { + var mockProj = RunPackageDependenciesRuleOnPj("{ \"dependencies\": { \"NETStandard.Library\" : { \"version\": \"" + sourceVersion + "\", \"type\": \"build\" } } }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"); + mockProj.Properties + .Should().ContainSingle(p => p.Name == "NetStandardImplicitPackageVersion") + .Which.Value.Should().Be(targetVersion); + } + + private void ValidateNetCoreAppMetaPackageMigration( + string sourceVersion, + string targetVersion) + { + var mockProj = RunPackageDependenciesRuleOnPj("{ \"dependencies\": { \"Microsoft.NETCore.App\" : { \"version\": \"" + sourceVersion + "\", \"type\": \"build\" } } }"); + + mockProj.Items.Should().NotContain( + i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference"); + mockProj.Properties + .Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion") + .Which.Value.Should().Be(targetVersion); + } } } \ No newline at end of file From 5aded80a7b355fbe54cd8897388600c2df814beb Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Sat, 28 Jan 2017 15:14:17 -1000 Subject: [PATCH 84/88] Migration: excluded files need to be removed (#5485) * WIP * Implement Remove attribute * Enable tests * Fix test * Try a shorter test name * Try more shortened test names * Shorten some more * Merge issues * Try shortinging names more * Fix test errors related to test asset renaming --- .../project.json | 20 ---- .../Program.cs | 0 .../project.json | 0 .../Helper1.cs | 0 .../Helper2.cs | 0 .../project/IncludeThis.cs | 0 .../project/Program.cs | 0 .../project/project.json | 0 .../HelperBuiltIn1.cs | 0 .../HelperBuiltIn2.cs | 0 .../project/IncludeThis.cs | 0 .../project/Program.cs | 0 .../project/project.json | 0 .../ExcludeThis1.cs | 0 .../ExcludeThis2.cs | 0 .../Program.cs | 0 .../project.json | 0 .../ContentFile1.txt | 0 .../ContentFile2.txt | 0 .../ContentFileBuiltIn1.txt | 0 .../ContentFileBuiltIn2.txt | 0 .../project/ExcludeThis1.txt | 0 .../project/ExcludeThis2.txt | 0 .../project/IncludeThis.txt | 0 .../project/Program.cs | 0 .../project/project.json | 0 .../Program.cs | 2 +- .../PJDeprecatedNamedResource/project.json | 20 ++++ .../Content1.txt | 0 .../Content2.txt | 0 .../Program.cs | 0 .../project.json | 0 .../Strings1.resx | 0 .../Strings2.resx | 0 .../project}/Program.cs | 0 .../project/Resources/Strings.resx | 0 .../project/project.json | 0 .../Strings1.resx | 0 .../Strings2.resx | 0 .../project/Program.cs | 0 .../project/Resources/Strings.resx | 0 .../project/project.json | 0 .../Exclude1.resx | 0 .../Exclude2.resx | 0 .../Program.cs | 0 .../project.json | 0 .../Rules/CleanOutputProjectRule.cs | 4 +- .../Rules/MigrateBuildOptionsRule.cs | 72 ++++++++---- .../transforms/ConditionalTransform.cs | 73 ++++++++++++ .../transforms/IncludeContextTransform.cs | 69 ----------- .../transforms/RemoveContextTransform.cs | 110 ++++++++++++++++++ .../transforms/RemoveItemTransform.cs | 69 +++++++++++ .../GivenAProjectMigrator.cs | 4 +- .../GivenThatIWantToMigrateBuildOptions.cs | 17 ++- ...venThatIWantToMigrateDeprecatedProjects.cs | 108 +++++++++-------- 55 files changed, 394 insertions(+), 174 deletions(-) delete mode 100644 TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompilationOptions => PJDeprecatedCompilation}/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompilationOptions => PJDeprecatedCompilation}/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileOptions => PJDeprecatedCompile}/Helper1.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileOptions => PJDeprecatedCompile}/Helper2.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileBuiltInOptions => PJDeprecatedCompile}/project/IncludeThis.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileOptions => PJDeprecatedCompile}/project/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileOptions => PJDeprecatedCompile}/project/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileBuiltInOptions => PJDeprecatedCompileBuiltIn}/HelperBuiltIn1.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileBuiltInOptions => PJDeprecatedCompileBuiltIn}/HelperBuiltIn2.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileOptions => PJDeprecatedCompileBuiltIn}/project/IncludeThis.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileBuiltInOptions => PJDeprecatedCompileBuiltIn}/project/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileBuiltInOptions => PJDeprecatedCompileBuiltIn}/project/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileExcludeOptions => PJDeprecatedCompileExclude}/ExcludeThis1.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileExcludeOptions => PJDeprecatedCompileExclude}/ExcludeThis2.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileExcludeOptions => PJDeprecatedCompileExclude}/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedCompileExcludeOptions => PJDeprecatedCompileExclude}/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/ContentFile1.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/ContentFile2.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/ContentFileBuiltIn1.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/ContentFileBuiltIn2.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/project/ExcludeThis1.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/project/ExcludeThis2.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/project/IncludeThis.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/project/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedContentOptions => PJDeprecatedContent}/project/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceOptions/project => PJDeprecatedNamedResource}/Program.cs (96%) create mode 100644 TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/project.json rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedPackOptions => PJDeprecatedPack}/Content1.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedPackOptions => PJDeprecatedPack}/Content2.txt (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedPackOptions => PJDeprecatedPack}/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedPackOptions => PJDeprecatedPack}/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceBuiltInOptions => PJDeprecatedResource}/Strings1.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceBuiltInOptions => PJDeprecatedResource}/Strings2.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedNamedResourceOption => PJDeprecatedResource/project}/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceBuiltInOptions => PJDeprecatedResource}/project/Resources/Strings.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceOptions => PJDeprecatedResource}/project/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceOptions => PJDeprecatedResourceBuiltIn}/Strings1.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceOptions => PJDeprecatedResourceBuiltIn}/Strings2.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceBuiltInOptions => PJDeprecatedResourceBuiltIn}/project/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceOptions => PJDeprecatedResourceBuiltIn}/project/Resources/Strings.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceBuiltInOptions => PJDeprecatedResourceBuiltIn}/project/project.json (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceExcludeOptions => PJDeprecatedResourceExclude}/Exclude1.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceExcludeOptions => PJDeprecatedResourceExclude}/Exclude2.resx (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceExcludeOptions => PJDeprecatedResourceExclude}/Program.cs (100%) rename TestAssets/NonRestoredTestProjects/{PJAppWithDeprecatedResourceExcludeOptions => PJDeprecatedResourceExclude}/project.json (100%) create mode 100644 src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs create mode 100644 src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveItemTransform.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json b/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json deleted file mode 100644 index 0bf0dfa00..000000000 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": "1.0.0-*", - "namedResource": [ "My.Alias", "Strings.resx" ], - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true - }, - "dependencies": {}, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - }, - "imports": "dnxcore50" - } - } -} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompilation/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompilation/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompilation/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompilationOptions/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompilation/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/Helper1.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper1.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/Helper1.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/Helper2.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/Helper2.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/Helper2.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/IncludeThis.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/IncludeThis.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/IncludeThis.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompile/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/HelperBuiltIn1.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn1.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/HelperBuiltIn1.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/HelperBuiltIn2.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/HelperBuiltIn2.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/HelperBuiltIn2.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/IncludeThis.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileOptions/project/IncludeThis.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/IncludeThis.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileBuiltInOptions/project/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileBuiltIn/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis1.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/ExcludeThis1.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis1.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/ExcludeThis1.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/ExcludeThis2.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/ExcludeThis2.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/ExcludeThis2.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedCompileExcludeOptions/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedCompileExclude/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFile1.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile1.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFile1.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFile2.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFile2.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFile2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFileBuiltIn1.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn1.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFileBuiltIn1.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFileBuiltIn2.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/ContentFileBuiltIn2.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/ContentFileBuiltIn2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis1.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/ExcludeThis1.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis1.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/ExcludeThis1.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/ExcludeThis2.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/ExcludeThis2.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/ExcludeThis2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/IncludeThis.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/IncludeThis.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/IncludeThis.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedContentOptions/project/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedContent/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/Program.cs similarity index 96% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/Program.cs index d0134277c..8fdd24dff 100644 --- a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Program.cs +++ b/TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Reflection; diff --git a/TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/project.json new file mode 100644 index 000000000..e0c6115f7 --- /dev/null +++ b/TestAssets/NonRestoredTestProjects/PJDeprecatedNamedResource/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "namedResource": [ "My.Alias", "Strings.resx" ], + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + } +} diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Content1.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content1.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Content1.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt b/TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Content2.txt similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Content2.txt rename to TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Content2.txt diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedPack/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedPack/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedPackOptions/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedPack/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResource/Strings1.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings1.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResource/Strings1.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResource/Strings2.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/Strings2.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResource/Strings2.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedNamedResourceOption/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/Resources/Strings.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Resources/Strings.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/Resources/Strings.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResource/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/Strings1.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings1.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/Strings1.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/Strings2.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/Strings2.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/Strings2.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/Resources/Strings.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceOptions/project/Resources/Strings.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/Resources/Strings.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceBuiltInOptions/project/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceBuiltIn/project/project.json diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Exclude1.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude1.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Exclude1.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Exclude2.resx similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Exclude2.resx rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Exclude2.resx diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Program.cs similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/Program.cs rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/Program.cs diff --git a/TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json b/TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/project.json similarity index 100% rename from TestAssets/NonRestoredTestProjects/PJAppWithDeprecatedResourceExcludeOptions/project.json rename to TestAssets/NonRestoredTestProjects/PJDeprecatedResourceExclude/project.json diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/CleanOutputProjectRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/CleanOutputProjectRule.cs index f31be9ba2..e419c615b 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/CleanOutputProjectRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/CleanOutputProjectRule.cs @@ -43,7 +43,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules foreach (var item in msbuildProject.Items) { - if (string.IsNullOrEmpty(item.Include) && string.IsNullOrEmpty(item.Update)) + if (string.IsNullOrEmpty(item.Include) && + string.IsNullOrEmpty(item.Remove) && + string.IsNullOrEmpty(item.Update)) { item.Parent.RemoveChild(item); } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index a97fe441e..1e7259bd2 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -133,9 +133,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules condition: ic => ic != null, emitBuiltInIncludes: false); + private RemoveContextTransform RemoveCompileFilesTransform => + new RemoveContextTransform( + "Compile", + condition: ic => ic != null); + private IncludeContextTransform EmbedFilesTransform => new IncludeContextTransform("EmbeddedResource", transformMappings: false, condition: ic => ic != null); + private RemoveContextTransform RemoveEmbedFilesTransform => + new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null); + private IncludeContextTransform CopyToOutputFilesTransform => new IncludeContextTransform("Content", transformMappings: true) .WithMetadata("CopyToOutputDirectory", "PreserveNewest"); @@ -157,14 +165,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules projectContext => string.Empty, projectContext => File.Exists(Path.Combine(projectContext.ProjectDirectory, "App.config"))); - private Func>CompileFilesTransformExecute => + private Func> CompileFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => CompileFilesTransform.Transform(compilerOptions.CompileInclude); + private Func> RemoveCompileFilesTransformExecute => + (compilerOptions, projectDirectory, projectType) => + RemoveCompileFilesTransform.Transform(compilerOptions.CompileInclude); + private Func> EmbedFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => EmbedFilesTransform.Transform(GetEmbedIncludeContext(compilerOptions)); + private Func> RemoveEmbedFilesTransformExecute => + (compilerOptions, projectDirectory, projectType) => + RemoveEmbedFilesTransform.Transform(GetEmbedIncludeContext(compilerOptions)); + private Func> CopyToOutputFilesTransformExecute => (compilerOptions, projectDirectory, projectType) => { @@ -183,6 +199,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules private readonly CommonCompilerOptions _configurationBuildOptions; private List> _propertyTransforms; + private List>> _removeContextTransformExecutes; private List>> _includeContextTransformExecutes; private readonly ITransformApplicator _transformApplicator; @@ -229,6 +246,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules _propertyTransforms.AddRange(EmitEntryPointTransforms); _propertyTransforms.AddRange(KeyFileTransforms); + _removeContextTransformExecutes = + new List>>() + { + RemoveCompileFilesTransformExecute, + RemoveEmbedFilesTransformExecute + }; + _includeContextTransformExecutes = new List>>() { @@ -311,6 +335,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules } } + foreach (var removeContextTransformExecutes in _removeContextTransformExecutes) + { + var nonConfigurationOutput = + removeContextTransformExecutes(compilerOptions, projectDirectory, projectType); + var configurationOutput = + removeContextTransformExecutes(configurationCompilerOptions, projectDirectory, projectType); + + if (configurationOutput != null) + { + transformApplicator.Execute(configurationOutput, itemGroup, mergeExisting: true); + } + } + foreach (var includeContextTransformExecute in _includeContextTransformExecutes) { var nonConfigurationOutput = @@ -318,7 +355,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules var configurationOutput = includeContextTransformExecute(configurationCompilerOptions, projectDirectory, projectType); - if (configurationOutput != null) { transformApplicator.Execute(configurationOutput, itemGroup, mergeExisting: true); @@ -326,25 +362,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules } } - private void RemoveCommonIncludes(IEnumerable itemsToRemoveFrom, - IEnumerable otherItems) - { - foreach (var item1 in itemsToRemoveFrom) - { - if (item1 == null) - { - continue; - } - foreach ( - var item2 in - otherItems.Where( - i => i != null && string.Equals(i.ItemType, item1.ItemType, StringComparison.Ordinal))) - { - item1.Include = string.Join(";", item1.Includes().Except(item2.Includes())); - } - } - } - private bool PropertiesAreEqual(ProjectPropertyElement nonConfigurationOutput, ProjectPropertyElement configurationOutput) { if (configurationOutput != null && nonConfigurationOutput != null) @@ -369,6 +386,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules transformApplicator.Execute(transform.Transform(compilerOptions), propertyGroup, mergeExisting: true); } + foreach (var removeContextTransformExecutes in _removeContextTransformExecutes) + { + var transform = removeContextTransformExecutes(compilerOptions, projectDirectory, projectType); + + if (transform != null) + { + transformApplicator.Execute( + transform, + itemGroup, + mergeExisting: true); + } + } + foreach (var includeContextTransformExecute in _includeContextTransformExecutes) { var transform = includeContextTransformExecute(compilerOptions, projectDirectory, projectType); diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/ConditionalTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/ConditionalTransform.cs index 099f553c2..7f5d1a984 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/ConditionalTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/ConditionalTransform.cs @@ -1,7 +1,11 @@ // 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 Microsoft.DotNet.Tools.Common; using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; namespace Microsoft.DotNet.ProjectJsonMigration.Transforms { @@ -25,5 +29,74 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms } public abstract U ConditionallyTransform(T source); + + protected string FormatGlobPatternsForMsbuild(IEnumerable patterns, string projectDirectory) + { + if (patterns == null) + { + return string.Empty; + } + + List mutatedPatterns = new List(patterns.Count()); + + foreach (var pattern in patterns) + { + // Do not use forward slashes + // https://github.com/Microsoft/msbuild/issues/724 + var mutatedPattern = pattern.Replace('/', '\\'); + + // MSBuild cannot copy directories + mutatedPattern = ReplaceDirectoriesWithGlobs(mutatedPattern, projectDirectory); + + mutatedPatterns.Add(mutatedPattern); + } + + return string.Join(";", mutatedPatterns); + } + + private string ReplaceDirectoriesWithGlobs(string pattern, string projectDirectory) + { + if (PatternIsDirectory(pattern, projectDirectory)) + { + return $"{pattern.TrimEnd(new char[] { '\\' })}\\**\\*"; + } + else + { + return pattern; + } + } + + private bool PatternIsDirectory(string pattern, string projectDirectory) + { + // TODO: what about /some/path/**/somedir? + // Should this even be migrated? + var path = pattern; + + if (!Path.IsPathRooted(path)) + { + path = Path.Combine(projectDirectory, path); + } + + return Directory.Exists(path); + } + + protected string ConvertTargetPathToMsbuildMetadata(string targetPath) + { + var targetIsFile = MappingsTargetPathIsFile(targetPath); + + if (targetIsFile) + { + return targetPath; + } + + return $"{targetPath}%(FileName)%(Extension)"; + } + + private bool MappingsTargetPathIsFile(string targetPath) + { + var normalizedTargetPath = PathUtility.GetPathWithDirectorySeparator(targetPath); + + return normalizedTargetPath[normalizedTargetPath.Length - 1] != Path.DirectorySeparatorChar; + } } } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs index 6fd504107..e71bcf923 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/IncludeContextTransform.cs @@ -172,80 +172,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms return transformSet.Select(t => t.Item1.Transform(t.Item2)); } - protected string FormatGlobPatternsForMsbuild(IEnumerable patterns, string projectDirectory) - { - if (patterns == null) - { - return string.Empty; - } - - List mutatedPatterns = new List(patterns.Count()); - - foreach (var pattern in patterns) - { - // Do not use forward slashes - // https://github.com/Microsoft/msbuild/issues/724 - var mutatedPattern = pattern.Replace('/', '\\'); - - // MSBuild cannot copy directories - mutatedPattern = ReplaceDirectoriesWithGlobs(mutatedPattern, projectDirectory); - - mutatedPatterns.Add(mutatedPattern); - } - - return string.Join(";", mutatedPatterns); - } - - private string ReplaceDirectoriesWithGlobs(string pattern, string projectDirectory) - { - if (PatternIsDirectory(pattern, projectDirectory)) - { - return $"{pattern.TrimEnd(new char[] { '\\' })}\\**\\*"; - } - else - { - return pattern; - } - } - private AddItemTransform AddMappingToTransform( AddItemTransform addItemTransform, string targetPath) { return _mappingsToTransfrom(addItemTransform, targetPath); } - - private bool PatternIsDirectory(string pattern, string projectDirectory) - { - // TODO: what about /some/path/**/somedir? - // Should this even be migrated? - var path = pattern; - - if (!Path.IsPathRooted(path)) - { - path = Path.Combine(projectDirectory, path); - } - - return Directory.Exists(path); - } - - private string ConvertTargetPathToMsbuildMetadata(string targetPath) - { - var targetIsFile = MappingsTargetPathIsFile(targetPath); - - if (targetIsFile) - { - return targetPath; - } - - return $"{targetPath}%(FileName)%(Extension)"; - } - - private bool MappingsTargetPathIsFile(string targetPath) - { - var normalizedTargetPath = PathUtility.GetPathWithDirectorySeparator(targetPath); - - return normalizedTargetPath[normalizedTargetPath.Length - 1] != Path.DirectorySeparatorChar; - } } } diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs new file mode 100644 index 000000000..1dae3a581 --- /dev/null +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveContextTransform.cs @@ -0,0 +1,110 @@ +// 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 Microsoft.DotNet.Internal.ProjectModel.Files; +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Build.Construction; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.ProjectJsonMigration.Models; +using Microsoft.DotNet.Tools.Common; + +namespace Microsoft.DotNet.ProjectJsonMigration.Transforms +{ + internal class RemoveContextTransform : ConditionalTransform> + { + protected virtual Func> RemoveTransformGetter => + (itemName) => new RemoveItemTransform( + itemName, + includeContext => + { + var fullRemoveSet = includeContext.ExcludePatterns.OrEmptyIfNull() + .Union(includeContext.ExcludeFiles.OrEmptyIfNull()); + + return FormatGlobPatternsForMsbuild(fullRemoveSet, includeContext.SourceBasePath); + }, + includeContext => + { + return includeContext != null && + ( + (includeContext.ExcludePatterns != null && includeContext.ExcludePatterns.Count > 0) + || + (includeContext.ExcludeFiles != null && includeContext.ExcludeFiles.Count > 0) + ); + }); + + private Func> MappingsRemoveTransformGetter => + (itemName, targetPath) => AddMappingToTransform(RemoveTransformGetter(itemName), targetPath); + + private Func, string, RemoveItemTransform> _mappingsToTransfrom; + + private readonly string _itemName; + private readonly List> _metadata = new List>(); + + public RemoveContextTransform( + string itemName, + Func condition = null + ) : base(condition) + { + _itemName = itemName; + + _mappingsToTransfrom = (removeItemTransform, targetPath) => + { + var msbuildLinkMetadataValue = ConvertTargetPathToMsbuildMetadata(targetPath); + + return removeItemTransform.WithMetadata("Link", msbuildLinkMetadataValue); + }; + } + + public override IEnumerable ConditionallyTransform(IncludeContext source) + { + var transformSet = CreateTransformSet(source); + return transformSet.Select(t => t.Item1.Transform(t.Item2)); + } + + private IEnumerable, IncludeContext>> CreateTransformSet(IncludeContext source) + { + var transformSet = new List, IncludeContext>> + { + Tuple.Create(RemoveTransformGetter(_itemName), source) + }; + + if (source == null) + { + return transformSet; + } + + // Mappings must be executed before the transform set to prevent a the + // non-mapped items that will merge with mapped items from being encompassed + foreach (var mappingEntry in source.Mappings.OrEmptyIfNull()) + { + var targetPath = mappingEntry.Key; + var includeContext = mappingEntry.Value; + + transformSet.Insert(0, + Tuple.Create( + MappingsRemoveTransformGetter(_itemName, targetPath), + includeContext)); + } + + foreach (var metadataElement in _metadata) + { + foreach (var transform in transformSet) + { + transform.Item1.WithMetadata(metadataElement); + } + } + + return transformSet; + } + + private RemoveItemTransform AddMappingToTransform( + RemoveItemTransform removeItemTransform, + string targetPath) + { + return _mappingsToTransfrom(removeItemTransform, targetPath); + } + } +} diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveItemTransform.cs b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveItemTransform.cs new file mode 100644 index 000000000..7833e4b8b --- /dev/null +++ b/src/Microsoft.DotNet.ProjectJsonMigration/transforms/RemoveItemTransform.cs @@ -0,0 +1,69 @@ +// 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; +using System.Collections.Generic; +using Microsoft.Build.Construction; +using Microsoft.DotNet.ProjectJsonMigration.Models; + +namespace Microsoft.DotNet.ProjectJsonMigration.Transforms +{ + internal class RemoveItemTransform : ConditionalTransform + { + private readonly ProjectRootElement _itemObjectGenerator = ProjectRootElement.Create(); + + private readonly string _itemName; + private readonly Func _removeValueFunc; + + private readonly List> _metadata = new List>(); + + public RemoveItemTransform( + string itemName, + Func removeValueFunc, + Func condition) + : base(condition) + { + _itemName = itemName; + _removeValueFunc = removeValueFunc; + } + + public RemoveItemTransform WithMetadata(ItemMetadataValue metadata) + { + _metadata.Add(metadata); + return this; + } + + public RemoveItemTransform WithMetadata( + string metadataName, + string metadataValue, + bool expressedAsAttribute = false) + { + _metadata.Add(new ItemMetadataValue( + metadataName, + metadataValue, + expressedAsAttribute: expressedAsAttribute)); + return this; + } + + public override ProjectItemElement ConditionallyTransform(T source) + { + string removeValue = _removeValueFunc(source); + + var item = _itemObjectGenerator.AddItem(_itemName, "PlaceHolderSinceNullOrEmptyCannotBePassedToConstructor"); + item.Include = null; + item.Remove = removeValue; + + foreach (var metadata in _metadata) + { + if (metadata.ShouldWriteMetadata(source)) + { + var metametadata = item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source)); + metametadata.Condition = metadata.Condition; + metametadata.ExpressedAsAttribute = metadata.ExpressedAsAttribute; + } + } + + return item; + } + } +} diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs index e6ca62262..386c44d9b 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs @@ -43,7 +43,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests public void ItHasWarningWhenMigratingADeprecatedProjectJson() { var testProjectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompile") .CreateInstance() .WithSourceFiles() .Root @@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests public void ItHasErrorWhenMigratingADeprecatedNamedResourceOptionProjectJson() { var testProjectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedNamedResourceOption") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedNamedResource") .CreateInstance() .WithSourceFiles() .Root diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index e2dd297fc..ff7321215 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -420,12 +420,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } [Theory] - [InlineData("compile", "Compile", "")] - [InlineData("embed", "EmbeddedResource", ";rootfile.cs")] - [InlineData("copyToOutput", "Content", ";rootfile.cs")] + [InlineData("compile", "Compile", 3, "")] + [InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")] + [InlineData("copyToOutput", "Content", 2, ";rootfile.cs")] private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement( string group, string itemName, + int expectedNumberOfCompileItems, string expectedRootFiles) { var testDirectory = Temp.CreateDirectory().Path; @@ -446,7 +447,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests var mockProj = RunBuildOptionsRuleOnPj(pj, testDirectory: testDirectory); - mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(2); + mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)) + .Should().Be(expectedNumberOfCompileItems); var defaultIncludePatterns = GetDefaultIncludePatterns(group); var defaultExcludePatterns = GetDefaultExcludePatterns(group); @@ -455,7 +457,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests { VerifyContentMetadata(item); - if (item.Include.Contains(@"src\file1.cs")) + if (string.IsNullOrEmpty(item.Include)) + { + item.Remove.Should() + .Be(@"src\**\*;rootfile.cs;src\file2.cs"); + } + else if (item.Include.Contains(@"src\file1.cs")) { item.Include.Should().Be(@"src\file1.cs;src\file2.cs"); item.Exclude.Should().Be(@"src\file2.cs"); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index c80911fc7..5c6813bc8 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -15,10 +15,10 @@ namespace Microsoft.DotNet.Migration.Tests public class GivenThatIWantToMigrateDeprecatedProjects : TestBase { [Fact] - public void WhenMigratingAProjectWithDeprecatedPackOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedPackOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedPack") .CreateInstance() .WithSourceFiles() .Root; @@ -52,10 +52,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedPackOptionsItSucceeds() + public void MigrateDeprecatedPack() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedPack") .CreateInstance() .WithSourceFiles() .Root; @@ -82,17 +82,17 @@ namespace Microsoft.DotNet.Migration.Tests var outputDir = projectDirectory.GetDirectory("bin", "Debug"); outputDir.Should().Exist() - .And.HaveFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg"); + .And.HaveFile("PJDeprecatedPack.1.0.0.nupkg"); - var outputPackage = outputDir.GetFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg"); + var outputPackage = outputDir.GetFile("PJDeprecatedPack.1.0.0.nupkg"); var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read); - zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec") + zip.Entries.Should().Contain(e => e.FullName == "PJDeprecatedPack.nuspec") .And.Contain(e => e.FullName == "content/Content1.txt") .And.Contain(e => e.FullName == "content/Content2.txt"); var manifestReader = new StreamReader( - zip.Entries.First(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec").Open()); + zip.Entries.First(e => e.FullName == "PJDeprecatedPack.nuspec").Open()); // NOTE: Commented out those that are not migrated. // https://microsoft.sharepoint.com/teams/netfx/corefx/_layouts/15/WopiFrame.aspx?sourcedoc=%7B0cfbc196-0645-4781-84c6-5dffabd76bee%7D&action=edit&wd=target%28Planning%2FMSBuild%20CLI%20integration%2Eone%7C41D470DD-CF44-4595-8E05-0CE238864B55%2FProject%2Ejson%20Migration%7CA553D979-EBC6-484B-A12E-036E0730864A%2F%29 @@ -120,10 +120,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompilationOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedCompilationOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompilation") .CreateInstance() .WithSourceFiles() .Root; @@ -141,10 +141,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompilationOptionsItSucceeds() + public void MigratingDeprecatedCompilation() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompilation") .CreateInstance() .WithSourceFiles() .Root; @@ -166,10 +166,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedContentOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedContentOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedContent") .CreateInstance() .WithSourceFiles() .Root; @@ -191,10 +191,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedContentOptionsItSucceeds() + public void MigratingDeprecatedContent() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedContent") .CreateInstance() .WithSourceFiles() .Root @@ -248,10 +248,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedCompileOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompile") .CreateInstance() .WithSourceFiles() .Root; @@ -269,10 +269,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileOptionsItSucceeds() + public void MigratingDeprecatedCompile() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompile") .CreateInstance() .WithSourceFiles() .Root @@ -295,10 +295,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedCompileBuiltInOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileBuiltIn") .CreateInstance() .WithSourceFiles() .Root; @@ -314,10 +314,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsItSucceeds() + public void MigratingDeprecatedCompileBuiltIn() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileBuiltIn") .CreateInstance() .WithSourceFiles() .Root @@ -341,10 +341,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedCompileExcludeOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileExclude") .CreateInstance() .WithSourceFiles() .Root; @@ -360,10 +360,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsItSucceeds() + public void MigratingDeprecatedCompileExclude() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileExclude") .CreateInstance() .WithSourceFiles() .Root; @@ -378,18 +378,17 @@ namespace Microsoft.DotNet.Migration.Tests .Execute("restore") .Should().Pass(); - // Issue: https://github.com/dotnet/cli/issues/5461 - //new DotnetCommand() - // .WithWorkingDirectory(projectDirectory) - // .Execute("build -c Debug") - // .Should().Pass(); + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build -c Debug") + .Should().Pass(); } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedResourceOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResource") .CreateInstance() .WithSourceFiles() .Root @@ -408,10 +407,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceOptionsItSucceeds() + public void MigratingDeprecatedResource() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResource") .CreateInstance() .WithSourceFiles() .Root @@ -440,10 +439,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceBuiltInOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedResourceBuiltInOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceBuiltIn") .CreateInstance() .WithSourceFiles() .Root @@ -460,10 +459,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingDeprecatedBuiltInResItSucceeds() + public void MigratingDeprecatedResourceBuiltIn() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceBuiltIn") .CreateInstance() .WithSourceFiles() .Root @@ -493,10 +492,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsWarningsArePrinted() + public void WhenMigratingDeprecatedResourceExcludeOptionsWarningsArePrinted() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceExclude") .CreateInstance() .WithSourceFiles() .Root; @@ -512,10 +511,10 @@ namespace Microsoft.DotNet.Migration.Tests } [Fact] - public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsItSucceeds() + public void MigratingDeprecatedResourceExclude() { var projectDirectory = TestAssets - .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions") + .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceExclude") .CreateInstance() .WithSourceFiles() .Root; @@ -530,17 +529,16 @@ namespace Microsoft.DotNet.Migration.Tests .Execute("restore") .Should().Pass(); - // Issue: https://github.com/dotnet/cli/issues/5461 - //new DotnetCommand() - // .WithWorkingDirectory(projectDirectory) - // .Execute("build -c Debug") - // .Should().Pass(); + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("build -c Debug") + .Should().Pass(); - //var cmd = new DotnetCommand() - // .WithWorkingDirectory(projectDirectory) - // .ExecuteWithCapturedOutput("run -c Debug"); - //cmd.Should().Pass(); - //cmd.StdOut.Should().Contain("0 Resources Found:"); + var cmd = new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("run -c Debug"); + cmd.Should().Pass(); + cmd.StdOut.Should().Contain("0 Resources Found:"); } } } From e8c5d23c29a8f8be7cc7289e6517d1b2ab77f313 Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Mon, 30 Jan 2017 14:36:44 -0800 Subject: [PATCH 85/88] display CommandParsingException gracefully (#5493) * display CommandParsing gracefully This set of changes handles CommandParsingException gracefuly (so as not to show the user a stack trace) and generalizes graceful exception display somewhat away from being type-specific. * fix compile error by inlining constant * remove unused test logging --- .../CommandUnknownException.cs | 4 --- .../ExceptionExtensions.cs | 7 ++++- .../GracefulException.cs | 6 ++--- .../ProjectMigrator.cs | 1 - .../CommandLine/CommandParsingException.cs | 3 +++ src/dotnet/MulticoreJitActivator.cs | 1 - src/dotnet/Program.cs | 7 +++-- test/dotnet-new.Tests/NewCommandTests.cs | 26 +++++++++++++++++++ 8 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 test/dotnet-new.Tests/NewCommandTests.cs diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandUnknownException.cs b/src/Microsoft.DotNet.Cli.Utils/CommandUnknownException.cs index 6a27faae2..93034ba7d 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandUnknownException.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandUnknownException.cs @@ -4,10 +4,6 @@ namespace Microsoft.DotNet.Cli.Utils { public class CommandUnknownException : GracefulException { - public CommandUnknownException() - { - } - public CommandUnknownException(string commandName) : base(string.Format( LocalizableStrings.NoExecutableFoundMatchingCommand, commandName)) diff --git a/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs index 68743b1d8..7756f77e7 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ExceptionExtensions.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.DotNet.Cli.Utils.ExceptionExtensions +namespace Microsoft.DotNet.Cli.Utils { internal static class ExceptionExtensions { @@ -11,5 +11,10 @@ namespace Microsoft.DotNet.Cli.Utils.ExceptionExtensions { Reporter.Verbose.WriteLine($"Warning: Ignoring exception: {e.ToString().Yellow()}"); } + + public static bool ShouldBeDisplayedAsError(this Exception e) => + e.Data.Contains(CLI_User_Displayed_Exception); + + internal const string CLI_User_Displayed_Exception = "CLI_User_Displayed_Exception"; } } diff --git a/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs b/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs index 817f8d03d..448049ee4 100644 --- a/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs +++ b/src/Microsoft.DotNet.Cli.Utils/GracefulException.cs @@ -4,12 +4,9 @@ namespace Microsoft.DotNet.Cli.Utils { public class GracefulException : Exception { - public GracefulException() - { - } - public GracefulException(string message) : base(message) { + Data.Add(ExceptionExtensions.CLI_User_Displayed_Exception, true); } public GracefulException(string format, params string[] args) : this(string.Format(format, args)) @@ -18,6 +15,7 @@ namespace Microsoft.DotNet.Cli.Utils public GracefulException(string message, Exception innerException) : base(message, innerException) { + Data.Add(ExceptionExtensions.CLI_User_Displayed_Exception, true); } } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index 2554ee9c8..9aa45ea11 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -10,7 +10,6 @@ using Microsoft.DotNet.Internal.ProjectModel; using Microsoft.DotNet.Internal.ProjectModel.Graph; using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Cli.Utils.ExceptionExtensions; using Microsoft.DotNet.Cli.Sln.Internal; using Microsoft.DotNet.ProjectJsonMigration.Rules; using Microsoft.DotNet.Tools.Common; diff --git a/src/dotnet/CommandLine/CommandParsingException.cs b/src/dotnet/CommandLine/CommandParsingException.cs index 375c17394..8eef0ea6f 100644 --- a/src/dotnet/CommandLine/CommandParsingException.cs +++ b/src/dotnet/CommandLine/CommandParsingException.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; namespace Microsoft.DotNet.Cli.CommandLine @@ -18,6 +19,8 @@ namespace Microsoft.DotNet.Cli.CommandLine { Command = command; _isRequireSubCommandMissing = isRequireSubCommandMissing; + + Data.Add("CLI_User_Displayed_Exception", true); } public CommandLineApplication Command { get; } diff --git a/src/dotnet/MulticoreJitActivator.cs b/src/dotnet/MulticoreJitActivator.cs index a22bb39ab..c222bab4c 100644 --- a/src/dotnet/MulticoreJitActivator.cs +++ b/src/dotnet/MulticoreJitActivator.cs @@ -4,7 +4,6 @@ using System; using System.Runtime.Loader; using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Cli.Utils.ExceptionExtensions; using Microsoft.DotNet.Tools.Common; namespace Microsoft.DotNet.Cli diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index e95d56aa4..47f8cc897 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Configurer; using Microsoft.DotNet.PlatformAbstractions; using Microsoft.DotNet.Tools.Add; @@ -76,9 +77,11 @@ namespace Microsoft.DotNet.Cli return ProcessArgs(args); } } - catch (GracefulException e) + catch (Exception e) when (e.ShouldBeDisplayedAsError()) { - Reporter.Error.WriteLine(CommandContext.IsVerbose() ? e.ToString().Red().Bold() : e.Message.Red().Bold()); + Reporter.Error.WriteLine(CommandContext.IsVerbose() ? + e.ToString().Red().Bold() : + e.Message.Red().Bold()); return 1; } diff --git a/test/dotnet-new.Tests/NewCommandTests.cs b/test/dotnet-new.Tests/NewCommandTests.cs new file mode 100644 index 000000000..2ab41b0a6 --- /dev/null +++ b/test/dotnet-new.Tests/NewCommandTests.cs @@ -0,0 +1,26 @@ +// 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 FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using System; +using System.Linq; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.DotNet.New.Tests +{ + public class NewCommandTests + { + [Fact] + public void WhenSwitchIsSkippedThenItPrintsError() + { + var cmd = new DotnetCommand().Execute("new Web1.1"); + + cmd.ExitCode.Should().NotBe(0); + + cmd.StdErr.Should().Be("Unrecognized command or argument 'Web1.1'"); + cmd.StdOut.Should().Be("Specify --help for a list of available options and commands."); + } + } +} From 1c8089990975850afdb601173dc3b929eaba6b54 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Mon, 30 Jan 2017 14:34:19 -1000 Subject: [PATCH 86/88] dotnet migrate uses the correct TreatWarningsAsErrors property (#5492) --- .../Rules/MigrateBuildOptionsRule.cs | 2 +- .../Rules/GivenThatIWantToMigrateBuildOptions.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index 1e7259bd2..ef2183979 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -55,7 +55,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules compilerOptions => compilerOptions.PreserveCompilationContext != null && compilerOptions.PreserveCompilationContext.Value); private AddPropertyTransform WarningsAsErrorsTransform => - new AddPropertyTransform("WarningsAsErrors", + new AddPropertyTransform("TreatWarningsAsErrors", compilerOptions => compilerOptions.WarningsAsErrors.ToString().ToLower(), compilerOptions => compilerOptions.WarningsAsErrors != null && compilerOptions.WarningsAsErrors.Value); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index ff7321215..521618155 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -193,8 +193,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } }"); - mockProj.Properties.Count(p => p.Name == "WarningsAsErrors").Should().Be(1); - mockProj.Properties.First(p => p.Name == "WarningsAsErrors").Value.Should().Be("true"); + mockProj.Properties.Count(p => p.Name == "TreatWarningsAsErrors").Should().Be(1); + mockProj.Properties.First(p => p.Name == "TreatWarningsAsErrors").Value.Should().Be("true"); mockProj = RunBuildOptionsRuleOnPj(@" { @@ -203,7 +203,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } }"); - mockProj.Properties.Count(p => p.Name == "WarningsAsErrors").Should().Be(0); + mockProj.Properties.Count(p => p.Name == "TreatWarningsAsErrors").Should().Be(0); } [Fact] From 87e2a563935cf828ceffc7cf33fcd80d678e48c6 Mon Sep 17 00:00:00 2001 From: Ryan Stelly Date: Mon, 30 Jan 2017 19:15:44 -0600 Subject: [PATCH 87/88] use correct description string for dotnet build -h: -c (#5507) --- src/dotnet/commands/dotnet-build/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-build/Program.cs b/src/dotnet/commands/dotnet-build/Program.cs index 64fb721e8..785d3b944 100644 --- a/src/dotnet/commands/dotnet-build/Program.cs +++ b/src/dotnet/commands/dotnet-build/Program.cs @@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Tools.Build CommandOption runtimeOption = app.Option( $"-r|--runtime <{LocalizableStrings.RuntimeOptionName}>", LocalizableStrings.RuntimeOptionDescription, CommandOptionType.SingleValue); - CommandOption configurationOption = app.Option($"-c|--configuration <{LocalizableStrings.ConfigurationOptionName}>", LocalizableStrings.FrameworkOptionDescription, CommandOptionType.SingleValue); + CommandOption configurationOption = app.Option($"-c|--configuration <{LocalizableStrings.ConfigurationOptionName}>", LocalizableStrings.ConfigurationOptionDescription, CommandOptionType.SingleValue); CommandOption versionSuffixOption = app.Option($"--version-suffix <{LocalizableStrings.VersionSuffixOptionName}>", LocalizableStrings.VersionSuffixOptionDescription, CommandOptionType.SingleValue); CommandOption noIncrementalOption = app.Option("--no-incremental", LocalizableStrings.NoIncrementialOptionDescription, CommandOptionType.NoValue); From 3eee54e4f9985f76f769d4a494a396c16944d4bb Mon Sep 17 00:00:00 2001 From: Faizan2304 Date: Mon, 30 Jan 2017 21:05:16 -0800 Subject: [PATCH 88/88] Inserting localize testplatform (#5510) --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- .../commands/dotnet-new/CSharp_Mstest/$projectName$.csproj | 2 +- .../commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj | 2 +- .../commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj | 2 +- .../commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index cadfcb6df..9391f07a4 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,7 +6,7 @@ 1.0.0-alpha-20170125-1 4.0.0-rtm-2241 1.0.0-alpha-20170120-3-249 - 15.0.0-preview-20170123-02 + 15.0.0-preview-20170125-04 1.0.0-beta1-20170108-83 diff --git a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj index 229580c09..5c1b545d3 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj index 22bf0da91..d9861e85f 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj index fbccc158c..29391a64b 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Mstest/$projectName$.fsproj @@ -13,7 +13,7 @@ - + diff --git a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj index cbd1570f0..abe460164 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj +++ b/src/dotnet/commands/dotnet-new/FSharp_Xunittest/$projectName$.fsproj @@ -13,7 +13,7 @@ - +