How to install SB Admin 2 bootstrap template with ASP.ENT MVC

In this post I describe how to install (and troubleshoot) SB Admin 2 Start Bootstrap template integrated with ASP MVC framework. Described template can be previewed here. Fortunetly someone adapt this template from Start Bootstrap  project to ASP MVC.

Installation processes were described by the author here, but I meet few problems with installation via Visual Studio Gallery extension available here:  VusialStudioGallery.

In this post generally I would like to describe problems solution for mentioned extension.

  1. Download sb-admin-2.Template.vsix form there: https://visualstudiogallery.msdn.microsoft.com/f460cb77-92fa-426b-96e7-ebc285a317aa
  2. Install it.
  3. Create new project in Visual Studio (preferably 2013):
    File -> New project -> (in search textbox: sb-admin-2) -> OK
  4. Build project

Encountered errors:

Error 16 The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\paweln66\Documents\Programming\C#\#MVC\#Exercise\sb-admin-2.Web1\App_Start\BundleConfig.cs 2 18 sb-admin-2.Web1
Error 17 The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\paweln66\Documents\Programming\C#\#MVC\#Exercise\sb-admin-2.Web1\Global.asax.cs 5 18 sb-admin-2.Web1

(…)

Error 28 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) C:\Users\paweln66\Documents\Programming\C#\#MVC\#Exercise\sb-admin-2.Web1\Controllers\HomeController.cs 16 16 sb-admin-2.Web1
Error 29 The name 'View' does not exist in the current context C:\Users\paweln66\Documents\Programming\C#\#MVC\#Exercise\sb-admin-2.Web1\Controllers\HomeController.cs 18 20 sb-admin-2.Web1

Solution:

missing_dllScreenshot shows all dynamic libraries under Reference section in Solution Explorer. All References marked by yellow triangle are missing. Newtonsoft.Json is not necessary – can be just removed. Remove also rest of marked references and add them again in the following way (besides System.Web.Optimization – it must be added in another way):

  1. Build -> Clean Solution
  2. Right click on Reference node -> Add Reference…
  3. Type in search box missing reference name and mark checkbox next to the latest version (screenshot)
  4. Click OK
  5. Repeat steps 2-4 for all missing rederences

System.Web.Optimization

This reference can not be added in the previous way because is not now a part of .NET framework (possible reason). How to add it:

  1. TOOLS -> Library Package Manager -> Package Manager Console
  2. Type in opened console:
    Install-Package Microsoft.AspNet.Web.Optimization
  3. If you get following output, reference should be successfully added to the project:
    Attempting to resolve dependency 'Microsoft.Web.Infrastructure (≥ 1.0.0)'.
    Attempting to resolve dependency 'WebGrease (≥ 1.5.2)'.
    Attempting to resolve dependency 'Antlr (≥ 3.4.1.9004)'.
    Attempting to resolve dependency 'Newtonsoft.Json (≥ 5.0.4)'.
    Installing 'Microsoft.AspNet.Web.Optimization 1.1.3'.
    Successfully installed 'Microsoft.AspNet.Web.Optimization 1.1.3'.
    Adding 'Microsoft.AspNet.Web.Optimization 1.1.3' to sb-admin-2.Web1.
    Successfully added 'Microsoft.AspNet.Web.Optimization 1.1.3' to sb-admin-2.Web1.

For me it works! Despite the fact thata after first run I got this error page:

error_page

But after rerun application everything works for me (yes, this is screenshot from official live preview)🙂

sb_admin_2

I haven’t any problem with this template downloaded from thist GitHub repo. Many thanks to the author of this template and to the developer who adapted this template to ASP MVC project.

If you have any addictional problem please write in comments!

Links:

One response to “How to install SB Admin 2 bootstrap template with ASP.ENT MVC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s