C# XAML设计器System.TypeLoadException
我几乎要发疯了,因为从XAML设计师那里得到消息,不知道该怎么办 正如你在网上看到的C# XAML设计器System.TypeLoadException,c#,wpf,xaml,C#,Wpf,Xaml,我几乎要发疯了,因为从XAML设计师那里得到消息,不知道该怎么办 正如你在网上看到的 Could not load type 'Mocks.Libraries_Collection_Classes_Storages_0_229157595 在Libraries.Collection命名空间中有一个名为Storages的类。从当前项目中删除引用库.Collection时,如下所示: 然后xaml设计器开始工作 当我添加库时。再次添加集合库: 然后打开XAML设计器,错误再次出现: 类st
Could not load type 'Mocks.Libraries_Collection_Classes_Storages_0_229157595
在Libraries.Collection命名空间中有一个名为Storages的类。从当前项目中删除引用库.Collection时,如下所示:
然后xaml设计器开始工作
当我添加库时。再次添加集合库:
然后打开XAML设计器,错误再次出现:
类storages类看起来像:
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Libraries.Collection.Classes
{
public class Storages : ObservableCollection<Storage>
{
public Storages()
{
}
public Storages(IEnumerable<Storage> coll) : base(coll)
{
}
}
}
问题在于xaml设计器。下一步我该怎么做?仔细阅读您的问题后,我编辑了此答案
在较旧的VS版本中,我曾经遇到过类似的异常,但不同的是它是在运行时出现的。在我的例子中,最终的结果是GAC中已经有了一个版本的程序集。为了确定我使用的原因,这可能是你现在最好的改变,看看你的盒子里发生了什么。仔细阅读你的问题后,我编辑了这个答案
在较旧的VS版本中,我曾经遇到过类似的异常,但不同的是它是在运行时出现的。在我的例子中,最终的结果是GAC中已经有了一个版本的程序集。为了确定我使用的原因,这可能是您现在最好的改变,让您看看您的箱子里发生了什么。首先,感谢您的建议。我确实记录了日志,请查看上面的内容,您是否可以告诉我出了什么问题。首先,请确保将程序集中的dll复制到输出路径,特别是验证引用的“复制本地”属性是否设置为true。还要确保它是在一个比您的项目兼容的平台上编译的(32位、64位或任何CPU)。我确实记录了日志,请查看上面的内容,您是否可以告诉我出了什么问题。首先,请确保将程序集中的dll复制到输出路径,特别是验证引用的“复制本地”属性是否设置为true。还要确保它是根据兼容的平台编译的,而不是您的项目(32位、64位或任何CPU)。
*** Assembly Binder Log Entry (12/8/2015 @ 8:05:42 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\XDesProc.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = XamlDesignerFaultInjection
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: XamlDesignerFaultInjection | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = XDesProc.exe
Calling assembly : Microsoft.VisualStudio.DesignTools.Utility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\XDesProc.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: All probing URLs attempted and failed.