Skip to content

dotnet watch support for launching program in a different working directory #29539

@Skyedra

Description

@Skyedra

Is your feature request related to a problem? Please describe.

To test my program, I launch my program in a specific test folder that contains my test data. This test folder is not the same as the source code project folder.

I would like to be able to watch a program for changes, then re-run it. To test this program, it needs to be executed in a different (non-project) folder.

Detail

There are three methods I use for running my test program in a different paths. The first two work, but do not provide CLI watch functionality.

  1. Works OK: launch.json in vscode -- works fine, I can specify a "cwd" field and then run via IDE

  2. Works OK: via shell, cd into test directory and then dotnet run:

cd test
TEST_ENV_VAR="test" dotnet run --project "../ProjectFolder" TEST_PARAM1 TEST_PARAM2

(Runs in test folder)

  1. Does not work: via cli, cd into test directory and then dotnet watch run:
cd test
TEST_ENV_VAR="test" dotnet watch run --project "../ProjectFolder" TEST_PARAM1 TEST_PARAM2

(Runs in project folder)

This feature request is to solve the third case, so watch can execute the watched program in another folder

Describe the solution you'd like

Possible solutions (any would work):

  1. Watch remembers starting working directory and then executes program using it, or
  2. Add a 'cwd' parameter to watch to manually specify working path, or
  3. Ability to create a watch in launch.json and run it via cli (no ide needed)

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions