I purchased the Ace Admin template from wrapbootstrap.com and wanted to use it in an MVC 5 web application developed in Visual Studio. This article explains how I did that. Just for reference, the Ace Admin template is no longer available from wrapbootstrap but the process described here should be similar for any 3rd party Bootstrap template.


The standard MVC 5 application template that is delivered with Visual Studio 2013 makes use of Bootstrap 3 to provide a responsive web application. The default installation of Bootstrap puts the CSS files in the Content folder and the javascript files in the Scripts folder.

MVC 5 file layout
Visual Studio MVC 5 file layout

As delivered, the Ace Admin template has a directory named assets which contains additional folders which contain the various resource files.

Ace Admin file layout
Ace Admin file layout

In order to integrate this into the VS 2013 MVC app, I created folders with those same names in Solution Explorer. I created the js directory under the Scripts folder in Solution Explorer and created all of the others (avatars, css, font, etc.) under the Content folder in Solution Explorer. By doing this, there will be no conflict of files with the same name between what is in the default MVC application and what is provided in the Ace Admin template files (such as bootstrap.css and bootstrap.js). By separating the files in this manner, it will make it easier to update either the Bootstrap package provided through NuGet within Visual Studio or any updates to the Ace Admin template. When creating Script bundles or Style bundles within the BundleConfig.cs file of the project, I set references to bootstrap.cs and bootstrap.js to point to the files that are in the VS NuGet package rather than the files in the Ace directories. By doing this, the project will use the latest Bootstrap version that has been installed via NuGet from within VS. The documentation for Ace Admin template states that it is compatible with Bootstrap 3.3.x. Version 1.3.3 of the Ace Admin template is delivered with files for Bootstrap 3.3.1. The latest version of Bootstrap available via NuGet is 3.3.4 at this point in time.

Use Bootstrap files from NuGet package
Use Bootstrap files from NuGet package

This all worked fine in Debug mode because the files were not actually being bundled or minified.
Here is the network traffic info (gotten from IE F12 Developer Tools):

Network traffic
Network traffic

I then forced bundling to occur by putting the following statement in the BundleConfig.cs (this could be done through the web.config as well):

BundleTable.EnableOptimizations = true;

Running the application, it looked awful. It looked like there wasn’t any CSS being applied to the page. Here’s how the network traffic looked:

Initial bundled network traffic

The CSS files were not getting transferred which is why the web page looked so bad.

After some research, I discovered that I could not use ~/Content/css as a virtual path for the bundle because I had an actual physical path that existed for that same location. So I tried changing the virtual bundle path to ~/Content/css2.

Running the application, everything looked right again on the page so I was obviously getting the CSS files. However, looking at the network traffic showed another problem was occurring.

Files not found

Some of the font related files used in the Ace Admin template were not being found. The reason for this was that there was a relative path being specified in the @font-face definition in the CSS file. Changing the relative path in the CSS from ../fonts to ../Contents/fonts would make it work when bundling was turned on. However, when bundling was turned off, once again the files would not be found. The real problem was that the virtual path for the bundle and the path for the CSS file were at different levels of the application directory structure. I was able to solve this issue by creating the virtual path of the bundle to be at the same relative position in the application directory structure as the CSS file.

Resolve path conflict

This works for both bundled and unbundled delivery of the CSS/script files.

For more info on bundling and minification see the following article:

http://www.asp.net/mvc/overview/performance/bundling-and-minification

Hopefully, this gives you enough information to be on your way with integrating a Bootstrap theme into your own MVC 5 project in Visual Studio.

One Reply to “Integrating a Bootstrap template into an MVC 5 Application”

Leave a Reply

Your email address will not be published. Required fields are marked *