Introduction to. NET Core, Introduction to. netcore

Source: Internet
Author: User
Tags mscorlib

Introduction to. NET Core, Introduction to. netcore

At connect (), we announced that the. NET core would be completely released as open source software. I also promised to share more details with the. NET core. In this article, I will provide the. NET core, how we release it, how it relates to the. NET Framework, and how it means the development of cross-platform and open source code.

Look back--motivate. NET Core

For the first time, let's look back at how the. NET platform is packaged in the past. This helps motivate some decisions and results to create. NET core ideas.

. NET--This set of vertical markets

We initially launched the. NET Framework in 2002 with a single framework. Soon after, we released the. NET Framework Lite version, which is suitable for smaller devices and a subset of the Windows Mobile footprint. NET Framework. The Compact framework is a separate code library from the. NET Framework. It includes the entire vertical: Top Of The Runtime Library, framework, and application model.

Since then, we have performed this subset of exercises many times: Silverlight, Windows Phone, and most recently Windows app stores. This can cause fragmentation, because the. NET platform is not a single entity, but a set of platforms, owned and maintained independently by different teams.

Of course, what's wrong with providing special functions to meet specific needs. However, it becomes a problem if there is no systematic approach and specialization occurs at very small levels in other vertical corresponding layers without taking into account each layer. The result is a set of platforms that share only facts and start from common code libraries. Over time this will lead to more disagreements unless explicit (and expensive) measures take a converged Api.


What is the broken question? If you only target a single vertical, then there is really no problem. You provide an API set to optimize your verticals. As long as you want the target level, this is a problem with multiple verticals. Now, you must have the reason for the available Api and come up with a way to generate the vertical cross-work asset of your desired target.

Today, it is extremely common to have cross-Device Applications: there are almost always running on web servers, often administrative front-ends that use Windows desktops and a group of exposed to consumers, the backend of the mobile application for multiple devices. Therefore, it is critical to support developers to build cross-Existing. NET vertical components.

The birth of portable Class Libraries

At first, there was no concept of cross-industry code sharing. There is no portable class library and no shared project. You are basically stuck with creating multiple projects, linked files, and#if. This makes it an arduous task for multiple vertical tasks.

In the Windows 8 cycle, we caught up with a plan to handle this problem. When we design the Windows app store configuration file, we introduce a subset of the new conceptual model in a better way: contract.

Originally, the. NET Framework was deployed around the assumption as a single unit, so the factoring service was not concerned. Everything depends on mscorlib at the core conference. The Mscorlib. NET Framework provides many features that cannot be supported everywhere (for example, remote processing and Appdomain ). This forces the core of each vertical subset platform. This makes it very complex to use tools to give your target multiple vertical library experiences.

The conceptual contract is to provide a well-constructed API surface area. The contract is a simple objection to the compiled assembly. The contract assembly with the conventional assembly is designed around the appropriate factoring business. We are deeply concerned about the contract between these dependencies. They have only one separate responsibility, not the encapsulated Api. Independent contract versions and follow correct version control rules, such as adding Api results to later versions of the Assembly.

We use contracts to create APIs across all vertical market models. Vertical can then simply select the contract they want to support. One important aspect is that vertical must support contracts, either wholesale or not. In other words, they cannot subset contract content.

This allows reasoning about the differences between APIs vertical at the Assembly level, rather than the previous API level. This enables us to provide library-like experience for multiple industries, also known as portable class libraries.

Unified and unified API execution shape

You can think of a portable class library as a combination of different. NET vertical experiences based on its API shape. The most urgent need to solve this problem is the ability to create libraries that run vertically in different. NET databases. It also serves as a design tool vertical to drive convergence, for example, between Windows 8.1 and Windows Phone 8.1.

However, we still have different implementations-or cross-. NET platforms. Those implementations are independent of different teams, versions, and different transport vehicles. This makes the unified API shape constantly face challenges: the API is only portable when the execution across all vertical forward movement, but because of different code libraries, it is quite expensive, so always obey (rare earth) determine the priority. Even if we can do a perfect job by converging the Api: All verticals have different transport vehicles, which means that some parts of the ecosystem will always be behind.

Better unified implementation: instead of providing a well-constructed view, we should provide a well-constructed implementation. This will allow simple vertical sharing of the same implementation. Convergence will no longer be extra; it is built. Of course, in some cases, we may need multiple implementations. File I/O, which requires different technologies, based on the environment is a good example. However, it is much easier to ask each team to have specific components and think about how their APIs work across all vertical markets than to try to trace back at the top of an Api stack. This is because portability is not something you can provide later. For example, the file Api supports the Windows Access Control List (ACL) and cannot be supported in all environments. This issue must be taken into account in Api design. For example, this feature can be omitted if it is provided in a separate assembly on a platform that does not support Acl.

Full-host framework and Local Application Framework

Another interesting challenge is how to deploy the. NET Framework.

The. NET Framework is a machine-wide framework. Any changes made to it will affect all applications using its dependencies. A machine-wide framework is a deliberate decision because it solves these problems:

But it also requires a price.

First, its complex application developers adopt a dependency on the recently published framework. You must include the latest operating system dependencies or the applications that can be installed when the. NET Framework is installed. If you are a web developer, you may not even have this option because the IT department tells you which version you are allowed to use. If you are a mobile developer, you have no choice but your target operating system.

However, even if you are willing to provide installation programs to facilitate the installation of the chain in the. NET Framework, you may find that upgrading the. NET Framework can corrupt other applications.

Insist--Are we not saying that our upgrade is highly compatible? We are all. And we are very careful about compatibility. We will strictly review any changes made to the. NET Framework. Any impact that may be substantially changed to that we have a dedicated review investigation. We run the compatibility lab, where we test many popular. NET applications to ensure that we do not return to them. We also have the ability to tell the application to compile the. NET Framework. This allows us to maintain compatibility with existing applications, while selecting a later version of the. NET Framework as the final target to provide better behavior for the application.

Unfortunately, we also learn or even compatible changes that can interrupt the application. Let me give you a few examples:

  • Add an InterfaceTo the existing type, the application can be interrupted because it may interfere with how the type is serialized.

  • There were no overload methods in the pastAdd overloadIt can break through the reflection consumer that never finds more than one method.

  • Rename an internal typeYou can interrupt the application. If the type name appears through the tostring () method.

These are rare cases, but when you have 1.8 billion compatible machines, 99.9% of the customer base can still mean that 1.8 million machines are affected.

What's more interesting is that fixing the affected applications is quite trivial in many cases. However, the problem is that application developers do not necessarily involve interruptions. Let's take a look at a specific example.

You test your application on. NET Framework 4, which is your installation with your application. But some of your customers installed another application on the first day and upgraded it to the. NET Framework 4.5 machine. You do not know that your application is broken until the customer calls your support. At this point, it is very expensive to handle the compatibility problem of your application because you must get the corresponding source, set the camera, debug the application, and make necessary changes, they integrate the release branch, generate a new version, test it, and finally release updates to your customers.

This is a comparison with where you decide where you want to use the new version of. NET Framework to publish features. At this point, you are ready to make changes to your application. If there is a minor compatibility fault, you can easily handle it as part of the function work.

Due to these problems, it takes us some time to release a new. NET Framework. More drastic changes, more time, we need to bake it. This result is self-explanatory, where our beta version is already quite locked and we are almost unable to take design change requests.

Two years ago, we started the NuGet database on board. Because we didn't add these libraries to the. NET Framework, we call them "in-band ". Out-of-band libraries are not affected. We only discuss them because they are local problems of applications. In other words, library deployment if they are part of your application.

This solves all problems that prevent you from upgrading to a newer version. You take the capabilities of newer versions only to limit the capability to release the updated version of your application. This also means that you are controlling which version of the library is taking advantage of specific applications. The upgrade will not affect other applications running on the same machine in the context of a single application.

This allows us to release updates in a more flexible and diverse manner. NuGet also provides a preview version that allows us to release a bit without submitting a concept on a specific API or behavior. This supports workflow, where we can provide you with our latest design, and-if you don't like it-just change it. A good example is that this is a constant set. It has a trial period of about nine months. We spent a lot of time trying to get the first version we shipped before the correct design. Needless to say, the design of the finals-Thank you for your feedback-is better than the original version.

Input. NET core

All of these aspects allow us to rethink and change the styling of the forward. NET platform approach. This leads to the core creation in. NET:


The. NET core is the modular implementation that can be used in a variety of vertical zooming from touch-based device data centers. It is available as open source code and supported by Microsoft Windows, Linux, and Mac OSX.

Let me go into how the. NET core looks like, and how it solves the problem. More details I discussed earlier.

Unified implementation of. NET Local Machine and ASP. NET

When we design a. NET local machine, we obviously cannot use the. NET Framework-based framework class library. This is because the. NET local machine is basically merged with the application framework, and then removed from the fragments, without the local code generated before the application (I am greatly simplifying this process here. For more details, see this deep dive ). As I said just now, the execution of the. NET Framework is not considered to make it extremely challenging. The dependency CLOSURE OF THE linker is too large to reduce how many frameworks get compiled into applications.

ASP. NET is 5 facing similar challenges. Although it is not used. NET native new ASP. one of the goals of the NET 5 web stack is to provide XCOPY to deploy the stack so that web developers do not coordinate with their IT departments so that they can depend on a higher version. In this case, it is also important to minimize the size of the framework because it needs to be deployed together with the application.

The core of. NET is essentially the implementation of the cross-NET Framework, which also optimizes the attention of the surrounding factoring business. Although the differences between. NET (based on Touch devices) and ASP. NET 5 (server-side web development) are completely different, we can provide a unified base class library (BCL ).


For. NET core, the surface area of the bcl api is the same from the two. NET machines and ASP. NET 5. The bottom of the BCL we have a very thin layer specific to. NET runtime. We currently have two implementation methods: one is specific to the Local. NET runtime and the other is specific to CoreCLR, using ASP. NET 5. However, this layer does not change frequently. It contains types, such as strings and Int32. The vast majority of BCL is pure MSIL assembly which can be shared-yes. In other words, Apis do not just look the same-they share the same implementation. For example, there is no reason to set different implementations.

In addition, there are application model-specific APIs. For example,. NET provides Windows client-specific development, such as WinRT interoperability APIs. ASP. NET is 5 added. For example, MVC is a server-side web development Api.

We believe that the. NET core is not specific to the. NET native. Also, ASP. NET 5-BCL and the runtime environment are generally used for modular design. Therefore, it is based on all future. NET vertical markets.

NuGet as the first type of Carrier

And the. NET framework will serve as a set of NuGet package delivery. NET core platforms. We have already landed on NuGet because this is where most library ecosystems are already.

To continue our modular and well-structured efforts, we don't just provide the entire. NET core platform as a single NuGet package. Instead, it is a set of fine-grained NuGet packages:


In the BCL layer, we will have a one-to-one link between the Assembly and the NuGet package.

Forward, the NuGet package will have the same name assembly. For example, an Immutable set is no longer transmitted in an NuGet package called Microsoft. Bcl. Immutable, but on the contrary, it is called a System. Collections. Immutable package.

In addition, we have decided to use semantic Version Control for our Assembly version control. The version number of the NuGet package is aligned with the assembly version.

The alignment between the name and version control assembly and package greatly helps and discovery. It is no longer a mysterious NuGet package that contains System. Foo, version = 1.2.3.0-it is provided by System. Foo package 1.2.3.

NuGet allows us to deliver. NET cores in an agile manner. Therefore, if we provide an upgrade to any NuGet package, you can simply upgrade the corresponding NuGet reference.

The provided framework also removes the differences and third-party dependencies between the 1-party. NET dependencies for NuGet-they are all NuGet dependencies. This allows third-party packages to be expressed. For example, they need a higher version of the System. Collections Library. Installing this third-party package now prompts you to upgrade your reference to System. Collections. You don't need to understand the dependency graph-you just need to agree to change it.

NuGet is also a. NET core platform based on delivery .. The modular design of the NET core ensures that each application only needs to be deployed. We are also enabling smart sharing if multiple applications use the same frame bit. However, the goal is to ensure that each application has its own framework logically so that the upgrade will not interfere with other applications running on the same machine.

We decided that using NuGet as a transfer mechanism would not change our commitment to compatibility. We continue to be extremely careful about compatibility and will not mark once the package is marked as a major change to the stable execution of the API or behavior. However, local Application Deployment ensures that where the changes are seen as additives that interrupt the application is rarely isolated for development time only. In other words, for. NET core, these inter-office breaks can only happen after your upgrade package is referenced. At that moment, you have two options: to resolve faults in the application, be compatible with or roll back to the previous version of the NuGet package. However, the. NET Framework and those that break will not happen after you deploy the application to the customer or production server.

Enterprise ready

The NuGet deployment model enables agile versions and faster upgrades. However, we don't want to compromise. the. NET Framework provides today's one-stop service experience.

One of the great things of the. NET framework is that it acts as a whole unit, which means Microsoft tests and supports all components as a single entity vessel. We will provide the same experience for. NET core. We will create a. NET core distribution concept. This is basically just a snapshot of all the software packages of a specific version of which we test them.

This idea is that our team usually has a single software package. The new version of the shipping team package only requires the team to test their components in the context of the components they depend on. Because you can mix and match NuGet packages, it is obvious that some components cannot be combined together. Distribution does not have this problem because all components are tested in combination.

We expect distribution at a low pace than a single package shipment. We are currently considering four times a year. This allows time. It will take us to run the necessary tests and confirm the signatures.

Although. NET core delivery as a set of NuGet packages does not mean that you have to download the software package each time you need to create a project. We will provide offline installation programs for distribution and include them and Visual Studio, so that new projects will be created as quickly as today and without Internet connections in the development process.

Although local application deployment is very suitable for the impact of isolation, it does not apply to all situations as a dependency on newer features. Key security patches must be deployed quickly and in a comprehensive order. We are fully committed to making security patches because we are always on. NET.

To avoid compatibility issues, we have seen the security vulnerabilities that are critical to the centralized update of the. NET Framework in the past. Of course, there are very few opportunities to destroy existing applications. This is why we only have the real key issue of doing so. It is acceptable for a very small set of applications that no longer work, not all applications that use this vulnerability to run.

Basic open source and cross-platform

With cross-platform. NET in a sustainable way, we decided to go to the open-source. NET core.

From past experiences, we understand that successful open source code is the Community function around it. A key aspect of this is an open and transparent development process that enables communities to participate in code reviews, read design documents, and assist in product changes.

Open source code allows us to expand. NET for uniform and cross-platform development. If basic components, such as collections, need to be executed multiple times actively hurt the ecosystem .. NET core goals have a single code library that can be used to build and support all platforms, including Windows, Linux, and Mac OSX.

Of course, some components, such as file systems, need different implementations. The NuGet deployment model allows us to abstract these differences. We can have a single NuGet package that provides multiple implementations for each environment. However, it is important that this is the implementation details of this component. All consumers see a unified API that works on all platforms.

Another way is to look at this. The open source code of desire is the continuation of desire. We release the. NET component in an agile way:

All three elements allow us to provide a wide range of agility and maturity.


Core relationship with existing platforms. NET

Although we design the. NET core, it will become the foundation of all the stacks in the future. We are very familiar with the dilemma of creating "A general stack" that everyone can use:


We believe that the future we have found lays the foundation, while maintaining a good balance of interoperability with the existing stack. I want to see more details about these platforms.

. NET Framework 4.6

The. NET Framework is still the platform for building rich desktop applications and the. NET core will not change.

Visual Studio our goal in 2015 is to ensure that the core of. NET is a pure subset of the. NET Framework. In other words, there should be no functional gaps. After the Visual Studio was released in 2015, we expected that the. NET core would be faster than the. NET Framework version. This means that the function will only be available on the. NET-based core platform at a time point.

We will continue to release updates to the. NET Framework. Our current idea is that the release pace will be roughly the same today, once a year. In these updates, we will take innovation from the. NET core to the. NET Framework. We will not just blindly work on port functions, though-it will be based on cost-benefit analysis. As I have pointed out,. NET frameworks and even additive changes can cause problems with existing applications. Our goal is to minimize the differences between APIs and behaviors without breaking the compatibility of existing. NET Framework applications.

There are also ongoing work. We will announce investment in the. NET Framework in the WPF road map.

Single Channel

Many of you have asked what the single cross-platform story. NET core means. The Mono Project is essentially an open source code re-implementation. NET Framework. It shares a wealth of APIs with the. NET Framework, but there are also some problems, especially around the implementation of the factoring business.

Living alone makes it easy to use a big ecosystem. This is why, the independent. NET core, we also released the. NET Framework reference source to open the source friends license, in the GitHub part. This aims to enable the single-channel society to use the same code to close the gap between the. NET Framework and the single-channel. However, the complexity of the. NET Framework is not installed on GitHub to run it as an open source project. In particular, we cannot accept requests for it.

Another way is to look at it: the. NET Framework has essentially two forks. A forks are provided by Microsoft, But Windows. Other forks are audio channels. You can use Linux and mac.

With. NET core, we can develop the entire. NET stack as a fully open source project. Therefore, it is no longer necessary to maintain a separate fork: in a single-channel society, we will vigorously develop. NET core Windows, Linux, and Mac OSX. This also enables mono Community innovation in the streamlined. NET core stack, and takes into account environments that Microsoft is not interested in.

Windows App Store and Windows Phone

Windows Store 8.1 and Windows Phone 8.1 platforms have many smaller. NET Framework subsets. However, they are also the core subset of. NET. This allows us to use the. NET core as the underlying implementation of the two forward platforms. So if you are working on these platforms, you will be able to directly consume all innovations without waiting for an updated framework.

This also means that the number of available BCL APIs on both platforms will be exactly the same as those you can see in ASP. NET 5 today. For example, this includes a non-generic set. This will make it easier for you to touch existing code running on the. NET Framework Based on the Application Experience.

Another obvious side effect is that the full convergence of the BCL Api in the Windows App Store and Windows Phone and the underlying. NET platform are now two. NET core power supplies that will continue to be integrated.

. NET core and other. NET platforms share code

As the. NET core lays the foundation for all future. NET platform code and. NET core based on the sharing platform has become non-friction.

Here's the question about how to use code sharing without the. NET-based core, such as the. NET Framework Platform. The answer is: like today, you can continue to use portable class libraries and shared projects:

  • Portable class libraryIs great when your common code is platform-independent and platform-specific code that serves as a reusable library can be broken down.

  • Shared ProjectIs the greatness of code. When your common code has a few specific platforms, because you can adapt it#if.

For more details, choose between the two. Let's take a look at this blog.

As we move forward, portable class libraries will also support basic platforms targeting the. NET core. The only difference is that if youOnlyYou do not need a fixed set of APIS for the target. NET core basic platform. Instead, it is based on the NuGet package that you can perform during the upgrade.

If you do not have at least one platform based on the. NET core, you are subjected to APIs that can share it. In this mode, you can still upgrade the NuGet package, but you may be prompted to select a higher platform version or give up their support.

This method allows you to share two worlds and also benefit from the. NET core.


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.