【问题标题】:MVVM Light Toolkit throws an System.IO.FileLoadExceptionMVVM Light Toolkit 引发 System.IO.FileLoadException
【发布时间】:2010-04-26 14:53:36
【问题描述】:

我正在运行 VS 2010 和 Expression Blend 4 beta。我从提供的模板创建了一个 MVVM Light 项目,当我尝试在 VS 2010 设计器窗口中查看 MainWindow.Xaml 时,我得到一个 System.IO.FileLoadException。该模板已引用 System.Windows.Interactivity。以下是异常的详细信息:

System.IO.FileLoadException
Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly)
   at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly)
   at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly)
   at MS.Internal.Metadata.ClrAssembly.GetRuntimeMetadata(Object reflectionMetadata)
   at Microsoft.Windows.Design.Metadata.AttributeTableContainer.<MergeAttributesIterator>d__c.MoveNext()
   at Microsoft.Windows.Design.Metadata.AttributeTableContainer.GetAttributes(Assembly assembly, Type attributeType, Func`2 reflectionMapper)
   at MS.Internal.Metadata.ClrAssembly.GetAttributes(ITypeMetadata attributeType)
   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()

System.NotSupportedException 尝试从网络位置加载程序集,这会导致程序集在以前版本的 .NET Framework 中被沙盒化。此版本的 .NET Framework 默认情况下不启用 CAS 策略,因此这种加载可能很危险。如果此加载不打算对程序集进行沙箱处理,请启用 loadFromRemoteSources 开关。请参阅http://go.microsoft.com/fwlink/?LinkId=155569 了解更多信息。

【问题讨论】:

    标签: .net mvvm-light


    【解决方案1】:

    是的,问题是在安装之前需要解封 zip 文件。

    http://www.galasoft.ch/mvvm/installing/manually/#unblock

    解封 zip 文件后,您可以安装在现有 DLL 之上,它们将被正确的版本覆盖。

    您好, 洛朗

    【讨论】:

      【解决方案2】:

      如果它仍然不起作用并且你已经完成了@LBugnion 告诉你要做的事情。然后它是propaly,因为您从网络位置运行项目。尝试将项目复制到一个 loval 驱动器(可能是您的桌面)。现在它应该工作了:D

      【讨论】:

        猜你喜欢
        • 2011-06-19
        • 2011-06-03
        • 2011-02-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多