小编And*_*eas的帖子

Razor语法突出显示无法在VS 2012中使用MVC 5

我正在使用Visual Studio 2013 RC中的MVC 5 RC 1.效果很好.

现在我将VS 2012中的现有MVC 4项目升级到MVC 5,方法与此处描述的相同

我还更改了web.config(s) - 请参阅" 从MVC4升级到MVC5 "

除了在视图中突出显示Razor/C#代码之外,所有内容(构建,运行Web应用程序,甚至智能感知)都能正常工作.

我还尝试了在VS 2013中创建的MVC 5项目.结果相同.所以我假设VS 2012没有"理解"新组件?!

任何已知的解决方法或想法可以突出显示?

c# razor visual-studio-2012 visual-studio-2013 asp.net-mvc-5

47
推荐指数
5
解决办法
3万
查看次数

尝试将MEF与MVC控制器一起使用时,CompositionContractMismatchException

我正在开发一个更大的C#MVC 4项目,该项目分为几个程序集(Core,Domain,Backend MVC,Frontend MVC等).我使用MEF提供的插件架构来加载和解决大多数依赖项.现在我也想用它来加载MVC控制器.在几十个样本中发现了典型的场景.

但我一直得到这个YSOD:

例外说:

[CompositionContractMismatchException: Cannot cast the underlying exported value of type "XY.HomeController (ContractName="XY.HomeController")" to type "XY.HomeController".]
System.ComponentModel.Composition.ExportServices.CastExportedValue(ICompositionElement element, Object exportedValue) +505573
System.ComponentModel.Composition.<>c__DisplayClass10`2.<CreateSemiStronglyTypedLazy>b__c() +62
System.Lazy`1.CreateValue() +14439352
System.Lazy`1.LazyInitValue() +91
  XY.DependencyManagement.SomeCustomControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in (Path)\Core\DependencyManagement\SomeCustomControllerFactory.cs:32
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +89
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +305
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +87
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12550291
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Run Code Online (Sandbox Code Playgroud)

自定义ControllerFactory:

 public class SomeCustomControllerFactory : DefaultControllerFactory {

    private readonly CompositionContainer _compositionContainer;

    public SomeCustomControllerFactory (CompositionContainer compositionContainer) {
        _compositionContainer …
Run Code Online (Sandbox Code Playgroud)

c# mef asp.net-mvc-4

9
推荐指数
1
解决办法
4039
查看次数

Visual Studio 2017 RC安装错误0x80131500无法反序列化包

我正在尝试在我的机器上安装新的Visual Studio 2017 RC.由于没有足够的可用磁盘空间,第一次尝试在下载期间失败.之后每次尝试安装它会导致以下错误/激发:

2016-11-17T16:50:08 : Error : Failed to get installed product summaries. [installerId: SetupEngine, error: JsonReaderException at    bei Newtonsoft.Json.JsonTextReader.ReadStringIntoBuffer(Char quote)

   bei Newtonsoft.Json.JsonTextReader.ParseString(Char quote, ReadType readType)
   bei Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
   bei Newtonsoft.Json.JsonTextReader.ReadAsString()
   bei Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
   bei Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   bei Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   bei Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   bei Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type …
Run Code Online (Sandbox Code Playgroud)

visual-studio visual-studio-2017

5
推荐指数
1
解决办法
4078
查看次数