Running a task of Visual Studio Code from the command line - visual-studio-code

I've a simple project in visual studio code with some defined tasks in tasks.json. Let's say the task are labeled with foo and bar.
Inside of visual studio code I can run CTRL+B and select the wanted task.
But - How can I run the task foo from a command line outside of Visual Studio Code?

There is a python tool that runs the vscode tasks. The last commit was in 2018, but it still might work as it seems that the tasks were last changed in vscode 1.13, released in 2017.
edit:
It works but setup.py:8 needs to be edited to build the wheel on windows, as it tries to run a shell script. My edit was to change the line to log = subprocess.check_output('sh bin/changelog') as I have sh installed.

Related

How to stop a command in the Visual Studio Code terminal while visual studio isn't in focus

Similar to: How to stop a command in the Visual Studio Code terminal
Is there a way to stop and/or pause a command when VS Code is in the background or minimised?
If you are on windows your could use the task manager to kill the node process running your app.
You should see the node task under the if you click to expand the VSC icon

Visual Studio test task fails in pipeline but succeeds in test console

I am using Visual studio test task to run all my tests as a part of my build definition.
The options that I have enabled are as attached below:
Now, the problem here is that, some of my tests always fail when I run them from the build pipleine , however all of these test seem to pass when I run them via
vstests console.exe command.
ex: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\VSTest.Console" <path to dll>
Does anyone have any clue what could be wrong in here?
Thanks.
Using the Installed by tools installer selection, I would need to see what your tools installation task is doing to provide additional info. Maybe you're not installing a version that is compatible with the tests?
If you don't have a specific need to call out a different test platform version, maybe try using Latest.
OR
Since you're calling ...\Microsoft Visual Studio 14.0\...\VSTest.Console, you may want to select the Visual Studio 2015 option.

Visual Studio Code no longer jumps to errors in terminal on control click

Formerly I could just run build commands in the integrated terminal, and then control click on the error results to jump to the associated files. This has stopped working with the recent update.
I do not use tasks.json or 'build', I just run the command directly in the terminal.
What can I do?

Grunt and Gulp files not detected by visual studio code

In the current version if VS Code it should be possible to run grunt or gulp tasks as written here: Tasks in visual Studio Code
But when i press F1 and enter "Run Task", then i can only run tasks from the tasks.json file. I even used the Gulp file from the Docs.
What am i missing or could this bi a bug?
OK the solution seems to be that the commad property in task.json must be set to grunt or gulp respectively. It is strange that this is mentioned later under another topic in the Docs.

CodeAnalysis using msbuild does not fail on warning/error

I started down this path of wanting to do code analysis on my solution using msbuild. I was looking at FxCop but it appears to now be part of Visual Studio and from my understanding you need Visual Studio installed on your build agents.
I am calling msbuild from a powershell using the following command;
"$(get-content env:systemroot)\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /tv:4.0 /p:RunCodeAnalysis=Always"
It appears to run the code analysis and output warnings but never fails the build, even after I added <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
to my .csproj file.
All I want is to run code analysis from msbuild command line and have it fail the build if any warning is found. I understand it can be done in Visual Studio but I need to be able to run this from the command line (with/without VS2013)
Am I missing something? Shouldn't /p:RunCodeAnalysis=Always and setting the CodeAnalysisTreatWarningsAsErrors to true be all that is needed?