2011-04-19 24 views
5

Estoy intentando ejecutar msbuild en Jenkins. cuando llega a la UniTest-Proyecto de un error occures:msbuild - La referencia UnitTestFramework no se pudo resolver

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. 

Cualquier sugerencia lo que podría ser el problema? Ejecutar ms build desde el comando funciona para la solución y sin ningún parámetro adicional cuando el proyecto se compiló en VS bevor. Después de una solución limpia, ocurren los mismos errores. Debe ser algún parámetro o problema de referencia; La línea dos habla sobre los problemas v4 y v3.5; pero no puedo entender cómo resolver esto.

Saluda

+0

No puedo entender cuándo ocurre el error, cuando se construye desde el IDE, o desde una línea de comando? ¿Qué es "bevor" y de qué shell de comandos estás tratando de construir? Parece que tienes un shell de comandos 3.5 tratando de construir con ensambles 4.0. –

Respuesta

2

información de error muestra directamente que utiliza la versión incorrecta de MSBuild

Este conjunto está construido por un tiempo de ejecución más reciente que el tiempo de ejecución actualmente cargado y no se puede cargar.

tratar de reconstruir con MSBuild 4,0

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

O/Y desde VS2010 línea de comandos.

0

edificio Im desde las ventanas por defecto cmd usando:

C: ... \ MSBuild.exe * .sln

la solución de los proyectos son todos 3.5; solo el Unit-Test Project es 4.0 (ya que no puedes cambiar esto)

Acabo de mencionar, que construirlo de esa manera funciona, cuando lo construyo primero con VS y no borro (solución limpia) los binarios . No importa.

¿Cómo debo usar msbuild de cmd para compilar un * .sln que incluya unittest?

2

Tuve un problema similar que parecía ser causado al ejecutar Jenkins como un servicio bajo la cuenta SYSTEM. De alguna manera, cmd.exe no hacía referencia a todas las variables de entorno necesarias para poder encontrar mis ensamblajes NUnit.

Si está ejecutando Jenkins como un servicio, intente configurarlo para que se ejecute como su cuenta de usuario y vea si eso ayuda.

+0

Puede comprobar esto descargando PSTools (http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx) y ejecutando PsTools/PsExec.exe -i -s cmd.exe que le permite ejecutar un comando solicitar como el usuario del sistema local. Esto le permite imitar a jenkins y ejecutar herramientas de línea de comandos como si fuera ese usuario. (Descubierto a través de http://computercamp.cdwilson.us/jenkins-git-clone-via-ssh-on-windows-7-x64) – Jane

Cuestiones relacionadas