Description
Make dotnet project convert app.cs
interactive, asking the following questions:
- output directory (default same as it is now)
- whether to delete source files (default to be no)
Questions can be answered via named options in original invocation, thus making the command non-interactive.
Example of interactive flow followed by non-interactive invocation:
$ ls
app.cs
$ dotnet project convert --help
Description:
Convert a file-based program to a project-based program.
Usage:
dotnet project convert <file> [options]
Arguments:
<file> Path to the file-based program.
Options:
-o, --output <output> Path to directory to place the generated output.
-s, --source <choice> What to do with source files (copy/move).
--force Force conversion even if there are malformed directives.
-?, -h, --help Show command line help.
$ dotnet project convert app.cs
Converting app.cs to a project-based program:
Specify the output directory (./app): app
Source files action (Copy/Move): copy
Project ./app/app.csproj created successfully
$ ls
app app.cs
$ ls app
app.csproj Program.cs
$ rm -rf ../app
$ ls
app.cs
$ dotnet project convert app.cs --output MyApp --source move
Project ./MyApp/app.csproj created successfully
$ ls
MyApp
$ ls MyApp
app.csproj Program.cs
$