2014-03-25 59 views
1

我們的構建在TFS構建服務器上有時會出現相同的錯誤而失敗。TFS間歇性地構建丟失的.targets文件

我對我們的項目之一(錯誤指的WebAPI項目)收到此消息:

中導入的項目「C:\ Program Files文件 (86)\的MSBuild \ 12.0 \ BIN \ Microsoft.CompactFramework.CSharp.targets「找不到 。確認聲明中的路徑爲 正確,並且該文件存在於磁盤上。

而這其中的另一個項目(在智能設備項目):

中導入的項目「C:\ Program Files文件 (86)\的MSBuild \微軟\ VisualStudio的\ V12.0 \ web應用\ Microsoft.WebApplication.targets「 未找到。確認聲明中的路徑爲 正確,並且該文件存在於磁盤上。

通常這意味着該文件不存在,它應該是安裝包含目標文件的工具或從開發人員機器手動複製它們的問題。我之前在這種情況下見過它,並且很容易解決它,因爲這是一個微不足道的問題。

問題是,文件!這些構建似乎是隨機失敗的,這對我來說非常晦澀難懂。如果我們多次選擇「重試構建」,構建將正常進行。有時候構建只是第一次工作,然後開始顯示這個錯誤。至於何時發生,我未能檢測到任何模式。

文件本身沒有什麼特別之處。我認爲他們以某種方式失去了一些權限,但他們具有與其他伴隨文件相同的安全設置。

我不知道甚麼在這裏調查。該消息指出文件丟失,但文件在那裏。它間歇發生的事實甚至更成問題。

這發生在TFS 2013構建機器上。在安裝TFS之後,Visual Studio 2013 Ultimate已安裝在它上面。我們在公司使用TFS2012還有另一個構建虛擬機,我從未見過這種奇怪的行爲。

編輯:

我忘了提到它,但也有一幫上包含Web項目的生成隨機警告。它們僅在出現關於.targets文件的錯誤時纔會出現,並且不會顯示在其他版本上。也許這是一個事實,即一個是.Net4.5(網絡)和其他相關的是.Net3.5cf:

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. 

編輯2:

確定。迪倫的評論後,我去了構建日誌爲「確認」,世界上只有一個運行的版本,讓我吃驚劑:

Successful Build: Run on agent (reserved build agent Build2014 - Agent1) 
Failed Build: Run on agent (reserved build agent TFS2013 - Agent1) 

Build2014是我們構建虛擬機,然後TFS2013是我們的源代碼控制一個。

當TFS2013安裝在TFS2013上時,構建代理與其同時安裝在同一臺機器上。安裝在單獨機器上的控制器也具有同名的代理。這意味着控制器正在挑選其中一個,每當他們碰到TFS機器時,構建失敗(因爲那裏沒有開發環境)。

在TFS機器上刪除錯誤安裝的代理是這裏的一種方式。

回答

3

您確定您的構建始終運行在相同的構建代理/服務器上嗎?是否有可能你有多個構建代理設置,它只適用於某些?

+0

是的。我絕對相信他們在同一個代理商,控制器和機器上運行...... – julealgon

+2

好的...忘了這一點,你是對的。在同一個控制器上有兩個代理,在不同的機器上具有相同的名稱。難以置信的。 – julealgon