简体   繁体   中英

NuGet adding rogue line to web.config MVC4

Every time I install ANYTHING using Nuget, this gets added to my <Runtime><asseblyBinding> section in my web.config:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>

Obviously I'm using MVC4 so references to Razor 2.0.0.0 breaks things, and the following runtime error is thrown.

Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Its easy to fix, just remove the rouge section from Web.Config, but very annoying all the same! Anyone know why this might be happening, or how to fix this?

I'm using Nuget Package Manager Version 1.7.30402.9028

Individual packages are able to provide installation routines written in PowerShell, which is probably what's happening here. Does the same thing happen even if you install something unrelated to Razor, like, say, JQuery?

Thanks, Clay

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM