在TFS上发布没有findNode.jstesting项目的pubxml文件

我使用Node.js工具为一个量angular器testing环境创build了一个Node.js项目来testing团队基础服务器上的一个Web应用程序。 testing项目和Web应用程序在一个解决scheme文件中。 但是,如果我想在tfs上部署Node.js项目,则无法find位于Web应用程序项目中的pubxml文件。

错误日志:

12>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". ValidatePublishProfileSettings: Validating PublishProfile(TestProfile) settings. 12>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4364,5): error : The value for PublishProfile is set to 'TestProfile', expected to find the file at '<PATH>\TestProject.Web.Protractor.Tests\__profiles\TestProfile.pubxml' but it could not be found. [<PATH>\TestProject.Web.Protractor.Tests.njsproj] 12>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4371,4): error : PublishProfile(TestProfile) is set. But the $(WebPublishMethod) does not have a valid value. Current Value is "". [<PATH>\TestProject.Web.Protractor.Tests.njsproj] 12>Done Building Project "<PATH>\TestProject.Web.Protractor.Tests.njsproj" (default targets) -- FAILED. 

分析完Microsoft.Web.Publishing.targets之后,我find了PublishProfileRootFoldervariables来更改pubxml文件的searchpath。

首先我试图把variables放在MSBuild参数中。 但是,这引发了其他testing项目的问题,我无法使用像$(SolutionDir)这样的variables。

我结束了尝试使用项目文件中的PublishProfileRootFoldervariables,现在这个工作:

 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> ... <PublishProfileRootFolder>$(SolutionDir)PathToWebApplication\Properties\PublishProfiles</PublishProfileRootFolder> </PropertyGroup> ... 

PS:另外你需要一个Web.config文件,放在testing项目的项目根目录下:

 <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <customErrors mode="on"/> <compilation debug="true"/> </system.web> </configuration>