Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VS Code launcher and tasks for dotnet watch #10881

Merged
merged 8 commits into from
Mar 8, 2022
Merged

Conversation

Skrypt
Copy link
Contributor

@Skrypt Skrypt commented Dec 15, 2021

WIP

  • Remove publish launchers. They can be executed as tasks from the command palette in VS Code.
  • Add dotnet watch task.
  • Make attach to process work when using dotnet watch
  • Fix gulp build task
  • Fix dotnet run task. Specifying a framework target since now we use multi-targetting.
  • Make dotnet watch launcher config so that we can also launch the browser automatically like before.

The dotnet watch solution depends on :
See https://github.com/Trottero/dotnet-watch-attach
VS Code Extension : https://marketplace.visualstudio.com/items?itemName=Trottero.dotnetwatchattach

Launchers

image

Tasks

orchard.mp4

@Skrypt Skrypt marked this pull request as ready for review February 11, 2022 21:29
@Skrypt
Copy link
Contributor Author

Skrypt commented Mar 6, 2022

This works perfectly without any issues now.

"args": [
"gulp build"
Copy link
Member

Choose a reason for hiding this comment

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

Should this be npm run build instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

never tried but that's for debugging the gulpfile.js

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but this required gulp to be installed globally. npm run build does not as it uses gulp from node_modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the default task suggested. npm run build will try to install it if not found every time whereas this will just execute what is needed knowing that it is already installed globally or locally. I don't mind changing it, but need to test it first.

Copy link
Member

Choose a reason for hiding this comment

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

Npm run build does not install first as far as I know. It simply runs a script as defined in the package.json script section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. But then it will do the same if the gulp package is not installed. So, here it is just a task that executes the gulp build command to debug it without knowing if it's installed or not. What you suggest is to run the gulp pipeline by passing through npm which could lead to executing also something else than gulp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, we keep it there because it was there and I updated the task to comply with the latest VS Code tasks implementation details; but it's not something that we use much. Also, it is looking like we might need to move to WebPack or something else at some point.

Copy link
Contributor Author

@Skrypt Skrypt Mar 7, 2022

Choose a reason for hiding this comment

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

More on this. The actual VS Code launcher is expecting to get the gulp.js file from the local node_modules folder. The package.json file standing in the root folder of the project imports gulp ^4.0.2 so it is required to do an npm install before running this launcher for this to work else it will fail to find gulp.js.

    {
      "name": "Gulp Debug",
      "type": "node",
      "request": "launch",
      "program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
      "stopOnEntry": false,
      "args": [],
      "cwd": "${workspaceRoot}",
      "runtimeArgs": [
        "--nolazy"
      ],
      "console": "internalConsole"
    }

@Skrypt
Copy link
Contributor Author

Skrypt commented Mar 7, 2022

Is anyone interested in this pull request to be merged or should I remove the "dotnet watch" part of it?

@jptissot
Copy link
Member

jptissot commented Mar 7, 2022

I like it. Personally I just have powershell alias so I can write oc or ocw and it runs or watches the project in the console. And then I just attach to the process when I need to debug.

@Skrypt
Copy link
Contributor Author

Skrypt commented Mar 8, 2022

Ok, well I will wait for someone to approve the PR 😄

@Skrypt Skrypt merged commit 275ce1e into main Mar 8, 2022
@Skrypt Skrypt deleted the skrypt/dotnet-watch branch March 8, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants