繁体   English   中英

Visual Studio 2010中的Project WPF .Net 3.5导致错误

[英]Project WPF .Net 3.5 in visual studio 2010 cause error

创建空白wpf .Net 3.5项目时出现问题。 Visual Studio抛出错误并停止工作。 这是很奇怪的,因为当我在.Net 3.5中创建其他项目(例如Windows窗体)时,它就起作用了(我在其他.Net框架中进行了测试,没有错误)。
这是复制的错误详细信息:

  System.ArgumentException
  Type universe cannot resolve assembly: System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
  at System.Reflection.Adds.TypeNameParser.DetermineAssembly(AssemblyName assemblyName, Module defaultTokenResolver, ITypeUniverse universe)
  at System.Reflection.Adds.TypeNameParser.<>c__DisplayClass2.<ParseTypeName>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 System.Reflection.Adds.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.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
  at Microsoft.MetadataReader.MetadataOnlyAssembly.GetType(String name)
  at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.GetAssemblyType(Reflectable`1 assembly, String typeName)
  at MS.Internal.Metadata.ClrAssembly.GetType(String typeName)
  at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.LoadType(String typeName)
  at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.GetType(String fullName)
  at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.GetType(String fullName)
  at Microsoft.Windows.Design.Metadata.IdentifierExtensionImplementations.GetType(IMetadataContext scope, TypeIdentifier typeId)
  at MS.Internal.Design.Metadata.Xaml.XamlAssembly.get_XmlNamespaceCompatibilityMappings()
  at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.GetXmlNamespaceCompatibilityMappings(IAssemblyMetadata sourceAssembly)
  at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensions.GetXmlNamespaceCompatibilityMappings(IAssemblyMetadata source)
 at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
 at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier)
 at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context)
 at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider)
 at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors)
 at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
 at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
 at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
 at MS.Internal.Host.PersistenceSubsystem.Load()
 at MS.Internal.Host.Designer.Load()
 at MS.Internal.Designer.VSDesigner.Load()
 at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
 at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
 at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
 at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
 at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
 at MS.Internal.Designer.DesignerPane.LoadDesignerView()

图片:

在此处输入图片说明 我也尝试修复,卸载和重新安装Visual Studio,但是它仍然有错误。
有什么帮助吗?
更新 :仅当我打开xaml文件时发生错误。

由于某些原因,在3.5代码中有对system.XAML 4.0的引用。 卸载您的项目,然后对其进行编辑。 找到其中包含system.XAML的行,并删除它。 重新加载项目后,可以手动添加3.5版本。

好的,我已经解决了。 当我尝试更新VS SP1时,出现错误

无法写入安装日志文件。 验证Temp文件夹是否存在并且可以对其进行写入。

然后,我认识到%temp%目录无法访问。 然后,我转到环境变量并更改%temp%路径(我之前从未接触过此变量),并且VS SP1设置运行良好。 此外,此WPF错误是固定的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM