我使用Node.js工具为量角器测试环境创建了一个Node.js项目,以在团队基础服务器上测试Web应用程序。测试项目和Web应用程序位于一个解决方案文件中。但是,如果我想在tfs上部署Node.js项目,则无法找到位于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之后,我找到了PublishProfileRootFolder变量来更改pubxml文件的搜索路径。
首先,我尝试将变量放置在MSBuild参数中。但是,这给其他测试项目带来了问题,并且我无法使用像这样的变量$(SolutionDir)
。
我结束了尝试在项目文件中使用PublishProfileRootFolder变量的操作,现在可以正常工作了:
<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文件,该文件位于测试项目的项目根目录中:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="on"/>
<compilation debug="true"/>
</system.web>
</configuration>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句