Can Combres be used with a Web Site Project or does it have to be a WebForms or MVC Web Application?

Aug 2, 2012 at 12:12 AM

I've been tasked with improving a site that was built as .Net 3.5 Web Site Project.  It was built as a single page application and has a lot of javascript and css files that I'd like to bundle and minify.  Combres seems to be a nice straightforward way of doing what I want. Since this is a website project I don't have a global.asax file.  I thought I would try anyway.

The Web site project has already been updated to use .Net assemblies and I installed Combres via nuget and edited the combres.xml file and my default page according to the 5 minute quick start guide. When I compile the site I get the following error in the App_Start/Combres.cs file:

Error 58 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 

Because this is a Web Site Project I don't have the typical right-click->Add Reference option like I would in a ASP.Net Web Application.  If I right click on the project and choose Property Pages I can add references there.  I added System.Web.Routing and the error persists.  

Is what I'm trying to do possible or would I be better off either converting the web site or using a different method?

Thanks for the help!

Aug 14, 2012 at 7:12 PM

Please send me the the sample project that has this error

Aug 17, 2012 at 11:51 PM
Edited Aug 20, 2012 at 3:39 PM

I began creating a sample project and didn't get the same error but Combres still didn't work. I then did some fiddling and finally got it working with the sample project but not in my original. Steps to get it working in a sample project are described below. I'm still getting the following error in my original application.

Error 45 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
I may just create a new solution, get combres working there and then move my original files over from the old project. The project was upgraded from an older project and so I think I'll take this approach instead of spending days trying to figure this out.
To create a sample project to get Combres working with a Web Site Project do the following:
  1. in Visual Studio (I'm using 2010) choose File > New > Web Site
  2. Choose the ASP.NET Web Site template, change the name of the web site folder and click OK.
  3. Open the Site.master and remove the form and any elements dependent on it.
  4. Remove any form dependent elements from the Default.aspx page as well.
  5. Add some javascript. I added code from a jquery animate example ( ) putting the javascript in a custom.js file and adding the css to the Site.css file.
  6. Make sure the example works.
  7. Follow the Combres 5 Min Quick Start guide ( )
  8. run the site and it shows with no CSS and the js isn't loaded. If I try to access the file directly using the url generated in the source I get a 404.
  9. I then added System.Web.Routing.RouteTable.Routes.AddCombresRoute("Combres"); to the Application_Start method in the Global.asax file as suggested for .net 3.5 users and everything worked. Even though I'm using .Net 4, because I have a Web Site Project and not a Web Application you still need that step.
Aug 20, 2012 at 7:18 PM

I should just mention that I was able to get it working on my earlier solution.  The older project had been upgraded to .Net 4 at some point and the web.config was missing the targetFramework attribute on the compilation element.  Once I added that the error went away.


<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">