2011-04-19 111 views
5

我试图在詹金斯运行msbuild。 当它到达UNITEST项目错误occures:msbuild - UnitTestFramework参考无法解析

Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (1) is building "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (4) on node 0 (default targets). 
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5". 
ResolveAssemblyReferences: 
    Primary reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 
     Could not find dependent files. Could not load file or assembly 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 
      For SearchPath "{Registry:Software\Microsoft\.NetFramework,v4.0,AssemblyFoldersEx}". 
      Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
      Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist. 
      Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
      Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist. 
      Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
      Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist. 
      Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
      Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist. 
      Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
      Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist. 
      Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist. 
CalculatorServiceTest.cs(1,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) 
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?) 
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (default targets) -- FAILED. 
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (default targets) -- FAILED. 

Build FAILED. 

任何建议,问题可能是什么?从命令运行MS构建工作的解决方案,没有任何额外的参数该项目编译在VS bevor。干净的解决方案后,会出现相同的错误。必须是一些参数或参考问题;第二行会谈v4和v3.5问题;但我无法弄清楚如何解决这个问题。

映入眼帘,从在cmd默认的Windows使用

+0

我无法理解何时发生错误,何时从IDE或从命令行构建?什么是“bevor”以及你试图从哪个命令shell构建?看起来像你有一个3.5命令shell试图用4.0程序集构建。 – 2011-04-20 04:22:22

回答

2

错误信息直接显示您使用的MSBuild

该组件是建立在不正确的版本由运行时比当前加载的运行库更新,无法加载。

尝试重建用的MSBuild 4.0

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe *.sln /t:rebuild 

或/与从VS2010命令行。

0

林建设:

C:\ MSBuild.exe *的.sln

的解决方案,项目全部3.5;只有单元测试项目是4.0(因为你不能改变这一点)

我刚才提到,建立它的方式工作,当我用VS创建它,并且不删除(干净的解决方案)二进制文件。没关系。

如何从cmd使用msbuild构建包含unittests的* .sln?

2

我有一个类似的问题,这似乎是由在系统帐户下运行Jenkins作为服务引起的。不知何故,cmd.exe并没有引用所有必要的环境变量来找到我的NUnit程序集。

如果您将Jenkins作为服务运行,请尝试将其设置为以您的用户帐户运行并查看是否有帮助。

+0

您可以通过下载PSTools(http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx)并运行PsTools/PsExec.exe -i -s cmd.exe来检查此问题,它允许您运行命令提示为本地系统用户。这样就可以让你模仿jenkins并运行命令行工具,就好像你是那个用户一样。 (通过http://computercamp.cdwilson.us/jenkins-git-clone-via-ssh-on-windows-7-x64发现) – Jane 2012-09-25 14:51:56

相关问题