Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Summary

Improves the user experience when converting file-based apps to project-based apps by making the output directory prompt clearer and more informative.

Problem

When running dotnet project convert in interactive mode, users encountered a confusing prompt:

Specify the output directory (hello):

This led to confusion because:

  • It wasn't clear that (hello) was the default value
  • It wasn't clear that pressing Enter would use that default
  • It wasn't clear that the output directory must not already exist
  • Users who entered an existing directory path (e.g., their current workspace) received an error without understanding why

As shown in the reported issue, users would try entering their current directory path, see "The target directory already exists" error, and be confused about what action to take.

Solution

Updated the prompt to be explicit and helpful:

Specify the output directory (press Enter for default: 'hello', directory must not exist):

Before:

Specify the output directory (hello):

After:

Specify the output directory (press Enter for default: 'hello', directory must not exist):

Changes

  • Updated ProjectConvertAskForOutputDirectory resource string in CliCommandStrings.resx
  • Localization files (.xlf) automatically updated and marked for translation review with state="needs-review-translation"

Testing

  • All 78 existing DotnetProjectConvertTests pass without modification
  • Manually verified interactive mode displays the new prompt correctly
  • Manually verified error handling when directory exists
  • No breaking changes to existing functionality

Benefits

  1. Clearer UX: Users immediately understand what pressing Enter does
  2. Explicit constraints: Users know the directory must not exist upfront
  3. Better guidance: Reduces confusion and support burden
  4. Minimal change: Single resource string modification with no code changes

Fixes #[issue number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Additional clarity for converting file-based app to project-based app via CLI command</issue_title>
<issue_description>When trying to convert a file-based app to a project-based app in VS Code using the integrated terminal, the CLI asks for an output directory. I entered the path of the workspace that was open and all I got was "The target directory already exists" and it didn't convert the project. I had to guess shortly after and press enter with no input to have it take the target directory.

Request

I'd like for the CLI to either have a hint (like azd does?) to say that if you press enter it will take the current directory as the workspace open or if I input a path that happens to be the target path to just honor that and convert the project. (or both!!)

Maybe something like "Current target directory (directory path). Press enter to convert project in target directory or specify output directory:" (A bit long but you get it)

Image</issue_description>

<agent_instructions>Can you clarify the prompt for the output directory? Make it clearer what the default value is and also that the output directory should not exist yet.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@DamianEdwards /Cc @jjonescz @jjonescz > I'd like for the CLI to either have a hint (like azd does?) to say that if you press enter it will take the current directory

There is already a hint that the default folder is "hello" in your case (that's the (hello) after the prompt). Perhaps we could make that clearer by saying (press Enter to for the default: './hello/') or something like that instead.

if I input a path that happens to be the target path to just honor that and convert the project.

If you specify a directory which doesn't exist, that should work. If the directory already exists, the conversion might overwrite the files inside, that's why that isn't currently allowed. We could add a prompt to ask if that's okay though.</comment_new>
<comment_new>@claudiaregio
I will say that I was confused with the parentheses just saying (hello), I would +1 @jjonescz 's suggestion of ('./hello/') or the full path.. in C#DK we could maybe do work to show the path with the farthest we'd go back being the workspace open if it's too long..

If you specify a directory which doesn't exist, that should work. If the directory already exists, the conversion might overwrite the files inside, that's why that isn't currently allowed.

We can't just add the files as opposed to override? </comment_new>
<comment_new>@DamianEdwards
@claudiaregio how would the CLI know the path VS Code is open on? Aren't we talking about the CLI experience here? I'd expect any implied context to be based on the PWD of the terminal the CLI is running in, rather than anything in VS Code.</comment_new>
<comment_new>@DamianEdwards

We can't just add the files as opposed to override?

If the files have the same name it's ambiguous what the name of the added file would be. I think we're saying the target of the convert operation has to be a new directory as there's a lot of ways creating a project in an existing directory can go bad.</comment_new>

Fixes #50934


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Updated the prompt message to clarify:
- That pressing Enter will use the default directory shown
- That the output directory must not already exist

Old prompt: "Specify the output directory (hello):"
New prompt: "Specify the output directory (press Enter for default: 'hello', directory must not exist):"

This addresses user confusion when converting file-based apps to project-based apps.

Fixes dotnet/sdk issue about CLI output directory clarity.

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add output directory hint for app conversion Improve clarity of 'dotnet project convert' output directory prompt Oct 24, 2025
Copilot AI requested a review from jjonescz October 24, 2025 12:48
Copilot finished work on behalf of jjonescz October 24, 2025 12:48
@jjonescz jjonescz requested review from a team and Copilot October 24, 2025 12:54
@jjonescz jjonescz marked this pull request as ready for review October 24, 2025 12:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the user experience of the dotnet project convert command by making the output directory prompt clearer and more informative, addressing user confusion about default values and directory requirements.

Key changes:

  • Updated the prompt message to explicitly indicate that pressing Enter uses the default value
  • Added clarification that the output directory must not already exist
  • Properly marked localization files for translation review

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

File Description
src/Cli/dotnet/Commands/CliCommandStrings.resx Updated the ProjectConvertAskForOutputDirectory resource string with clearer prompt text
src/Cli/dotnet/Commands/xlf/*.xlf Automatically updated localization files with new source text and marked targets as needs-review-translation

@marcpopMSFT marcpopMSFT added the Area-Run Issues relating to `dotnet run` label Oct 28, 2025
@marcpopMSFT marcpopMSFT requested a review from baronfel October 28, 2025 20:26
</data>
<data name="ProjectConvertAskForOutputDirectory" xml:space="preserve">
<value>Specify the output directory ({0}):</value>
<value>Specify the output directory (press Enter for default: '{0}', directory must not exist):</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't couple the 'prompt' string and the 'detail' clarification - we need the two texts separate because the 'real' prompt (from Spectre when that is merged) will display the 'detail' clarification (as well as the 'default' value portion of the prompt) in different ways and in different locations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know Spectre prompts had some detail clarification part (I don't see it in the docs either).

As for the default part, Spectre doesn't allow customizing that other than via the prompt text anyway, like

new TextPrompt<T>($"...original prompt... [grey](default: {Markup.Escape($"{defaultValue}")})[/]:")
  .DefaultValue(defaultValue)
  .HideDefaultValue();

(note that this should currently be done always if the default value can be arbitrary to avoid spectreconsole/spectre.console#1181 as Spectre doesn't Markup.Escape the default value itself)

So I'm unsure how exactly you imagine the split here - and anyway that sounds like premature refactoring unless we actually have Spectre.

@jjonescz jjonescz added Area-run-file Items related to the "dotnet run <file>" effort and removed Area-Run Issues relating to `dotnet run` labels Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants