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