我有一個很大的wp7項目,它在wp7上運行良好。在過去的幾個星期裏,我使用wp8設備進行調試(項目仍然是wp7)並且很好。現在在wp7上運行項目時出現TargetInvocationException
,我開始測試其WP7設備上,並且它拋出我在該行
System.Windows.Application.LoadComponent(this, new System.Uri("/MyApp;component/App.xaml", System.UriKind.Relative));
此異常
System.Reflection.TargetInvocationException occurred
Message=TargetInvocationException
StackTrace:
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at MS.Internal.TypeProxy.<>c__DisplayClass30.<GetCreateObjectDelegate>b__2a()
at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
at MS.Internal.XamlManagedRuntimeRPInvokes.CreateInstance(XamlTypeToken inXamlType, XamlQualifiedObject& newObject)
at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr)
at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MyApp.App.InitializeComponent()
at MyApp.App..ctor()
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at MS.Internal.TypeProxy.<>c__DisplayClass30.<GetCreateObjectDelegate>b__2a()
at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
at MS.Internal.FrameworkCallbacks.CreateKnownObject(IntPtr nativeRootPeer, UInt32 customTypeId, String initializationString, IntPtr& nativePeer, UInt32 isCreatedByParser)
at MS.Internal.FrameworkCallbacks.CreateUnknownObject(String assemblyName, String typeName, IntPtr nativeRootPeer, String initializationString, UInt32& customTypeId, UInt32& coreTypeId, UInt32& typeFlags, IntPtr& nativePeer)
InnerException: System.MissingMethodException
Message=Could not load type 'System.Func`2' from assembly 'mscorlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
我改變噸的東西,所以我不知道在哪裏看。
有什麼建議可以是一個原因? System.Func'2
是什麼?
編輯:只是爲了澄清一遍:項目總是針對wp7。目前它正爲:
EDIT2:輸出爲:
'TaskHost.exe' (Managed): Loaded 'System.Device.dll'
'TaskHost.exe' (Managed): Loaded 'Cimbalino.Phone.Toolkit.Background.dll'
'TaskHost.exe' (Managed): Loaded 'Cimbalino.Phone.Toolkit.dll'
'TaskHost.exe' (Managed): Loaded 'GalaSoft.MvvmLight.Extras.WP71.dll'
'TaskHost.exe' (Managed): Loaded 'System.Runtime.Serialization.dll'
也許它可以幫助? wp7上的Serialization.dll有什麼問題嗎?
EDIT3:我的系統配置:Windows 8.1中臨,臨MSVS 2012更新4
不能進行有針對性的對WP7 WP8的應用程序。您或者必須有兩個單獨的項目以WP7和WP8爲目標,或者讓該項目以WP7爲目標,所以兩個OS都可以運行該應用程序。 –
這是wp7應用程序。剛剛編輯的問題,以澄清這一點。 –
因此,您將其定位到WP8並將其更改回WP7? –