2013-01-19 39 views
1

我正在開發Windows 8商店應用程序。我通過選擇解決方案 >>添加 >>新項目 >>單元測試庫(Windows應用商店的應用程序)添加單元測試。然後,我可以很好地運行測試。Windows 8商店應用程序單元測試在VS 2012中失敗

不過,我再引用添加到我原來的Windows 8商店應用項目(following the instructions here),當我嘗試再次運行測試,我得到以下錯誤:

------ Discover test started ------ 
WriteTestCaseStarted 
WriteTestCase Took Time = 3.0004 
========== Discover test finished: 1 found (0:00:00.1350024) ========== 
------ Run test started ------ 
Updating the layout... 

Copying files: Total <1 mb to layout... 

Registering the application to run from layout... 

Deployment complete. Full package name: "c078c431-2a0d-4494-8dd9-47ae01ac938d_1.0.0.0_neutral__chny7cy2kxrnj" 

Exception has been thrown by the target of an invocation. 
========== Run test finished: 0 run (0:00:01.8770198) ========== 

我在做什麼錯誤?

更新:註釋掉從的App.xaml以下行解決了這個問題:

<ResourceDictionary Source="Common/StandardStyles.xaml"/> 

爲什麼?

+0

我在做同樣的事情,一切正常,您的應用程序運行正常嗎? –

+0

是的,該應用程序運行良好。 –

回答

3

多件事情可能導致這種情況。這裏有幾個我發現:在App.xaml中

  • 應用程序代碼中設置的任何屬性(如RequestedTheme)
  • App.xaml中引用它使用自定義的附加屬性ResourceDictionary中。

嘗試評論App.xaml的內容,看看是否有幫助。

+0

你是如何找到這些問題的? –

+0

痛苦,痛苦和時間:) – kiwidev

+0

哎呀。我遵循你的建議,基本上把所有的東西都移出App.xaml,最終讓我的工作。我花了好幾天試圖調試無用的錯誤消息,但我想這也可以。萬歲! –

相關問題