Run the ASP. NET Core project and frameworkcore on the traditional. NET Framework.

Source: Internet
Author: User

Run the ASP. NET Core project and frameworkcore on the traditional. NET Framework.

We want to use ASP for the new project. NET Core, but it has suffered a lot from our historical heritage. For example, the use of JavaScriptService in. NET Core to implement the DES encryption algorithm, we have to wait. NET Core 1.2, we only have a majority of APIs. The NodeJs method is a bit of a curve to save the country, and many people will not agree, if it is pure.. NET Core. NET Core project, which is difficult to handle in a specific time schedule, not only does some of the APIS we depend on have not yet, but also a large number of our. NET Framwork library is too late to be migrated. NET Standard compatibility. This article describes how to run our ASP. NET Core project in A. NET Framework 4.5 or later environment, so that we can keep up with the development of. NET Core.

 

Scott hanselman wrote an article titled How to reference an existing. NET Framework Project in an ASP. NET Core 1.0 Web App introduces how.. NET Framework 4.5 or above.. NET Core project. The following figure explains how to do this:

 

.. NET 4.5 or later versions and. NET Core underlying compilers and runtime are the same, ASP. NET Core 1.0 can also run on NET Framework 4.6. When we create a Web project through Visual Studio 2015 Update 3, there is a template:

We have seen three ASP. NET Web project types:

  • ASP. NET Web application. This is ASP. net mvc and Web API of version 4.6. It runs on the. NET Framework.
  • ASP. NET Core Web applications run on. NET Core 1.0, which is cross-platform. If you choose to create a project, you will be able to run your application anywhere, but you cannot reference "complete". NET Framework Assembly
  • ASP. NET Core Web applications run on the. NET Framework. The new ASP. NET Core 1.0 unifies MVC and Web APIs, does not support WebForms, but runs on Windows. NET Framework. If you have any questions, the latest Mono 4.6 is also implemented. NET 4.5 API. Can the application of this Project template run on Mono? The answer should be no, because the underlying compiler and runtime of Mono are not consistent. NET Core unified, but Mono is on the road, has begun to unify the underlying compiler and runtime, the specific available to https://trello.com/ B /vRPTMfdz/net-framework-integration-into-mono, understand the specific work progress, the next stable version of Mono 4.8 should be supported. For more information, see Dockerized. NET Core 1.0.1 and. NET Framework on Mono 4.7.

We chose the ASP. NET Core Web application to run the template creation project on the. NET Framework. The created project is as follows:

 

 

Then we create two libraries for. NET Framework 4.5, and then reference them in the asp.net core application:

Let's take a look at the project of the asp.net core project. json. In the near future, when Visual Studio 2017 RC is released, project. the json function is merged with csproj and msbuild. You will notice that ClassLIbrary1 is not listed under the highest-level dependency item node, but as a framework-specific dependency, it is like this:

In this case, it is a type = "project" dependency. In this case, I have not created a NuGet package for reference. However, because. NET Core toolin has some defects in the preview, these defects should be fixed by the improvement of tools.

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.