我们的构建在TFS构建服务器上失败,并且有时会出现相同的错误。
我在其中一个项目上收到此消息(错误是指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在公司中建立了另一个构建VM,我从未见过如此奇怪的行为。
编辑:
我忘了提及它,但是在包含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:
确定。在Dylan的评论之后,我去了构建日志,以确认"只有一个代理运行构建,令我惊讶的是:
Successful Build: Run on agent (reserved build agent Build2014 - Agent1)
Failed Build: Run on agent (reserved build agent TFS2013 - Agent1)
Build2014是我们的构建VM,而TFS2013是我们的源代码控制器。
在TFS2013上安装TFS 2013时,会在同一台计算机上安装构建代理程序。安装在单独计算机上的控制器也具有同名的代理程序。这意味着控制器正在选择其中一个,每当它们到达TFS机器时,构建失败(因为那里没有故意的环境)。
在TFS机器上删除错误安装的代理是这里的方法。
答案 0 :(得分:3)
您确定您的构建始终在同一构建代理/服务器上运行吗?您是否可以设置多个构建代理并且它仅适用于某些构建代理?