ASP.NET5 Development tools and deployment environment under Linux (study notes)

Source: Internet
Author: User

1. Description

Because in the " Antique Machine " practice, can only install the system is ubuntu-15.04-desktop-i386 (x86 32-bit desktop system, it is recommended that you install 64-bit)

I would like to do some or record video in this introduction, but the Linux system is not very familiar with the operation, coupled with the system special "card",

Even the Chinese character input is not convenient (such as this article knocked laborious), is really a cup, had to give up!

The following content, some wordy, sorry! (In fact, I also study notes, in detail, a long time, not afraid of forgetting.) )

The following sources mainly refer to:https://docs.asp.net and https://github.com/aspnet/home

2.visualstudio Code

"工欲善其事, its prerequisite", use good tools to improve productivity and increase productivity.

VisualStudio code, referred to as Vscode. Where the hell is it? There is no debate here, and I do not want to publish the topic that water fights the mouth.

Writing code with Notepad is OK, and it looks very bull.

After all, no grammar, words, help and other intelligent tips or test run the environment to build, need to remember and master more.

Vscodehttps://code.visualstudio.com/download

You can download it via the browser, or you can open the terminal ( under "#:", which starts with the terminal operation ) and download it using the download tool.

such as wget:

#: wget Https://az764295.vo.msecnd.net/public/0.8.0/VSCode-linux-ia32.zip

How do I install it when I download it? can view document Https://code.visualstudio.com/Docs/editor/setup

Enter the Vscode-linux-ia32.zip directory

Extract to the specified directory #:unzip-n vscode-linux-ia32.zip-d/specified directory

Re-enter the Vscode-linux-ia32 directory after decompression

#: Vscode-linux-ia32/code can be recalled Vscode run.

(You can also open the Vscode-linux-ia32 directory to the desktop to run the code file directly)

Is that the problem? This can only be opened by specifying the code path access under the terminal.

How to set it to global, under which path can be run.

This is similar to setting a shortcut under Windows or setting environment variables. Under Linux, perform:

#:sudo ln-s/absolute path (disk path)/vscode-linux-ia32/code/usr/local/bin/code

(Note: The software's execution file is usually linked to the /usr/local/bin directory)

Once this is set up, you can execute #:code under any path of the terminal . (. The current path directory on behalf of Vscode Open)

3.dnvm

Check out the Linux installation help HTTPS://GITHUB.COM/ASPNET/HOME/BLOB/DEV/GETTINGSTARTEDDEB.M

First install Curl download Tool #:sudo apt-get Install curl

#:curl-ssl https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | Dnx_branch=dev sh && Source ~/.dnx/dnvm/dnvm.sh

Confirm Availability #:DNVM

View Help #:dnvm-h

View CLR Installation #:DNVM list (hint. NET Environment no OH)

Upgrade mode Install #:DNVM Upgrade (the test is 32-bit, the default installation of the mono version of the CLR, it needs to install Mono's JIT-compiled environment)

If your system is 64 bit, it may be installed by default dnx-coreclr-linux-x64 (it does not require the mono environment)

You can also use the DNVM install.

Multiple versions can definitely coexist, but when used, they are not the default activations and need to be specified using the DNVM use.

(Hint: dnx-coreclr-linux-x86 version is not available,www.nuget.org look for it.)

4.mono

Here to Add. Currently running the ASP.NET5 program is broadly divided into three types of CLR:

The full version of the CLR (which is traditionally run only under Windows),

Core CORECLR (for cross-platform, lightweight. Microsoft rewritten, various versions written for various system platforms),

The mono version of the CLR (that is, the mono team based on Microsoft's. NETFramework language standards, written by the cross-platform CLR,

This is not based on the Microsoft CLR that set OH. So in performance and improvement, is not better than the Microsoft home-produced CLR, please see other comments.

In fact, cross-platform also need not worry, choose which home?

Microsoft has been working with Mono, MONOCLR will only be absorbed by CORECLR, Mono will also be supported by Microsoft Open Source, improve monoclr.

The future of the two routes are expected to merge (personal statement, does not represent authority!) Don't spray! )

Only MONOCLR can be installed in front of you, and you need to install the Mono JIT compilation environment to use MONOCLR in the ASP.NET5 project.

installation See Http://www.mono-project.com/docs/getting-started/install/linux

#:sudo apt-key adv--keyserver keyserver.ubuntu.com--recv-keys 3fa7e0328081bff6a14da29aa6a19b38d3d831ef

#:echo "Deb Http://download.mono-project.com/repo/debian wheezy main" | sudo tee/etc/apt/sources.list.d/mono-xamarin.list

#:sudo apt-get update

#:sudo apt-get install Mono-complete

Once the installation is complete, you can check to make sure:

#:mono-v (V caps)

5.demo

With the DNVM Package Manager and MONOCLR running environment, we can run the ASP.NET5 program to test it.

Microsoft has also provided a project case. We cloned them.

Install Git tool First #:sudo apt-get install git

Download #:git clone https://github.com/aspnet/Home.git aspnet-home

(Aspnet-home is the name of the downloaded folder)

Enter the downloaded project root directory (the path where the Project.json is located)

#:dnu Restore (if not fully downloaded, repeat the execution OH)

Then open the project with Vscode #:code.

Take a look at the commands key of the Project.json configuration.

Run #: dnx commands (e.g. commands configuration: "Run": "ConsoleApp", then execute DNX run)

The problem comes with the above steps, running the console project can be. But to run the Web project, the cups come up.

We also have a libuv not installed.

Because currently ASP.NET5 Web cross-platform deployment, can only selfhost self-hosted or Microsoft Cloud Run (VS Express IIS can also).

Of course, the plan for Docker runs has already been.

The future (now or beta release) can be deployed in traditional IIS mode, even for web deployment environments such as Nginx.

Running the web on Selfhost cross-platform requires kestrelhttpserver(Install LIBUV).

6.libuv

View Help HTTPS://GITHUB.COM/LIBUV/LIBUV

Download the latest version of HTTP://DIST.LIBUV.ORG/DIST/V1.7.5/

Enter the unpacked directory ...

Install First #:sudo apt-get install automake libtool

#:sudo sh autogen.sh

#: sudo./configure

#:sudo make

#:sudo make install

#:sudo ldconfig

This will allow you to run the Web project. (to DNX commands in Kestrelhttpserver config key)

7.npm

We can write code Vscode, but quickly create a project template?

Open Source Community Omnisharp develop a generator-aspnet tool. It requires a nodejs environment, and it needs to be installed with NPM.

NPM is included in the Nodejs installation.  So we'll just install Nodejs. It has three kinds of installation methods.

one is included with Ubuntu software warehousing , with #:sudo apt-get install Nodejs

It is not the latest version and is not recommended for this installation.

the second is to use the official compiled version .

Compiled version address https://nodejs.org/dist/v4.1.2/node-v4.1.2-linux-x86.tar.gz

Go to the path to download the installation package ...

Unzip the specified directory #:tar-xf node-v4.1.2-linux-x86.tar.gz-c/specified directory

Set as Global command

#:sudo ln-s/absolute path (disk path)/node-v4.1.2-linux-x86/bin/node/usr/local/bin/node

#:sudo ln-s/absolute path (disk path)/NODE-V4.1.2-LINUX-X86/BIN/NPM/USR/LOCAL/BIN/NPM

View version

#:node-v

#:npm-v

Third, the source code to compile their own .

Download Source https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz

Enter the unpacked directory ...

Check and configure the build Environment #:./configure

Build #:make

Install #:sudo make install

8.generator-aspnet

View Help Https://github.com/OmniSharp/generator-aspnet

Install Yo#:npm install-g yo

Use Yo#:yo

Install generator-aspnet#:npm install-g generator-aspnet

Using Generator-aspnet#:yo ASPNET

9. Summary

Writing code with Vscode makes it easy to create Asp.net5 project templates with Generator-aspnet.

Write the program run environment, which is inseparable from the CLR.

Some program hosting also requires a specific compilation or runtime environment.

There is no vscode,generator-aspnet,npm,DNVM Four sharp tools specific use of skills to demonstrate, sorry.

In addition, because the Docker virtual Machine deployment application is very convenient and very hot, a separate introduction.

ASP.NET5 development tools and deployment environment under Linux (learning notes)

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.