Build on TFS wants to copy a executable from Node.

2019-07-25 12:11发布

问题:

I created a Node.js project for an protractor test environment using the Node.js Tools to test a web application on a team foundation server. Locally i can create the test project and run it with the debugger. However, the build on the TFS does not work.

Log:

"<PATH>\TestProject.Web.Protractor.Tests.njsproj" (13) on node 2 (default targets).
13>PrepareForBuild:
     Creating directory "obj\Debug\".
   CoreCompile:
     Creating directory "bin".
     Copying file from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Node.js Tools\Microsoft.NodejsTools.WebRole.dll" to "bin\Microsoft.NodejsTools.WebRole.dll".
   _CopyWebApplicationLegacy:
     Copying Web Application Project Files for TestProject.Web.Protractor.Tests
     Creating directory "<PATH>\bin\_PublishedWebsites\TestProject.Web.Protractor.Tests\bin".
13>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets(136,5): error MSB3030: Could not copy the file "obj\Debug\TestProject.Web.Protractor.Tests.exe" because it was not found. 

回答1:

After analyzing the Microsoft.WebApplication.targets i found the switch Disable_CopyWebApplication to disable the copy process.

Inside the project file for me TestProject.Web.Protractor.Tests.njsproj add <Disable_CopyWebApplication>True</Disable_CopyWebApplication> to the property group and it will work fine :)

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    ...
    <Disable_CopyWebApplication>True</Disable_CopyWebApplication>
</PropertyGroup>
...