From d39ee4a4639fea68459719e2f60ece994e1a4703 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Wed, 16 Nov 2016 01:10:55 -0800 Subject: [PATCH] add *.xproj.user to backup file types --- .gitignore | 7 ++++++- .../PJTestAppSimple/PJTestAppSimple.xproj | 18 ++++++++++++++++++ .../PJTestAppSimple/PJTestAppSimple.xproj.user | 1 + .../TestAppWithLibrary/TestApp/TestApp.xproj | 18 ++++++++++++++++++ .../TestApp/TestApp.xproj.user | 1 + .../TestLibrary/TestLibrary.xproj | 18 ++++++++++++++++++ .../TestLibrary/TestLibrary.xproj.user | 1 + .../commands/dotnet-migrate/MigrateCommand.cs | 3 ++- .../GivenThatAnAppWasMigrated.cs | 2 +- 9 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj create mode 100644 TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj.user create mode 100644 TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj create mode 100644 TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj.user create mode 100644 TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj create mode 100644 TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj.user diff --git a/.gitignore b/.gitignore index 27def2cb6..3fc22dc00 100644 --- a/.gitignore +++ b/.gitignore @@ -295,4 +295,9 @@ test/PackagedCommands/Consumers/*/project.json *.*~ # VS generated files -launchSettings.json \ No newline at end of file +launchSettings.json + +# user files used in tests +!TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj.user +!TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj.user +!TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj.user diff --git a/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj b/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj new file mode 100644 index 000000000..53f0c8b7a --- /dev/null +++ b/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.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 + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj.user b/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj.user new file mode 100644 index 000000000..efbe88aa6 --- /dev/null +++ b/TestAssets/TestProjects/PJTestAppSimple/PJTestAppSimple.xproj.user @@ -0,0 +1 @@ +Ok, it's true. Didn't have an xproj user file handy and needed the file to exist so a test can show it gets moved to backup. \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj b/TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj new file mode 100644 index 000000000..53f0c8b7a --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithLibrary/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 + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj.user b/TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj.user new file mode 100644 index 000000000..efbe88aa6 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithLibrary/TestApp/TestApp.xproj.user @@ -0,0 +1 @@ +Ok, it's true. Didn't have an xproj user file handy and needed the file to exist so a test can show it gets moved to backup. \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj b/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj new file mode 100644 index 000000000..53f0c8b7a --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.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 + + + \ No newline at end of file diff --git a/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj.user b/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj.user new file mode 100644 index 000000000..efbe88aa6 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/TestLibrary.xproj.user @@ -0,0 +1 @@ +Ok, it's true. Didn't have an xproj user file handy and needed the file to exist so a test can show it gets moved to backup. \ 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 420dc1e1b..dead19440 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -149,7 +149,8 @@ namespace Microsoft.DotNet.Tools.Migrate var movableFiles = new DirectoryInfo(projectDirectory) .EnumerateFiles() - .Where(f => f.Name == Project.FileName || f.Extension == ".xproj"); + .Where(f => f.Name == Project.FileName || f.Extension == ".xproj" || + f.FullName.EndsWith(".xproj.user")); foreach (var movableFile in movableFiles) { diff --git a/test/dotnet-migrate.Tests/GivenThatAnAppWasMigrated.cs b/test/dotnet-migrate.Tests/GivenThatAnAppWasMigrated.cs index a402ee770..801283473 100644 --- a/test/dotnet-migrate.Tests/GivenThatAnAppWasMigrated.cs +++ b/test/dotnet-migrate.Tests/GivenThatAnAppWasMigrated.cs @@ -84,7 +84,7 @@ namespace Microsoft.DotNet.Migration.Tests { var catalog = new Dictionary(); - var patterns = new [] { "global.json", "project.json", "*.xproj" }; + var patterns = new [] { "global.json", "project.json", "*.xproj", "*.xproj.user" }; foreach (var pattern in patterns) {