title: Web Deploy Publish asp.net webapp with nuget dependencies on TFS
body: <p>I am trying to publish a vs2013 asp.net webapp (the only project in the solution) on TFS 2012. On any developer box, it downloads, explodes and resolves nuget packages (using nuget 2.8.1,) and runs Web Deploy Publish just fine.</p>
  
  <p>However I am unable to replicate that on the TFS box. MSBuild is not finding nuget packages nor is it running Web Deploy Publish. </p>
  
  <p><strong>1. Nuget</strong></p>
  
  <p>Invoked from csproj</p>
  
  <pre><code>  &lt;PropertyGroup&gt;
      &lt;PreBuildEvent&gt;$(SolutionDir)..\..\..\tools\nuget\nuget.exe restore&lt;/PreBuildEvent&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>as recommended in <a href="http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html" rel="nofollow">here</a>. There is no .nuget solution-level directory, nuget.exe and nuget.config live up the tfs folder hierarchy. That works fine on a dev box. Why is it not working on the build server?</p>
  
  <p><strong>2. Web Deploy Publish</strong></p>
  
  <p>msbuild log excerpt:</p>
  
  <pre><code>Run MSBuild for Project
  Initial Property Values
  ...
  CommandLineArguments = /p:SkipInvalidConfigurations=true /p:DeployOnBuild=True /p:PublishProfile=dev01 /p:AllowUntrustedCertificate=True /p:UserName=myDomainUsername /p:Password=myPassword
  ....
  DeployOnBuild = False
  ....
  </code></pre>
  
  <p>Note how DeployOnBuild = False, shouldn't it be overriden by the parameter?</p>
  
  <p>Configuration:</p>
  
  <p><strong>Developer box</strong></p>
  
  <p>Visual studio 2013 update 2, webdeploy 3.6 (latest), Web Deploy Publish is based on .pubxml publish profiles.</p>
  
  <p>vs project file excerpt in case it's relevant:</p>
  
  <pre><code>  &lt;Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /&gt;
    &lt;Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /&gt;
    &lt;PropertyGroup&gt;
      &lt;VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''"&gt;11.0&lt;/VisualStudioVersion&gt;
      &lt;VSToolsPath Condition="'$(VSToolsPath)' == ''"&gt;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)&lt;/VSToolsPath&gt;
    &lt;/PropertyGroup&gt;
    &lt;Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /&gt;
    &lt;PropertyGroup&gt;
      &lt;PreBuildEvent&gt;$(SolutionDir)..\..\..\tools\nuget\nuget.exe restore&lt;/PreBuildEvent&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p><strong>Build definition</strong></p>
  
  <p>The build definition is for the solution (.sln) not the project (.csproj), with parameters as follows: </p>
  
  <pre><code>/p:DeployOnBuild=True /p:PublishProfile=dev01 /p:AllowUntrustedCertificate=True /p:UserName=myDomainUser /p:Password=myPassword
  </code></pre>
  
  <p><strong>TFS 2012 box</strong></p>
  
  <p>WebDeploy 3.6 (latest) installed.</p>
  
  <p>There is probably a combination of configuration and concept errors in my approach, would appreciate any input really!</p>