Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cshtml Unable to Resolve Reference

I'm adding Microsoft.Web.Optimization to an MVC 4 Beta project.

My _Layout.cshtml:

<script src="@Microsoft.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/Framework/js", true)"></script>

complains

Error 1 The type or namespace name 'Optimization' does not exist in the namespace 'Microsoft.Web' (are you missing an assembly reference?)

However, any .cs file in the project can resolve that type (for example, a controller).

Do I need to do something to inform a .cshtml page about the newly added reference?

like image 720
Eric J. Avatar asked Apr 19 '12 04:04

Eric J.


1 Answers

Turns out NuGet offered me and old version, 0.1. I'm not sure why that caused this issue, but removing that reference and adding 1.0.0-Pre through NuGet resolved the issue

http://www.nuget.org/packages/Microsoft.Web.Optimization

Note that the namespace has changed to System.Web.Optimization in this release.

like image 108
Eric J. Avatar answered Nov 19 '22 08:11

Eric J.