dotnet-installer/test/Microsoft.DotNet.ProjectJsonMigration.Tests
Dustin Campbell 0a62481cc0 Create backup folder in the directory where 'dotnet migrate' is executed (#5306)
* Create backup folder in the directory where 'dotnet migrate' is executed

With this change, 'dotnet migrate' will create the backup folder in the workspace directory rather
than the parent of the workspace directory. This solves two problems:

1. It makes it easier for the user where the backup is -- it's in the directory they targeted with
'dotnet migrate'.
2. It solves a problem of file oollisions with global.json files when migrating multiple projects.
Consider the following directory structure:

    root
        |
        project1
            |
            global.json
            |
            src
                |
                project1
        project2
            |
            global.json
            |
            src
                |
                project2

    Prior to this change, running 'dotnet migrate' project1 and then running it again in project2
    would have caused an exception to be thrown because the migration would try to produce a backup
    folder like so:

    root
        |
        backup
        |  |
        |   global.json
        |   |
        |   project1
        |   |
        |   project2
        |
        |
        project1
            |
            src
                |
                project1
        project2
            |
            src
                |
                project2

    Now, we produce the following structure, which has no collisions:

    root
        |
        project1
            |
            backup
            |   |
            |   global.json
            |   |
            |   project1
            |
            src
                |
                project1
        |
        project2
            |
            backup
            |   |
            |   global.json
            |   |
            |   project2
            |
            src
                |
                project2

In addition, to help avoid further collisions, a number is appened to the backup folder's name if
it already exists. So, if the user runs dotnet migrate again for some reason, they'll see backup_1,
backup_2, etc.

* Fix test helper

* Fix foolish bug causing infinite loop

* Fix up a couple more tests

* Rework MigrationBackupPlan to process all projects at once

* Fix up tests

* Still fixing tests

* Compute common root folder of projects to determine where backup folder should be placed

* Fix typo

* Fix test to not look in backup folder now that it's in a better location
2017-01-21 01:58:28 -08:00
..
Rules Updating the versions of xunit 2.2.0-beta5-build3474 and xunit runner to 2.2.0-beta5-build1225. 2017-01-16 13:08:40 -08:00
Transforms Migrating all test projects (#4668) 2016-11-11 21:46:29 -10:00
GivenAProjectMigrator.cs Addressing code review comments. 2016-12-08 20:06:55 -08:00
GivenMSBuildExtensions.cs remove some tests 2016-09-21 13:19:01 -07:00
Microsoft.DotNet.ProjectJsonMigration.Tests.csproj Updating our projects and test assets to work with the latest SDK. 2017-01-05 19:44:52 -08:00
MigrationBackupPlanTests.cs Create backup folder in the directory where 'dotnet migrate' is executed (#5306) 2017-01-21 01:58:28 -08:00
MSBuild.exe PR Feedback 2016-08-30 12:00:56 -07:00
MSBuild.exe.config PR Feedback 2016-08-30 12:00:56 -07:00
ProjectJsonBuilder.cs use Sdks attribute in dotnet new templates (#4916) 2016-12-04 22:31:58 -08:00
TemporaryProjectFileRuleRunner.cs Removing the PackageTargetFallback condition on TFM when there is only a single TFM 2017-01-03 20:36:51 -08:00