2016-08-21 50 views
2

我使用Node.js工具爲團隊基礎服務器上的Web應用程序測試了量角器測試環境,爲此創建了一個Node.js項目。測試項目和Web應用程序在一個解決方案文件中。但是,如果我想在tfs上部署Node.js項目,則無法找到位於Web應用程序項目中的pubxml文件。在TFS上發佈沒有找到Node.js測試項目的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. 

回答

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>