【问题标题】:Publish on TFS does not find the pubxml file for Node.js test project在 TFS 上发布未找到 Node.js 测试项目的 pubxml 文件
【发布时间】:2016-08-21 19:45:18
【问题描述】:

我使用 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.

【问题讨论】:

    标签: node.js testing tfs visual-studio-2015


    【解决方案1】:

    分析 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-13
      • 2019-07-13
      • 2021-06-14
      • 2016-02-18
      • 1970-01-01
      • 2017-11-02
      • 1970-01-01
      • 2016-12-28
      相关资源
      最近更新 更多