2011-04-19 19 views
5

मैं जेनकींस में एमएसबिल्ड चलाने की कोशिश कर रहा हूं। जब यह 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. 
कोई सुझाव

क्या समस्या हो सकती है? समाधान के लिए कमांड काम करता है और समाधान के लिए काम करता है जब प्रोजेक्ट को वीएस बीवर में संकलित किया गया था। एक साफ समाधान के बाद एक ही त्रुटि होती है। कुछ पैरामीटर या संदर्भ समस्या होना चाहिए; लाइन दो वार्ता vout v4 और v3.5 समस्याएं; लेकिन मैं यह समझ नहीं सकता कि इसे कैसे हल किया जाए।

स्वागत करती है

+0

मुझे समझ में नहीं आता है कि त्रुटि कब होती है, आईडीई से निर्माण करते समय, या कमांड लाइन से? "बीवर" क्या है और आप किस कमांड शैल से निर्माण करने की कोशिश कर रहे हैं? ऐसा लगता है कि आपके पास 4.0 असेंबली के साथ निर्माण करने की कोशिश कर रहे 3.5 कमांड शैल हैं। –

उत्तर

2

त्रुटि की जानकारी सीधे से पता चलता है कि आप एक क्रम वर्तमान में लोड क्रम से नए द्वारा MSBuild

इस विधानसभा बनाया गया है की गलत संस्करण का उपयोग और लोड नहीं किया जा सकता है।

कोशिश MSBuild 4,0

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

या/तथा VS2010 कमांड लाइन से साथ के पुनर्निर्माण के लिए।

0

इम डिफ़ॉल्ट खिड़कियों cmd ​​से इमारत का उपयोग कर:

सी: ... \ MSBuild.exe * .sln

समाधान परियोजनाओं सब कर रहे हैं 3.5; केवल यूनिट-टेस्ट प्रोजेक्ट 4.0 है (जैसा कि आप इसे नहीं बदल सकते हैं)

मैंने अभी उल्लेख किया है कि यह जिस तरह से काम करता है, जब मैं इसे पहले वीएस के साथ बना देता हूं और बाइनरी को हटा नहीं देता (साफ समाधान) । कोई बात नहीं।

मुझे cmd से msbuild का उपयोग कैसे करना चाहिए * unsests सहित * .sln बनाने के लिए?

2

मुझे ऐसी ही समस्या थी जो सिस्टम खाते के तहत जेनकींस को सेवा के रूप में चलाने के कारण हुई थी। किसी भी तरह cmd.exe मेरे एनयूनिट असेंबली को खोजने में सक्षम होने के लिए सभी आवश्यक पर्यावरण चर का संदर्भ नहीं दे रहा था।

यदि आप जेनकींस को सेवा के रूप में चला रहे हैं, तो इसे अपने उपयोगकर्ता खाते के रूप में चलाने के लिए सेट करने का प्रयास करें और देखें कि इससे मदद मिलती है या नहीं।

+0

आप इसे PSTools (http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx) डाउनलोड करके और PsTools/PsExec.exe -i -s cmd.exe चलाकर देख सकते हैं जो आपको कमांड चलाने की अनुमति देता है स्थानीय सिस्टम उपयोगकर्ता के रूप में तत्काल। यह आपको जेनकींस की नकल करने और कमांड लाइन टूल्स चलाने की इजाजत देता है जैसे कि आप उस उपयोगकर्ता थे। (Http://computercamp.cdwilson.us/jenkins-git-clone-via-ssh-on-windows-7-x64 के माध्यम से खोजा गया) – Jane

संबंधित मुद्दे