相关疑难解决方法(0)

无法从程序集'mscorlib加载类型'System.Runtime.CompilerServices.ExtensionAttribute'

当我第一次启动我的网站时,我收到了这个错误

Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

我究竟做错了什么?

我正在使用.NET 4并从Visual Studio启动该站点.

我最近唯一改变的是将Simple Injector(通过Nuget)添加到我的项目中.

这是堆栈跟踪

[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, …
Run Code Online (Sandbox Code Playgroud)

.net

142
推荐指数
4
解决办法
16万
查看次数

DesignInstance无法在VS2012中运行

在使用VS2012,WPF 4.5和设计时数据(特别是DesignInstance属性)时,我只花了几个小时处理问题.

目标:我希望在我的WPF项目(基于MVVM)中获得设计时数据支持,无论是在VS2012还是Blend中,我都无法在生命中使MVVMLight方法始终如一地工作.

因此,我尝试使用Blend提供的标记扩展,使用内置的设计时数据支持更改为"just".

问题:请考虑以下代码:

<Window x:Class="Nova.View.AlertsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:Nova.View"
        xmlns:vm="clr-namespace:Nova.ViewModel"
        mc:Ignorable="d"
        DataContext="{Binding Alerts, Source={StaticResource Locator}}" 
        d:DataContext="{d:DesignInstance vm:DesignAlertsViewModel, IsDesignTimeCreatable=True}"
... />
Run Code Online (Sandbox Code Playgroud)

VS2012和Blend都报告"名称DesignAlertsViewModel在命名空间clr-namespace中不存在:Nova.ViewModel",即使intellisense解决它很好,并且你已经检查过一千次命名空间和类名都是正确的.

wpf blend mvvm design-time-data visual-studio-2012

15
推荐指数
3
解决办法
7160
查看次数

标签 统计

.net ×1

blend ×1

design-time-data ×1

mvvm ×1

visual-studio-2012 ×1

wpf ×1