This article applies to: ✓ .NET Core 1.x SDK ✓ .NET Core 2.x SDK
dotnet migrate [<SOLUTION_FILE|PROJECT_DIR>] [--format-report-file-json] [-r|--report-file] [-s|--skip-project-references] [--skip-backup] [-t|--template-file] [-v|--sdk-package-version] [-x|--xproj-file] dotnet migrate [-h|--help]
dotnet migrate command migrates a valid Preview 2 project.json-based project to a valid .NET Core SDK-style csproj project.
By default, the command migrates the root project and any project references that the root project contains. This behavior is disabled using the
--skip-project-references option at runtime.
Migration can be performed on the following assets:
- A single project by specifying the project.json file to migrate.
- All of the directories specified in the global.json file by passing in a path to the global.json file.
- A solution.sln file, where it migrates the projects referenced in the solution.
- On all subdirectories of the given directory recursively.
dotnet migrate command keeps the migrated project.json file inside a
backup directory, which it creates if the directory doesn’t exist. This behavior is overridden using the
By default, the migration operation outputs the state of the migration process to standard output (STDOUT). If you use the
--report-file <REPORT_FILE> option, the output is saved to the file specify.
dotnet migrate command only supports valid Preview 2 project.json-based projects. This means that you cannot use it to migrate DNX or Preview 1 project.json-based projects directly to MSBuild/csproj projects. You first need to manually migrate the project to a Preview 2 project.json-based project and then use the
dotnet migrate command to migrate the project.
dotnet migrate command is no longer available starting with .NET Core 3.0 SDK.
The path to one of the following:
- a project.json file to migrate.
- a global.json file: the folders specified in global.json are migrated.
- a solution.sln file: the projects referenced in the solution are migrated.
- a directory to migrate: recursively searches for project.json files to migrate inside the specified directory.
Defaults to current directory if nothing is specified.
- --format-report-file-json <REPORT_FILE>
- Output migration report file as JSON rather than user messages.
- Prints out a short help for the command.
- -r|--report-file <REPORT_FILE>
- Output migration report to a file in addition to the console.
- -s|--skip-project-references [Debug|Release]
- Skip migrating project references. By default, project references are migrated recursively.
- Skip moving project.json, global.json, and *.xproj to a
backupdirectory after successful migration.
- -t|--template-file <TEMPLATE_FILE>
- Template csproj file to use for migration. By default, the same template as the one dropped by
dotnet new consoleis used.
- -v|--sdk-package-version <VERSION>
- The version of the sdk package that’s referenced in the migrated app. The default is the version of the SDK in
- -x|--xproj-file <FILE>
- The path to the xproj file to use. Required when there is more than one xproj in a project directory.
Migrate a project in the current directory and all of its project-to-project dependencies:
Migrate all projects that global.json file includes:
dotnet migrate path/to/global.json
Migrate only the current project and no project-to-project (P2P) dependencies. Also, use a specific SDK version:
dotnet migrate -s -v 1.0.0-preview4