1dotnet migrate command(1) .NET Core dotnet migrate command(1)
2
3
4
6 This article applies to: ✓ .NET Core 1.x SDK ✓ .NET Core 2.x SDK
7
9 dotnet migrate - Migrates a Preview 2 .NET Core project to a .NET Core
10 SDK-style project.
11
13 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]
14 dotnet migrate [-h|--help]
15
17 The dotnet migrate command migrates a valid Preview 2 project.json-
18 based project to a valid .NET Core SDK-style csproj project.
19
20 By default, the command migrates the root project and any project ref‐
21 erences that the root project contains. This behavior is disabled us‐
22 ing the --skip-project-references option at runtime.
23
24 Migration can be performed on the following assets:
25
26 · A single project by specifying the project.json file to migrate.
27
28 · All of the directories specified in the global.json file by passing
29 in a path to the global.json file.
30
31 · A solution.sln file, where it migrates the projects referenced in the
32 solution.
33
34 · On all subdirectories of the given directory recursively.
35
36 The dotnet migrate command keeps the migrated project.json file inside
37 a backup directory, which it creates if the directory doesn’t exist.
38 This behavior is overridden using the --skip-backup option.
39
40 By default, the migration operation outputs the state of the migration
41 process to standard output (STDOUT). If you use the --report-file <RE‐
42 PORT_FILE> option, the output is saved to the file specify.
43
44 The dotnet migrate command only supports valid Preview 2 project.json-
45 based projects. This means that you cannot use it to migrate DNX or
46 Preview 1 project.json-based projects directly to MSBuild/csproj
47 projects. You first need to manually migrate the project to a Preview
48 2 project.json-based project and then use the dotnet migrate command to
49 migrate the project.
50
51 The dotnet migrate command is no longer available starting with .NET
52 Core 3.0 SDK.
53
54 Arguments
55 PROJECT_JSON/GLOBAL_JSON/SOLUTION_FILE/PROJECT_DIR
56
57 The path to one of the following:
58
59 · a project.json file to migrate.
60
61 · a global.json file: the folders specified in global.json are migrat‐
62 ed.
63
64 · a solution.sln file: the projects referenced in the solution are mi‐
65 grated.
66
67 · a directory to migrate: recursively searches for project.json files
68 to migrate inside the specified directory.
69
70 Defaults to current directory if nothing is specified.
71
73 --format-report-file-json <REPORT_FILE>
74
75 Output migration report file as JSON rather than user messages.
76
77 -h|--help
78
79 Prints out a short help for the command.
80
81 -r|--report-file <REPORT_FILE>
82
83 Output migration report to a file in addition to the console.
84
85 -s|--skip-project-references [Debug|Release]
86
87 Skip migrating project references. By default, project references are
88 migrated recursively.
89
90 --skip-backup
91
92 Skip moving project.json, global.json, and *.xproj to a backup directo‐
93 ry after successful migration.
94
95 -t|--template-file <TEMPLATE_FILE>
96
97 Template csproj file to use for migration. By default, the same tem‐
98 plate as the one dropped by dotnet new console is used.
99
100 -v|--sdk-package-version <VERSION>
101
102 The version of the sdk package that’s referenced in the migrated app.
103 The default is the version of the SDK in dotnet new.
104
105 -x|--xproj-file <FILE>
106
107 The path to the xproj file to use. Required when there is more than
108 one xproj in a project directory.
109
111 Migrate a project in the current directory and all of its project-to-
112 project dependencies:
113
114 dotnet migrate
115
116 Migrate all projects that global.json file includes:
117
118 dotnet migrate path/to/global.json
119
120 Migrate only the current project and no project-to-project (P2P) depen‐
121 dencies. Also, use a specific SDK version:
122
123 dotnet migrate -s -v 1.0.0-preview4
124
125
126
127 dotnet migrate command(1)