I've upgraded from the Beta to the RC within VS2010 and when I create a new project with the base template for MVC4 - Web API, I get a configuration error.
The type or namespace name 'Optimization' does not exist in the namespace 'System.Web', referencing the web.config:
<add namespace="System.Web.Optimization" />
I've removed all of the bundling references and got a working project, but I'd highly prefer not to have to cut everything out. Any ideas as to what might need to happen to get it to recognize this reference?
I've seen this reported one other spot (Hanselman's blog comments), so I'm not alone. WebGrease is installed.
I have not gone through the complete document but believe System.Web.Optimization will be available from .NET 4.5 but can access these api's through Microsoft.Web.Optimization namespace.
I'm fairly certain that .NET 4.5 does not work under VS2010, so I'm confused as to why they'd place a number of references to it in a default template?
I don't care to install the VS2012RC on my work machine, so I'll just remove the references for now unless someone else has any feedback.
Update: CopyLocal=True for System.Web.Optimization
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
I installed VS2012RC on another machine and it is working great (w/o NuGet package), so I installed it on this machine. Same issue is occuring, so there is something getting caught up somewhere. Some DLL issues perhaps? I installed this package on the
VS2012 version to be sure, still the same issues.
I think my downfall was MCV4 Beta -> RC. Somewhere in the mix, it busted everything.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
I'm running into a very similar issue. VS2010 sp1 fully updated, MVC4 RC (new machine, never had beta installed), got system.web.optimization beta via nuget -pre... Just trying to work through the music store tutorial and when the scaffold adds a CRUD
controller it uses all the @Script and Bundling stuff automatically. I can't get it to work even with the system.web.optimization package added to the project. Based on another comment I tried replacing the @Script syntax with the following but that didn't
work either.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Marked as answer by ricka6 on Jun 11, 2012 07:08 PM
When creating the StoreManagerController it adds Create.cshtml, Edit.cshtml, etc. They all contain this syntax:
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
I get the following exception when I click the Create or Edit link:
Exception Details:
System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
I've read several theories on what is going on. One blog suggested that bundling doesn't work with
debugging. Ideally I could just turn off the bundling altogether? Is that possible?
Also, I hope I'm not hijacking the original thread, if so, please ignore/delete this message.
I've read several theories on what is going on. One blog suggested that bundling doesn't work with
debugging. Ideally I could just turn off the bundling altogether? Is that possible?
Also, I hope I'm not hijacking the original thread, if so, please ignore/delete this message.
Might not work with VS2010 at all, from what I've found. With VS2012RC it works just fine...if you have a clean environment on which to install it. I won't be installing anymore Beta/RCs without using a VM, that's for sure.
No worries on the hijacking - this is important for people to see and all related. These various installers aren't quite ready for primetime.
clduvall
Member
63 Points
44 Posts
MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 08, 2012 04:39 PM|LINK
I've upgraded from the Beta to the RC within VS2010 and when I create a new project with the base template for MVC4 - Web API, I get a configuration error.
The type or namespace name 'Optimization' does not exist in the namespace 'System.Web', referencing the web.config:
<add namespace="System.Web.Optimization" />I've removed all of the bundling references and got a working project, but I'd highly prefer not to have to cut everything out. Any ideas as to what might need to happen to get it to recognize this reference?
I've seen this reported one other spot (Hanselman's blog comments), so I'm not alone. WebGrease is installed.
CPrakash82
All-Star
18720 Points
2899 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 08, 2012 05:53 PM|LINK
I have not gone through the complete document but believe System.Web.Optimization will be available from .NET 4.5 but can access these api's through Microsoft.Web.Optimization namespace.
Thanks,
clduvall
Member
63 Points
44 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 08, 2012 06:15 PM|LINK
I'm fairly certain that .NET 4.5 does not work under VS2010, so I'm confused as to why they'd place a number of references to it in a default template?
I don't care to install the VS2012RC on my work machine, so I'll just remove the references for now unless someone else has any feedback.
imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 10, 2012 07:11 AM|LINK
Try to install this nuget package.
Update: CopyLocal=True for System.Web.Optimization
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
clduvall
Member
63 Points
44 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 01:56 PM|LINK
I did and it still isn't working for me.
I installed VS2012RC on another machine and it is working great (w/o NuGet package), so I installed it on this machine. Same issue is occuring, so there is something getting caught up somewhere. Some DLL issues perhaps? I installed this package on the VS2012 version to be sure, still the same issues.
I think my downfall was MCV4 Beta -> RC. Somewhere in the mix, it busted everything.
imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 02:09 PM|LINK
Try to run MVC Diagnostic.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
HiBoost
Member
8 Points
13 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 02:38 PM|LINK
I'm running into a very similar issue. VS2010 sp1 fully updated, MVC4 RC (new machine, never had beta installed), got system.web.optimization beta via nuget -pre... Just trying to work through the music store tutorial and when the scaffold adds a CRUD controller it uses all the @Script and Bundling stuff automatically. I can't get it to work even with the system.web.optimization package added to the project. Based on another comment I tried replacing the @Script syntax with the following but that didn't work either.
@section Scripts { <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/jqueryval")" type="text/javascript"></script> }
imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 03:00 PM|LINK
Can you provide me a sample project?
Note, In RC you can use this instead,
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
HiBoost
Member
8 Points
13 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 03:14 PM|LINK
This is the stage of the tutorial that I'm on:
http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-5
When creating the StoreManagerController it adds Create.cshtml, Edit.cshtml, etc. They all contain this syntax:
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
I get the following exception when I click the Create or Edit link:
Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
I've read several theories on what is going on. One blog suggested that bundling doesn't work with debugging. Ideally I could just turn off the bundling altogether? Is that possible?
Also, I hope I'm not hijacking the original thread, if so, please ignore/delete this message.
clduvall
Member
63 Points
44 Posts
Re: MVC4 RC - System.Web.Optimization not found (VS2010)
Jun 11, 2012 03:20 PM|LINK
Might not work with VS2010 at all, from what I've found. With VS2012RC it works just fine...if you have a clean environment on which to install it. I won't be installing anymore Beta/RCs without using a VM, that's for sure.
No worries on the hijacking - this is important for people to see and all related. These various installers aren't quite ready for primetime.