I'm working with visual studio code tasks and can define arguments in a task successfully upfront as follows:
{"version":"0.1.0","command":"example","isShellCommand":true,"tasks":
[{"taskName":"example task","suppressTaskName":true,"args":["examplearg"]}]}
I would like to be able to type in the argument when running the task, as the argument needs to be user defined, is that possible? For example I would like to be able to Run Task from command pallete: example task --myCustomArg.
Not possible. Open an issue in their repo and see what they say.
There is, however, a way to pass the current file. See here.
Your last choice would be to create an extension. You should give it a try as well. 😊
Related
I am giving D a shot with the VS code extension code-d. Everything works fine, except that I can't switch configuration, arch type or build type. If I try to do any of these things, I receive the following output message in code-d & serve-d:
{"code":-32602,"data":null,"message":"`params` MUST be an object (named arguments) or array (positional arguments), other types are not allowed by spec"}
At this point, I only have a hello world project, as described in the code-d documentation. Am I missing something?
There is a workaround for this. You can use user tasks in vs code. Create user tasks in vs code for each of your build configuration. Then install this extension (https://github.com/actboy168/vscode-tasks). This will pick each of your task and display it in the task bar of vs code. So you only need a mouse click.
Does anyone know if it's possible to write an extension in Visual Studio code that can write the values in the variables window to a file after each step while in debug mode. So, a step would happen, the variable would get written to a file, another step would happen, and the next set of variables would be written. Is there anything like this out there? Can it even be done?
Here's what I have so far:
1) I created an extension in VS code, and will write my functionality in the following provided method:
function activate(context) {
let disposable = vscode.commands.registerCommand('extension.helloWorld', function () {
// Display a message box to the user
vscode.window.showInformationMessage('Hello World!');
});
2) There are some variables offered here that could be relevant (such as debugger), but they throw errors when I use them.
To explain more clearly, what I would like to do is the following: create an extension in VS code that when used launches another instance of VS code (as does every extension), and within this new instance, load a user program, debug the program step by step, and write the variables at each step of the user program to a file. This main reason for even making the extension is the last step, as VS Code doesn't have any built in functionality to do anything like this that I know of. One issue is I am not sure the 'debugger' variable in the extension (or any variables) refer to the new instance, and if there is a way to do this.
If there is a better and smarter approach, I would love to hear it.
Thank you very much everyone in advance
I have a list of several thousand NUnit tests that I want to run (generated automatically by another tool). (This is a subset of all of the tests, and changes frequently)
I'd like to be able to run these via NUnit-Console.exe. Unfortunately the /run option only takes a direct list of files which in my case would not fit on a single command line. I'd like it to pickup the list from a filename.
I appreciate that I could use categories, but the list I want to run changes frequently and so I'd prefer not to have to start changing source code.
Does anyone know if there is a clean way to get NUnit to run my specified tests?
(I could break it down into a series of smaller calls to NUnit-console with a full command line, but that's not very elegant)
(If it's not possible, maybe I should add it as an NUnit feature request.)
Had a reply from Charlie Poole (from NUnit development team), that this is not currently possible but has been added as a feature request for NUnit 2.6
I see what you're saying, but like you say you can run a single fixture from the command line.
nunit-console /fixture:namespace.fixture tests.dll
How about generating all the tests in the same fixture? Or place them all in the same assembly?
nunit-console tests.dll
As mentioned in the nunitLink, we need to mention the scenario/test case name. It simple but it has bit of a trick in it. Directly mentioning the test case name will not serve the purpose and you will end up with the 0 testcases executed. We need to write the exact path for the same.
I don't know how it works for other languages but using c# I have found a solution. Whenever we create a feature file corresponding feature.cs file get's created in Visual Studio. Click on the featureFileName.feature.cs and look for namespace and keep it aside(Part 1)
namespace MMBank.Test.Features
Scroll a bit down you will get the class name. Note that as well and keep it aside(Part 2)
public partial class HistoricalTransactionFeature
Keep scrolling down, you will see the code which nunit understands for execution basically.
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("TC_1_A B C D")]
[NUnit.Framework.CategoryAttribute("MM_Bank")]
Below the code you can see the function/method name which will most likely be TC_1_ABCD(certain parameters)
public virtual void TC_1_ABCD(string username, string password, string visit)
You will be having multiple such methods based on no. of scenarios you have in your feature file. Note the method(test case) which you want to execute and keep it aside(Part 3)
Now collate all the parts with dots. Finally you will land up with something like this,
MMBank.Test.Features.HistoricalTransactionFeature.TC_1_ABCD
This is it. Similarly you can create the test case names from multiple feature files and stack them up in text file. Every test case name should be in different line. For command you can browse through above nunit link for execution using command prompt.
Given this command:
MSBuild.exe build.xml /p:Configuration=Live /p:UseMerge=true /p:EnableUpdateable=false
how can I form a string like this in my build script:
UseMerge=true;EnableUpdateable=true
where I might not know which properties were used at the command line.
What are you going to do with the list?
There's no built in "properties that came via the commandline" thing a la splatting in PowerShell 2.0
Remember properties can come from environment variables and/or other scripts.
Also, you stripped on of the params out in your example.
In general, if one is trying to chain to another command, one uses defaulting (Conditions on elements in PropertyGroups) and validation (Messages Conditional on presence of options) and then either create a new property or embed the params you want to pass into a string.
Here's hoping someone has a nice neat example of a more general way to do this but I doubt it.
As covered in http://www.simple-talk.com/dotnet/.net-tools/extending-msbuild/ one can dump out the parameters passed by doing /v:diag on the commandline (but that's obviously not what you're after).
Have a look in the Common.targets files - you'll find lots of cases of chaininign involving manaully building up lists to pass onto subservient tasks.
In the past I've been able to embed a sripting languate (like JScript) inside the SQLCLR, so scripts can be passed as parameters of functions, to perform certain calculations. Here is a simplistic example (the function ssScriptExecute returns a concatenation of all the print's in the script):
select dbo.ssScriptExecute( 'print("Calculation: "+(1+2/3) );' )
-- Calculation: 1.6666666666666665
I'd love to be able to embed a Powershell runtime in the same way. But I've had all sort of problems because the runtime tries to find assemblies by path, and there are no paths inside the SQlCLR. I'm happy to provide more information on the errors I get, but I was wondering if anybody has tried this!
Thanks!
I use il code injection to modified System.Automation.Management.
make variable version in GetPSVersionTable() be "2.0"
then i can run Powershell Code in SQL Server.
Be sure reference this modified dll in your visual studio project.
http://www.box.net/shared/57122v6erv9ss3aopq7p
btw, automated registering all dll you needed with running powershell in SQL
you can use this ps1 code
http://www.box.net/shared/tdlpu1875clsu8azxq4b
I think the only way to do this is to create a WCF service hosting powershell, and let SQLCLR send the request dbo.ssScriptExecute(...) to that service for execution.
Besides from that, I've also successfully embedded paxScript.net in the SQLCLR (an interpreter that does not have the memory leak problems of the DLR languages).
I thought SQLCLR was restricted to just a certain set of assemblies and PS Automation is not one of them.