title: setting environment for powershell build in jenkins
body: <p>I've recently upgraded the build server and our builds are now breaking because nuget is getting the wrong version of msbuild (using auto detect).
  I think that this may be the case because the build step in Jenkins invokes a powershell script that invokes a cake script.
  I can override the path in cake script to force nuget to select the correct version of msbuild and it works.</p>
  
  <p>BUT</p>
  
  <p>Really I suspect the underlying problem is that the environment for the powershell can't see all the standard visual studio tools. It really needs to be running in the equivalent of the "developer command prompt".</p>
  
  <p>but I can't see a simple way to achieve this.</p>
  
  <p>I could launch the powershell from a command line, but its not clear how to encode all the parameters.</p>
  
  <p>e.g. the powershell invocation is</p>
  
  <pre><code>.\build.ps1 -ScriptArgs "--schemaMajorVersion=${ENV:SCHEMA_MAJOR_VERSION}","--schemaMinorVersion=${ENV:SCHEMA_MINOR_VERSION}","--buildNumber=${ENV:BUILD_NUMBER}","--isLocalBuild=""false""","--nugetArtifactDir=${ENV:NUGET_SOURCE}","--jobName=${ENV:JOB_BASE_NAME}","--buildType=${ENV:BUILD_TYPE}","--deployFolderDir=$ENV:DEPLOYMENT_FOLDER","--wonReportsSchemaVersion=$ENV:wonReportsSchemaVersion","--wOnReportsSchemaExtensionsVersion=$ENV:wOnReportsSchemaExtensionsVersion","--wonVersion=$ENV:wonVersion"
  </code></pre>
  
  <p>For the moment I've ammended the Path environment variable under the jenkins global settings, that works, but, feels wrong...it makes the assumption that all my jobs require the same tooling and environment.</p>