Visual Studio 2015:类型Universe无法解析程序集:System.Runtime,Version = 0.0.0.0 [英] Visual Studio 2015: Type universe cannot resolve assembly: System.Runtime, Version=0.0.0.0

查看:113
本文介绍了Visual Studio 2015:类型Universe无法解析程序集:System.Runtime,Version = 0.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试设计UWP表单时,Visual Studio遇到了问题.设计器没有加载,我得到的只是这个错误:

I am encountering a problem with Visual Studio when trying to design UWP Forms. The designer doesn't load, all I'm getting is this error:

Microsoft.MetadataReader.UnresolvedAssemblyException
Type universe cannot resolve assembly: System.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
   at Microsoft.MetadataReader.SimpleUniverse.Microsoft.MetadataReader.ITypeUniverse.ResolveAssembly(AssemblyName name)
   at Microsoft.MetadataReader.TypeNameParser.DetermineAssembly(AssemblyName assemblyName, Module defaultTokenResolver, ITypeUniverse universe)
   at Microsoft.MetadataReader.TypeNameParser.c__DisplayClass1_0.b__0(AssemblyName assemblyName)
   at System.TypeNameParser.ResolveAssembly(String asmName, Func`2 assemblyResolver, Boolean throwOnError, StackCrawlMark& stackMark)
   at System.TypeNameParser.ConstructType(Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError)
   at Microsoft.MetadataReader.TypeNameParser.ParseTypeName(ITypeUniverse universe, Module module, String input, Boolean throwOnError)
   at Microsoft.MetadataReader.UnresolvedTypeName.ConvertToType(ITypeUniverse universe, Module moduleContext)
   at Microsoft.MetadataReader.MetadataExtensionsPolicy20.TryTypeForwardResolution(MetadataOnlyAssembly assembly, String fullname, Boolean ignoreCase)
   at Microsoft.MetadataReader.MetadataOnlyAssembly.b__30_1(Assembly assembly, String simpleTypeName, Boolean ignoreCaseInCallback)
   at System.TypeNameParser.ResolveType(Assembly assembly, String[] names, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.TypeNameParser.ConstructType(Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.MetadataReader.MetadataOnlyAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at Microsoft.MetadataReader.MetadataOnlyAssembly.GetType(String name)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.GetReferenceType(Type runtimeType)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.TryGetReferenceType(Type runtimeType, Type& referenceType)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.InternalGetType(Type type, ExternalType externalType, IType& returnValue)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.GetType(Type type)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.GetPlatformType(String typeName, ITypeId typeId)
   at Microsoft.VisualStudio.DesignTools.Platform.Metadata.PlatformMetadataBase.ResolveType(ITypeId typeId)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.CreateExternalType(IPlatformTypes sourcePlatformTypes, IAssembly runtimeAssembly, IAssembly referenceAssembly, Type keyType, Type replaceType, ITypeId baseType, ITypeId neutralType, IXmlNamespace xmlNamespace, String clrNamespace, AttributeCollection attributes, ProxyPropertyDescription[] properties)
   at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Metadata.WindowsUIXamlPlatformMetadata.Initialize()
   at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.Initialize()
   at Microsoft.VisualStudio.DesignTools.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver)
   at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
   at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem)
   at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.c__DisplayClass12_0.b__0(CancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.c__DisplayClass6_0`1.b__0()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.Reflection.TargetInvocationException
Type universe cannot resolve assembly: System.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

Server stack trace: 
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func, ApartmentState apartmentState)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IRemoteDesignerService ds, IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.c__DisplayClass14_0.b__0(IRemoteDesignerService ds, RemoteCancellationToken remoteToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.c__DisplayClass5_0`1.b__0(IRemoteDesignerService ds)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.c__DisplayClass28_0`1.b__0()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.Reflection.TargetInvocationException
Type universe cannot resolve assembly: System.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action`1 action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.MarshalOutWithCancellation[TResult](CancellationToken cancelToken, Func`3 func, ApartmentState apartmentState)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)

我尝试重建,但没有成功. 当我打开MainPage.xaml时,对于空白应用程序会发生这种情况. 令我困扰的一件事是该错误报告中System.Runtime的假定版本为0.0.0.0,这可能是解决此问题的一个好提示吗?

I tried rebuilding, of course, with no success. It happens for blank apps, when I open MainPage.xaml. One thing that bothers me is that the supposed version of System.Runtime in this error report is 0.0.0.0, could that be a good hint for solving this?

推荐答案

我能够通过检查在Visual Studio构建过程中自动检查丢失的软件包"来解决类似的错误(允许NuGet下载丢失的软件包"为已经检查过),然后进行重建.您可以在工具-> NuGet程序包管理器->程序包管理器设置中找到这些设置.

I was able to resolve a similar error by checking "Automatically check for missing packages during build in Visual Studio" (the "Allow NuGet to download missing packages" was already checked), then rebuilding. You can find these settings in Tools --> NuGet Package Manager --> Package Manager Settings.

这篇关于Visual Studio 2015:类型Universe无法解析程序集:System.Runtime,Version = 0.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆