title: How to use VSTest results and other .NET plugins in Jenkins Pipeline (old workflow)?
body: <p>Due to some company changes, we're forced to switch to Jenkins as CI tool. And while this doesn't seem like a bad idea after all, we're having a lot of headaches due to lack of support for non-Java application, especially for the Pipeline (old Workflow) plugin and of course our lack of Jenkins knowledge (which is kind of none at this point).</p>
  
  <pre><code>node('master') 
  {
      try 
      {
          stage('Checkout, restore, build') 
          {
              //Checkout the code from the repository
              git branch: '&lt;branch_name&gt;', credentialsId: '&lt;credentials_ID&gt;', url: '&lt;repo_URL&gt;'    
  
              //git clean
              bat returnStatus: true, script: 'git clean -fdx'
  
              //Perform dotnet restore and nuget restore
              bat returnStatus: true, script: '''for /f "tokens=*" %%a in (\'dir project.json /b /s\') do dotnet restore "%%a"
              "C:\\Users\\Administrator\\.jenkins\\workspace\\nuget.exe" restore "C:\\Users\\Administrator\\.jenkins\\workspace\\CI\\&lt;solution_name&gt;.sln"'''
  
              //Build the solution
              bat returnStatus: true, script: '"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\msbuild.exe" /p:DebugType=full /p:platform=x64 /p:configuration=release /p:VisualStudioVersion=14.0 '
          }
      } catch(err)
      {
          currentBuild.result = 'FAILURE'
      }
  
      jobDsl("${env.JOB_NAME}") {
          steps {
              bat returnStatus: true, script: '"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe" "C:\\Users\\Administrator\\.jenkins\\workspace\\CI\\&lt;path_to_tests_dll&gt;"  /TestCaseFilter:"TestCategory=UnitTest|TestCategory=ContinuousTest" /EnableCodeCoverage /Platform:x64 /logger:trx'
          }
          publishers {
              archiveXUnit {
                  msTest {
                      pattern('"C:\\Users\\Administrator\\.jenkins\\workspace\\CI\\TestResults"')
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But I'm getting errors for the <code>jobDsl</code>:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Expected named arguments but got
    [CI, org.jenkinsci.plugins.workflow.cps.CpsClosure2@1a706730]     at
    org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:442)    at
    org.jenkinsci.plugins.workflow.cps.DSL.invokeDescribable(DSL.java:251)
      at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:129)
      at
    org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
      at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)   at
    org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      at
    org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
      at
    org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
      at
    org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
      at
    org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:103)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      at
    org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      at
    com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      at WorkflowScript.run(WorkflowScript:1)     at
    <strong><em>cps.transform</em></strong>(Native Method)    at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
      at
    com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      at
    com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      at sun.reflect.GeneratedMethodAccessor295.invoke(Unknown Source)    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   at
    java.lang.reflect.Method.invoke(Unknown Source)   at
    com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      at
    com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
      at com.cloudbees.groovy.cps.Next.step(Next.java:74)     at
    com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)   at
    org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      at
    org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
      at
    org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
      at
    org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
      at
    org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      at
    org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
      at
    org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
      at
    org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
      at
    org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
      at
    org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
      at
    org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
      at java.util.concurrent.FutureTask.run(Unknown Source)  at
    hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      at
    jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
    Source)   at java.util.concurrent.FutureTask.run(Unknown Source)  at
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)    at
    java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>This really makes me think that it's not the good approach, so can someone shed a bit of light and guide me on the right path?</p>