ASP. NET 5 core with IBOXDB package management on Linux QuickStart sample

Source: Internet
Author: User
Tags dotnet reflection thread class

An important update for ASP. NET 5 is that it supports running on the. Execution environment, referred to as DNX. While DNX Core currently supports three operating systems for Windows Ubuntu OSX, although Mono has very good support for. NET on Linux, DNX introduces a convenient package management or is worth a try. Java's jar package does not have a built-in version number and can be put together casually. NET DLL package with version number, when put together it is easy to have a version number conflict prompts, generally do not affect the use.

Configuring DNX on Ubuntu Linux is also very convenient and does not require a tradition of downloading to the website. NET installation method, of course, there is no modern App store which is convenient. Specifically, you can crossing the network, here to copy the command line, in Ubuntu on a line of execution on it.

sudo sh-c ' echo ' Deb [ARCH=AMD64] http://apt-mo.trafficmanager.net/repos/dotnet/trusty main ">/etc/apt/ Sources.list.d/dotnetdev.list '

sudo apt-key adv--keyserver apt-mo.trafficmanager.net--recv-keys 417a0893

sudo apt-get update

sudo apt-get install dotnet

After executing these commands there is a dotnet environment where you must mention the Mono-complete, and when you are stunned by the new libraries on the DNX core platform, don't forget that there is a mono. Here is Dnxcore API help, encounter incompatible must check, the most will be assembly name, DNX Core introduced advanced package management, but need to load themselves, the version number.

In front of the install dotnet, it installs only a few basic operating environments, so it's very fast. The test begins below. Build an empty directory Dnxcore, enter, and then execute

Dotnet Init

There will be a Hello World template in this directory. Traditional. NET program only Program.cs a file, DNX under a Project.json file, which is used to load the package as needed, generally need to modify the dependencies this paragraph, adding a reference to IBOXDB.DNX 2.6.2.16 package , and Filesystem,thread. In Dnx, like file operations, the basic functionality of the thread class is in a separate package.

"Dependencies": {  "Microsoft.NETCore.Runtime": "1.0.1-beta-*",  "System.IO": "4.0.11-beta-*",  " System.Console ":" 4.0.0-beta-* ",  " System.Runtime ":" 4.0.21-beta-* ",  " Iboxdb.dnx ":" 2.6.2.16 ",  " System.IO.FileSystem ":" 4.0.1-* ",  " System.Threading.Thread ":" 4.0.0-* ",  " System.Threading.Tasks.Parallel ":" 4.0.0-* "}

At this point, make sure the network connection is OK, then perform

dotnet Restore

Wait for it to load automatically online, and finally you may be prompted that some base libraries are not found. This is because Microsoft.NETCore.Runtime this base run package version changes, it refers to the package Microsoft.NETCore.Runtime.CoreCLR version changes, The version of the package referenced by the Microsoft.NETCore.Runtime.CoreCLR package also changes, and now a large number of packages are beta versions, often upgraded, in a formal package with a beta hybrid environment not easy to set up on the version, simply do not set up, these several system.* Packages will be loaded by default. Unlike the traditional. NET Framework release of a new version in 12, Dnxcore's packages are updated several weeks later, with active days updated, and developers who like to always reference the latest version may be thrilled. You can also remove the Microsoft.NETCore.Runtime and manage the basic package version yourself without prompting. as follows

"Dependencies": {  "system.collections": "4.0.10",  "System.Reflection": "4.0.10",  " System.Reflection.Extensions ":" 4.0.0 ",  " System.Runtime.Extensions ":" 4.0.10 ",  " System.Text.Encoding ":" 4.0.10 ",  " System.Globalization ":" 4.0.10 ",  " System.Threading ":" 4.0.10 ",  " System.IO ":" 4.0.11-beta-* " ,  "System.Console": "4.0.0-beta-*",  "System.Runtime": "4.0.21-beta-*",  "Iboxdb.dnx": "2.6.2.16",  "System.IO.FileSystem": "4.0.1-*",  "System.Threading.Thread": "4.0.0-*",  " System.Threading.Tasks.Parallel ":" 4.0.0-* ",}

dotnet Restore does not place a bunch of downloaded files in the newly created project file directory, but in the user home's. dnx/packages directory. IBOXDB.DNX Package directory has a test file, execute the following command to copy to the current directory

@ubuntu: ~/dnxcore$ CP. /.dnx/packages/iboxdb.dnx/2.6.2.16/content/iboxdb26.cs.

Open Program.cs Copy the last two lines of Test call code

public class program{public   static void Main (string[] args)  {     iBoxDB.LocalServer.DB.Root ("/tmp/");     Console.WriteLine (IBoxDB.TestHelper.RunALL ());}  }

Final execution

Dotnet Run

You can see the effect and do not need to perform the compilation. Do not want a line of code to type, you can download the test code here. Dnxcore5 operation and use in Windows and Ubuntu is the same, that is, under Windows is also knocking command line, performance which good, you guess? The good code is, of course, placed under the Windows version, here again to mention mono. Most applications do not exhaust the CPU, can choose the deployment platform according to the actual user situation, automatically load the association package, these are good features.

ASP. NET 5 core with IBOXDB package management on Linux QuickStart sample

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.