简体   繁体   English

将ASP.NET MVC 3 Web角色添加到Windows Azure项目时出现冲突的版本错误

[英]Conflicting versions error adding ASP.NET MVC 3 Web Role to Windows Azure project

I am getting the following error creating a new project after installing Windows Azure Tools 1.4: 安装Windows Azure Tools 1.4后,我收到以下错误,创建一个新项目:

Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0". 检测到的ASP.NET网页版本存在冲突:指定版本为“1.0.0.0”,但bin中的版本为“2.0.0.0”。 To continue, remove files from the application's bin directory or remove the version specification in web.config. 要继续,请从应用程序的bin目录中删除文件,或删除web.config中的版本规范。

You'll find you have an assembly in your bin folder that is a different version from the one mentioned in the web.config. 您会发现bin文件夹中的程序集与web.config中提到的版本不同。 The weird bit is that it may not be the assembly that the message suggests. 奇怪的是它可能不是消息所暗示的组件。 It may be a descendent of that. 它可能是一个后代。

I had this problem whereby it claimed version of System.Web.WebPages in the bin folder was 2.0.0.0 but it was definitely 1.0.0.0 when I checked. 我有这个问题,它声称bin文件夹中的System.Web.WebPages版本是2.0.0.0但我检查时肯定是1.0.0.0。 It then turned out that it was System.Web.WebPages.Deployment that was version 2.0.0.0. 然后证明它是版本2.0.0.0的System.Web.WebPages.Deployment。 After removing that assembly the error went away. 删除该程序集后,错误就消失了。 I wrote a blog post on this: Conflicting versions of ASP.NET Web Pages detected 我写了一篇博文: 检测到的ASP.NET网页的冲突版本

I had this problem and it drove me nuts. 我有这个问题,它让我疯了。 The simple solution was to delete everything out of my bin directory (Build Clean wasn't enough) and then rebuild. 简单的解决方案是从bin目录中删除所有内容(Build Clean是不够的),然后重建。 I needed no programming changes. 我不需要编程更改。

This problem occurred for my after a co-worker upgraded a project to MVC4. 在一位同事将项目升级到MVC4后,我遇到了这个问题。

I also had this problem and it would redeploy the files to my bin every time I did a build. 我也有这个问题,每次我进行构建时它都会将文件重新部署到我的bin中。 Finally I figured out that I had to remove them from my _bin_deployableAssemblies also. 最后我发现我必须从我的_bin_deployableAssemblies中删除它们。 That fixed it for me. 这为我解决了这个问题。

I encountered the same problem, but the root cause was slightly different. 我遇到了同样的问题,但根本原因略有不同。 This one was a little tricky to solve. 解决这个问题有点棘手。 The project had the correct 1.0.0.0 DLL version for System.Web.WebPages and the correct configuration in the Web.config. 该项目具有适用于System.Web.WebPages的1.0.0.0 DLL版本以及Web.config中的正确配置。 However, the System.Web.WebPages.Deployment and System.Web.WebPages.Razor DLLs were referencing version 2s instead of Version 1s. 但是,System.Web.WebPages.Deployment和System.Web.WebPages.Razor DLL引用的是版本2而不是版本1。

My coworker's solution was magically referencing the correct versions when mine didn't initially. 我的同事的解决方案在我最初没有的时候神奇地引用了正确的版本。 When I looked at the project file, the Version was to 2, but the hint path for the DLLs were to Version 1. So, when he opened the solution Version 1 was used, but on mine Version 2 was used. 当我查看项目文件时,版本为2,但DLL的提示路径是版本1.因此,当他打开解决方案时,使用了版本1,但是使用了版本2。 I guess the hint path made the difference here. 我想提示路径在这里有所不同。

What was checked in: 签到的内容:

<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Deployment.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Razor.dll</HintPath>
  <Private>True</Private>
</Reference>

After fixing it: 修好之后:

<Reference Include="System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检测到ASP.NET Web页的冲突版本 - Conflicting versions of ASP.NET Web Pages detected 在Azure Web角色中托管的ASP.NET MVC3应用程序中是否需要SessionStateModule? - Do I need SessionStateModule in my ASP.NET MVC3 application hosted in Azure web role? ASP.NET MVC - Web项目中的模型 - ASP.NET MVC - Model in Web project 如何在Windows Azure上使用ADO .NET EF部署ASP.NET MVC 3项目? - How to deploy ASP.NET MVC 3 project with ADO .NET EF on windows azure? Wcf Web Api服务路由与常规asp.net mvc路由冲突(web api preview 4) - Wcf Web Api service routes conflicting with regular asp.net mvc routes (web api preview 4) 如何将具有.MDF文件(SQL 2008)的现有ASP.NET MVC 3项目迁移到Windows Azure仿真器(使用SQL Azure) - How to migrate existing ASP.NET MVC 3 Project with .MDF file (Sql 2008) to Windows Azure Emulator (using SQL Azure) 如何将现有的asp.net mvc 3 Web应用程序转换为azure - how to convert an existing asp.net mvc 3 web application to azure 带有SQL Azure的ASP.NET MVC Web应用程序(“任务列表”教程)—部署到生产环境时出错 - ASP.NET MVC Web Application with SQL Azure (To Do List Tutorial) — error when deploying to production asp.net MVC使用Windows Azure进行身份验证 - asp.net MVC forms authentication with windows azure 如何设置web.config以查看ASP.NET MVC3项目的完整错误消息 - How to setup web.config to see the complete error message for ASP.NET MVC3 project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM