TwitterBootstrapMVC

Development for ASP.NET MVC with Bootstrap made simple.

Step 1

You have a couple of options to get TwitterBootstrapMVC:

Option 1: Nuget package

Fastest way to install BMVC: is to use Nuget.

  1. Open Nuget Package Manager
  2. Find and install package according to your MVC version:
  • MVC5 - TwitterBootstrapMVC5
  • MVC4 - TwitterBootstrapMVC
  • MVC3 - TwitterBootstrapMVC3

Option 2: Download a .dll

  1. Download a .zip file
  2. Extract all .dll files on your computer
  3. Right click on the References > Add Reference...
  4. Click "Browse" and select the .dll files you downloaded

Step 2 (only for Bootstrap 3)

Using this library for Bootstrap 3 requires a license.

  1. Download a License
  2. Include license in the root of your project.
  3. In the Global.asax file, inside Application_Start() include code: Bootstrap.Configure();
    In order for this command to be recognized, include using TwitterBootstrapMVC; at the top of Global.asax.

Step 3

Specify version of the Bootstrap to use.

  1. Open web.config file under Views folder (not the web.config file in the root folder)
  2. Find section <system.web.webPages.razor><pages><namespaces>
  3. Add namespace TwitterBootstrapMVC
  4. Depending on version of Bootstrap that you are using add one of the two namespaces:
    • TwitterBootstrap2 or
    • TwitterBootstrap3
  5. Reload the project

The web.config should look something like the below:

<system.web.webPages.razor>
  <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=FREF3869EE366DE5" />
  <pages pageBaseType="System.Web.Mvc.WebViewPage">
    <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Optimization"/>
      <add namespace="System.Web.Routing" />
      <add namespace="TwitterBootstrapMVC" />
      <add namespace="TwitterBootstrap2" />
    </namespaces>
  </pages>
</system.web.webPages.razor>

What will not happen when installing this library

  • Bootstrap .css(or .less) and .js files will not be added to your project.
  • MVC bundles to use Bootstrap files will not be created
  • Your layout files will not be modified to use Bootstrap

You will have to do all of the above on your own.