Dependency management in ASP. NET 5

Source: Internet
Author: User

Dependency management in ASP. NET 5?

Tips

This article links: http://cnblogs.com/qin-nz/p/5034398.html or http://blog.qin.nz/aspnet5/aspnet5-dependency-management.html

As we know, we need to refer to a variety of libraries to help us complete the development of our projects. This article introduces dependency management in ASP. Two from both the server side and the browser side.

Server-side code uses Nuget as a package manager?

For those who are accustomed to using Visual Studio 2015 as a development tool, they should not be unfamiliar with Nuget. But one thing to note is that it does provide us with a lot of convenience in managing the server-side class library, but it is undeniable that it lacks the management of the browser-side class library.

Annotations

If you are not developing on the Windows platform, you can still use the server-side package manager, but there is no nice UI. For people who develop with Visual Studio Code, you can refer to the Getting Started with ASP. NET 5-Create a Project.json in an empty project.

Browser-side code uses Bower as the package Manager?

Bower is a Web Package manager that can install and restore client-side dependencies, while automatically helping us with dependencies, and currently has more than 30,000 packages available. The dependencies of the Nuget Package Manager are defined in project.json , while the Bower is defined in bower.json .

Little Tricks

Visual Studio 2015 hides the Bower.json file by default and can be 解决方案资源管理器 selected in 显示所有文件 to unhide it.

Typically, after we create a non-empty project, both the bootstrap and jquery packages are already installed.

 {  "name"  :   "basic"    "private"  :  true    "dependencies"  :  {   "bootstrap"  :   "3.3.5"  Span class= "P",     "jquery"  :   "2.1.4"      "Jquery-validation"      :   "1.14.0"  ,     "jquery-validation-unobtrusive"  :    "3.2.4"   }  }  

Warning

In fact, for the Mac/linux platform, the dependencies of the above 2 packages have been written in Bower.json, but the contents of the two packages have not been downloaded locally. When the website is running, the problem is that the Web site gets the file from the Microsoft CDN by default, and only gets it locally if the CDN fails.

Install the D3 drawing engine?

If we need to reference a new package, such as for data presentation d3 , we just need to add the following line of content.

{  "Name": "Basic",  "Private": true,  "Dependencies": {    "Bootstrap": "3.3.5","  D3": "~3.5.10",         "jquery": "2.1.4",    "Jquery-validation": "1.14.0",    "Jquery-validation-unobtrusive": "3.2.4"  }}

Little Tricks

Use the ~3.5.10 3.5.x latest version that represents the reference, or you can use it ^3.5.10 to represent 3.x.x the latest version of the reference.

Save the file, Visual Studio 2015 will automatically download it for you d3 , and the downloaded file will be located wwwroot\lib\d3 under the folder.

Annotations

For the Mac/linux platform, you need to run the command manually after each modification of Bower.json bower install !

Other resources?

Nuget official website

Bower official website

Dependency management in ASP. NET 5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.