2012-11-02 94 views
1

我似乎無法運行任何單元測試。所有的錯誤是沿着以下幾條線:Visual Studio 2012單元測試嘗試加載較舊版本的程序集

Test method TvQueue.UnitTesting.TheTvDb.TheTvDbServiceTest.GetShowbasicTest threw exception: 
System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.=== Pre-bind state information === 
LOG: User = JKRTABLET\Jan 
LOG: DisplayName = System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e 
(Fully-specified) 
LOG: Appbase = file:///C:/Users/Jan/Documents/Visual Studio 2012/Projects/TvQueue/TvQueue.UnitTesting/bin/Debug 
LOG: Initial PrivatePath = NULL 
Calling assembly : TvQueue.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.ReSharper.TaskRunner.CLR4.exe.Config 
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e 
LOG: Attempting download of new URL file:///C:/Users/Jan/Documents/Visual Studio 2012/Projects/TvQueue/TvQueue.UnitTesting/bin/Debug/System.Windows.DLL. 
LOG: Attempting download of new URL file:///C:/Users/Jan/Documents/Visual Studio 2012/Projects/TvQueue/TvQueue.UnitTesting/bin/Debug/System.Windows/System.Windows.DLL. 
LOG: Attempting download of new URL file:///C:/Users/Jan/Documents/Visual Studio 2012/Projects/TvQueue/TvQueue.UnitTesting/bin/Debug/System.Windows.EXE. 
LOG: Attempting download of new URL file:///C:/Users/Jan/Documents/Visual Studio 2012/Projects/TvQueue/TvQueue.UnitTesting/bin/Debug/System.Windows/System.Windows.EXE. 

    at TvQueue.Data.TheTvDb.TheTvDbService.<GetShow>d__8.MoveNext() 
    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine) 
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start(ref TStateMachine stateMachine) 
    at TvQueue.Data.TheTvDb.TheTvDbService.GetShow(Int64 theTvDbId) 
    at TvQueue.UnitTesting.TheTvDb.TheTvDbServiceTest.<GetShowbasicTest>d__0.MoveNext() in TheTvDbServiceTest.cs: line 19 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.GetResult() 

我開發Windows Phone 8代碼時出現此問題。出於某種原因,MSTest希望加載較舊版本的程序集(實際在項目中引用的程序集爲4.x或更高版本,MSTest希望加載2.x版本)。

我懷疑這是一個配置問題,但我不知道如何解決它。

感謝您的幫助。

回答

2

請參閱How to use MSTest in VS2010 for Windows Phone 8 applications

項目實際引用的程序集我的回答是4.x或更高

System.Windows, Version=2.0.6.0不是舊版本,這是正確的新版本。而且你實際上看不到單個裝配體的版本號,是否沒有單獨裝配體這樣的東西。

請記住,主要變化是Windows Phone 8與Windows RT不再使用直接程序集,而是將多個程序集編譯爲單個API的WinMD文件。

相關問題