So far we've created two ASP.NET MVC projects that use the Bootstrap frontend framework. The first included the Bootstrap assets by default because we created it with the standard ASP.NET MVC Visual Studio project template. The second, we created an empty ASP.NET MVC project and added the Bootstrap files manually.
NuGet is a package manager for the .NET framework and can be used to automatically add files and references to your Visual Studio projects. A Bootstrap package exists on the NuGet gallery site, which enables you to automatically add the Bootstrap assets to your project.
Bear in mind that though the Bootstrap NuGet package assumes that you want your Bootstrap files in the Content
and Scripts
folders and will create the folders and files as such, it will also automatically check whether you have the jQuery library referenced and if not, add it by design.
Tip
NuGet is a package manager for the Microsoft development platform that makes it easy to add references to existing libraries. You can read more about it on https://www.nuget.org/.
One option for adding the Bootstrap NuGet package to your project is to use the Manage NuGet Packages dialog box. To access the Manage NuGet Packages dialog and add the Bootstrap NuGet package, perform the following steps:
The second method of adding NuGet packages to your Visual Studio project is via the Package Manager Console and completing the following steps:
Inside Visual Studio, from the Tools menu, navigate to Library Package Manager | Package Manager Console. This will open the Package Manager Console window.
To install the Bootstrap NuGet packages, type
Install-Package bootstrap
, as shown in the following screenshot:This will create the
Content
,fonts
, andScripts
folders and add the necessary Bootstrap files to each.