DISPLAYMODE / DiplayMode提供商发行Asp.Net MVC 4 [英] DisplayMode / DiplayMode Providers Issue Asp.Net MVC 4

查看:194
本文介绍了DISPLAYMODE / DiplayMode提供商发行Asp.Net MVC 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了MVC 4最近。开始与开发商preVIEW,现在公测。

一切都合作得非常好,但我想利用内置的微小&放大器; COM pression功能。但它似乎就像是在开发者previews因为不管present什么我试图在code不会编译/提供一个清洁的运行,如果我添加任何东西捆绑相关。然后,我做了一些研究,看到MVC 4测试版。

我卸载了MVC 4并使用测试版的安装程序重新安装。创建一个新的项目,它采用捆绑运行得很好。但无论我做什么,(包括复制DLL的来自新的解决方案,我的旧的。)我不能得到捆绑在我现有的解决方案的工作

在的global.asax.cs文件

[1]

BundleTable .Bundles.RegisterTemplateBundles();

捆绑表甚至不会注册。 (得到红色下划线)

[2]

我想别的,只是为了验证正在使用新的DLL。

previously检查显示模式以下将使用

  [一]
    DisplayModes.Modes.Insert(0,新DefaultDisplayMode(iPhone)
    {
      ContextCondition =(上下文=> context.Request.UserAgent.IndexOf
                         (iPhone,StringComparison.OrdinalIgnoreCase)GT; = 0)
    });

但它至今已更新为

  [B]
    DisplayModeProvider.Instance.Modes.Insert(0,新DefaultDisplayMode(iPhone)
    ...

如果我使用的code编译[A],而不是[B],但它不会给我用[A]一个干净的运行,因为它在运行时出现了错误

未能从程序集加载类型System.Web.WebPages.DisplayModes'System.Web.WebPages,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35'。

难道说我的老办法仍然引用旧的DLL不知何故,即使我在复制了新的,删除了参考和手动他们指出,新的?


参考条目由@Brad克里斯蒂要求

 <参考包括=的EntityFramework>
  <HintPath>..\\packages\\EntityFramework.4.1.10331.0\\lib\
et40\\EntityFramework.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=Microsoft.CSharp/&GT;
&lt;参考包括=Microsoft.Web.Infrastructure,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\Microsoft.Web.Infrastructure.1.0.0.0\\lib\
et40\\Microsoft.Web.Infrastructure.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Json,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  &LT; HintPath&GT; .. \\包\\ System.Json.4.0.20126.16343 \\ lib目录\\ net40 \\ System.Json.dll&LT; / HintPath&GT;
&LT; /参考和GT;
&lt;参考包括=System.Net.Http,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\System.Net.Http.2.0.20126.16343\\lib\
et40\\System.Net.Http.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Net.Http.Formatting,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\System.Net.Http.Formatting.4.0.20126.16343\\lib\
et40\\System.Net.Http.Formatting.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Net.Http.WebRequest,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\System.Net.Http.2.0.20126.16343\\lib\
et40\\System.Net.Http.WebRequest.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Helpers,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebPages.Core.2.0.20126.16343\\lib\
et40\\System.Web.Helpers.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Http,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebApi.Core.4.0.20126.16343\\lib\
et40\\System.Web.Http.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Http.Common,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\System.Web.Http.Common.4.0.20126.16343\\lib\
et40\\System.Web.Http.Common.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Http.WebHost,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebApi.4.0.20126.16343\\lib\
et40\\System.Web.Http.WebHost.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Mvc,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  &LT; HintPath&GT; .. \\包\\ AspNetMvc.4.0.20126.16343 \\ lib目录\\ net40 \\ System.Web.Mvc.dll程序&LT; / HintPath&GT;
&LT; /参考和GT;
&lt;参考包含=System.Web.Optimization&GT;
  <HintPath>..\\packages\\Microsoft.Web.Optimization.1.0.0-beta\\lib\
et40\\System.Web.Optimization.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetRazor.Core.2.0.20126.16343\\lib\
et40\\System.Web.Razor.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.WebPages,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebPages.Core.2.0.20126.16343\\lib\
et40\\System.Web.WebPages.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.WebPages.Deployment,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebPages.Core.2.0.20126.16343\\lib\
et40\\System.Web.WebPages.Deployment.dll</HintPath>
&LT; /参考和GT;
&lt;参考包括=System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL&GT;
  &LT;私人和GT;真&LT; /私人和GT;
  <HintPath>..\\packages\\AspNetWebPages.Core.2.0.20126.16343\\lib\
et40\\System.Web.WebPages.Razor.dll</HintPath>
&LT; /参考和GT;


解决方案

不是问题的答案我所期待的,但它得到了这份工作做。我结束了创建一个新的解决方案和移动我的code到它。似乎这样的伎俩。不知道为什么previous溶液不更新虽然正确:/

尝试将您的解决方案资源管理器,在根解右击并检查属性。在通用属性 - >项目依赖,确保相关项目进行检查

I've been trying out MVC 4 lately. Started with the developer preview, and now the beta.

Everything was working quite well, but I wanted make use of the built in minification & compression features. But it seemed like it wasn't present in the developer previews as no matter what i attempted the code wouldn't compile/provide a clean run, if i added anything bundling related. I then did some research and saw MVC 4 beta.

I uninstalled mvc 4 and re-installed it using the beta installer. Created a new project and it ran fine using the bundling. But no matter what I did, (Including copying the dll's from the new solution, to my old one.) I cant get the bundling to work in my existing solution

In the global.asax.cs file

[1]

BundleTable.Bundles.RegisterTemplateBundles();

Bundle Table wont even register. (gets red underline)

[2]

I tried something else just to verify that the new dll are being used.

previously to check for a display mode the following would be used

[a]
    DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iPhone")
    {
      ContextCondition = (context => context.Request.UserAgent.IndexOf
                         ("iPhone", StringComparison.OrdinalIgnoreCase) >= 0)
    });

but it's since been updated to

[b]
    DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone")
    ...

The code will compile if I use [a], and not [b], but it wont give me a clean run using [a], as it errors out during runtime

Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Could it be that my old solution is still referencing the old dlls somehow, even if i copied the new ones over, removed the references and manually pointed them to the new ones?


The reference entries as requested by @Brad Christie

<Reference Include="EntityFramework">
  <HintPath>..\packages\EntityFramework.4.1.10331.0\lib\net40\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\System.Json.4.0.20126.16343\lib\net40\System.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\System.Net.Http.Formatting.4.0.20126.16343\lib\net40\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebApi.Core.4.0.20126.16343\lib\net40\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\System.Web.Http.Common.4.0.20126.16343\lib\net40\System.Web.Http.Common.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebApi.4.0.20126.16343\lib\net40\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
  <HintPath>..\packages\Microsoft.Web.Optimization.1.0.0-beta\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetRazor.Core.2.0.20126.16343\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
</Reference>

解决方案

Not the answer i was hoping for, but it got the job done. I ended up creating a new solution, and moving my code to it. Seemed to do the trick. Not sure why the previous solution wasn't updating properly though :/

Try going to your solution explorer, and right clicking on the root solution and checking the properties. Under common properties -> Project dependencies, make sure that the relevant projects are checked.

这篇关于DISPLAYMODE / DiplayMode提供商发行Asp.Net MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆