Neither Cassette nor Microsoft.AspNet.Web.Optimization (the bundling solution included in MVC4 projects by default) seems to have ASP.NET MVC dependencies. Therefore, you can solve any solution for working with the implementation of AppHost ServiceStack.
For cassette:
Everything works fine if you install from NuGet:
ServiceStack.Host.AspNet
ServiceStack.Razor
Cassette.Aspnet
... and then use the Cassette from the Rzor cztml file, as usual.
One little magic that made me scratch my head for a few minutes:
The order in which the HttpHandlers are listed in your web.config is important. The ServiceStack.Host.AspNet package adds an ServiceStack.Host.AspNet path that uses a wildcard, since any further HttpHandlers, for example for Cassette.axd , are never reached.
Just changing the order in the web.config file:
<httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> <add path="cassette.axd" verb="*" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" /> </httpHandlers>
in
<httpHandlers> <add path="cassette.axd" verb="*" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" /> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> </httpHandlers>
fixed problem. I do not know if the installation of Cassette.Aspnet from Nuget was able to prevent this problem from occurring first.
For Microsoft.AspNet.Web.Optimization:
From NuGet you install:
ServiceStack.Host.AspNet
ServiceStack.Razor
Microsoft.AspNet.Web.Optimization
Having done this, you can use the Microsoft.AspNet.Web.Optimization package and standardization as usual.
I added the BundleConfig.cs file, followng convention, which you will find in the MVC4 project by default. Then I call BundleConfig.RegisterBundles(BundleTable.Bundles); from the ServiceStack AppHost file.
Subsequently, all @Scripts.Render() statements in Razor files work fine.