2010-07-12 76 views
0

當我選擇新的WPF項目時,出現以下錯誤。選擇新的WPF項目時發生WPF設計器錯誤

Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) 
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) 
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) 
    at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) 
    at System.Activator.CreateInstance(String assemblyName, String typeName) 
    at System.AppDomain.CreateInstance(String assemblyName, String typeName) 
    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) 
    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) 
    at MS.Internal.Package.VSIsolationProviderService.CreateIsolationProvider(String identity, AssemblyReferenceProvider assemblyReferences, IEnumerable`1 assemblyFolders) 
    at MS.Internal.Providers.VSDesignerContext.GetIsolationProvider(IServiceProvider provider, IVsHierarchy hierarchy, AssemblyReferenceProvider assemblyReferences) 
    at MS.Internal.Providers.VSDesignerContext.Initialize(IServiceProvider provider, IVsHierarchy hierarchy, UInt32 itemid, Object docDataObj) 
    at MS.Internal.Providers.VSDesignerContext..ctor(IServiceProvider provider, IVsWindowFrame frame, Object docDataObj) 
    at MS.Internal.Providers.VSDesignerContext.GetContext(IServiceProvider services, IVsWindowFrame frame, Boolean createIfNotExist) 
    at MS.Internal.Designer.DesignerPane.InitializeDesigner() 

回答

0

(從http://www.designasp.net/blog/en/post/2009/03/29/XAML-designer-Loading-this-assembly-would-produce-a-different-grant-set-from-other-instances-%28Exception-from-HRESULT-0x80131401%29.aspx

如果你打開WPF編輯器時收到此錯誤,請嘗試:

  1. 打開Visual Studio的第二個實例,並嘗試打開XAML。
  2. 關閉所有.xaml和.xml文件,關閉Visual Studio,重新打開並打開.xaml文件。
  3. 在工具 - >加載項管理器中禁用所有加載項
  4. 在Visual Studio中「重置所有設置」。
  5. 安裝CLR補丁(KB963676),它應該有助於修復XAML設計器。有一個來自微軟的已知反饋,聲稱這應該有所幫助。從這裏下載(https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0)。 * .msu是用於Windows Vista或Windows Server 2008的修補程序。用於Windows XP或Windows Server 2003的* .exe即使您使用的是64位計算機,由於Visual Studio 2008是32位的,因此仍然需要x86修補程序應用。
  6. 卸載所有Silverlight工具,運行時,SDK,Expression Blend。之後,修復Visual Studio。
  7. 重新安裝Visual Studio和.NET Framework。

如果沒有工作,您將不得不重新安裝操作系統。