2017-10-19 284 views
0

我正在嘗試在包含XUnit測試步驟的.NET核心的tfs上設置構建定義。一切正常,直到我的測試通過,然後出於某種原因,構建失敗後立即。成功測試運行後TFS構建失敗

Total tests: 2. Passed: 2. Failed: 0. Skipped: 0. 
Test Run Successful. 
Test execution time: 3.3499 Seconds 
Error: d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return code: 1 
Dotnet command failed with non-zero exit code on the following projects : 

就是這樣,沒有其他細節。我很困惑從哪裏開始,測試步驟目前是構建定義中的最後一步。

編輯

這是通過設置調試獲得詳細輸出=真正

2017-10-19T09:50:00.4882598Z ##[debug]rc:1 
2017-10-19T09:50:00.4902607Z ##[debug]success:false 
2017-10-19T09:50:00.5002614Z ##[error]Error: 
d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return code: 1 
2017-10-19T09:50:00.5002614Z ##[debug]Processed: ##vso[task.issue 
type=error;]Error: d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return 
code: 1 
2017-10-19T09:50:00.5022599Z ##[debug]task result: Failed 
2017-10-19T09:50:00.5032599Z ##[error]Dotnet command failed with non-zero 
exit code on the following projects : 
2017-10-19T09:50:00.5032599Z ##[debug]Processed: ##vso[task.issue 
type=error;]Dotnet command failed with non-zero exit code on the following 
projects : 
2017-10-19T09:50:00.5042604Z ##[debug]Processed: ##vso[task.complete 
result=Failed;]Dotnet command failed with non-zero exit code on the 
following projects : 
+0

能否請你設置'調試=真',然後拿到這裏分享日誌排除故障? –

+0

我這樣做了,但不幸的是,詳細的輸出是無用的,我會在這裏爲你更新它。 – nagrom97

回答

0

所以我通過修改測試項目的csproj文件並添加一個命令行工具的參考,像這樣

<ItemGroup> 
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" /> 
<PackageReference Include="Moq" Version="4.7.142" /> 
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" /> 
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" /> 
<PackageReference Include="xunit" Version="2.3.0" /> 
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta2-build3683" /> <-- This bit here!!! 
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" /> 
</ItemGroup> 

在構建過程中解決了該問題在TFS上,我刪除了Dotnet測試步驟,並在它的位置添加了一個命令行步驟,並按照以下步驟進行配置。現在一切正常,構建成功。

Command line step

Step detail

0

嘗試以下波紋管項目:

  • 打開項目文件(例如:*.csproj)註釋掉以下片段:

    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="X.X.XXX" />

  • 使用ASP.NET Core (.NET Framework) 模板創建新的構建定義。

還引用了這個線程:VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

+0

謝謝,但該代碼段不在我解決方案中的任何文件中 – nagrom97

相關問題