) Step by Step learning ASP. NET 5 (2)-create a project through command line and sublime, asp. netsublime

Source: Internet
Author: User

Step by step ASP. NET 5 (2)-create a project through command line and sublime, asp. netsublime

Forward: Microsoft MVP Lu Jianhui's article, hoping to help you.

Note: After forwarding yesterday, many friends pointed out the naming problem of vNext. The author of the original article has already modified the name, and the title below applies to the name asp.net 5.

Editor's note: I posted my first article yesterday. Thank you again for your comments and feedback. Here we will describe it because of ASP. NET 5 is still in the beta stage, and there is a lot of uncertainty. I will continue to revise it. Maybe the official version will be changed. Here I still want to comment on Microsoft to change its name .... I respect it.


Today, we will talk about how to create your ASP. NET 5 project. Alternatively, you can use Visual Studio templates (for example) at any time. But now I prefer to use command line scripts to generate ASP. NET 5 projects and use Sublime to complete all the coding work. (I am a fan, so all the articles will be done on Mac. Don't worry, the same is true for Windows/Linux)



Suppose you have read the first article (learning ASP step by step. NET 5 (I)-basic concepts and environment configuration) Guidelines for configuring ASP. NET 5 environment, and then create a project. If you want to create an ASP. NET project through the command line on Mac, Linux, or Windows, you can install Yeoman.

What is Yeoman? (Click to go to the official website)

Yeoman is developed by Google's team and external contributor team. His goal is to use Grunt (a command line tool for developing task automation) and Bower (A Package Manager for front-end resources such as HTML, CSS, Javascript, and images) to create an easy-to-use workflow for developers. Yeoman consists of three parts: yo (scaffolding tool), grunt (build tool), and bower (Package Manager ). These three tools are independently developed, but must be used together to implement our efficient workflow mode. In addition to the workflow mode, the dependency between the project package and the package is also solved. Let's see how these three modules work.



Configure Yeoman on Mac, provided that you have to configure node. js and npm. You can download the installation files from the corresponding official website.

Run the following command to install Yeoman:

Npm install-g yo // install Yeoman through npm

 

Npm install-g generator-aspnet // install the development template supported by Yeoman. Here is the template support for installing ASP. NET 5.

After completing the above two steps, you can build an ASP. NET 5 project by using the command line.

Open the command line on the Mac, of course, ComandLine/Windows is cmd, and then enter yo aspnet, you will see the following items


In addition to the traditional five-piece set (Empty/Console/Web/WebAPI/ClassLibrary), you can also find your favorite Nancy. Then you only need to move the cursor up and down to select what you need. To be honest, you can create a project through the command line, and the B-grid is improved quickly.

Here, I will create a Web Application as an example. When the cursor selects Web Application and press enter, it will ask you the project name. after entering the name, you can create a project (for example)

Then you can compile and run your Web Application project by entering three commands.

1. kpm restore will restore the packages required by your project and their Dependencies

2. Re-compile the kpm build

3. k kestrel/k web runs your Web project locally. Note that kestrel is for Mac/Linux platforms and web is for Windows platforms.

These three commands are just a review of the four K yesterday. Let's call it DN.

The command line is always a command line. When you need to edit the project, especially on non-Windows platforms, you still need an IDE. I recommend Sublime here. you can also use Vim.


Sublime Text development ASP. NET 5 Environment configuration

Of course, it is not expensive to buy a Sublime instance. If you buy multiple platforms at a time, you will not have to pay much for your work. The advantage of Sublime Text is that there are many plug-ins. If you need to install it, you must install Package Control Plugin first, because this is required. Is supported by a plug-in. For details, refer to this (click to open the link ).

After successful installation, you can use Package Control to install ASP. NET 5 support. Thanks to open source. this package is called Kulture. the installation steps are not described in detail. Follow this link to go in step by step (click to open the link) and restart Sublime, after pulling the project folder into Sublime, you can use Cmd + Shit + P on Mac/Ctrl + Shit + P on Windows, and then select Run K Command to call Kulture to compile and Run your ASP.. NET 5 project.

You will miss the smart prompts of Visual Studio. Of course, Sublime will also have the corresponding plug-in-Omnisharp (click to open the link ). Now, we can use Sublime + Kulture + Omnisharp to install a clear ASP. NET 5 runtime environment. You can easily complete your work under Sublime.

Today, thank you! I will talk about the basic architecture of ASP. NET 5 tomorrow. Of course, I hope you will give me feedback in a timely manner. Thank you!

Address: http://blog.csdn.net/kinfey/article/details/44340545

Related Article

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.