ASP. NET Core Project. json file (5), coreproject. json

Source: Internet
Author: User

ASP. NET Core Project. json file (5), coreproject. json

If your application needs to do any useful work, then you need libraries and frameworks to complete the work, such as storing and retrieving data from a database or rendering complex HTML.

In this chapter, we will discuss the project. json file. This file uses JavaScript Object symbols to store configuration information. It is the Core of the. NET application. Without this file, your project will not be an ASP. NET Core project. Here we will discuss some of the most important features of this document. Double-click the project. json file to open it.

Currently, the default project. json file code is as follows:

{ "dependencies": {  "Microsoft.NETCore.App": {   "version": "1.0.0",   "type": "platform"  },  "Microsoft.AspNetCore.Diagnostics": "1.0.0",  "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",  "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",  "Microsoft.Extensions.Logging.Console": "1.0.0" }, "tools": {  "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "frameworks": {  "netcoreapp1.0": {   "imports": ["dotnet5.6", "portable-net45+win8"]  } }, "buildOptions": {  "emitEntryPoint": true,  "preserveCompilationContext": true }, "runtimeOptions": {  "configProperties": {   "System.GC.Server": true  } }, "publishOptions": {  "include": ["wwwroot", "web.config" ] }, "scripts": {  "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath%   --framework %publish:FullTargetFramework%" ] }}

As we can see, we have the version information of this file on the top. This is used when you select a version when compiling your application.

The version is 1.0.0, but the most important part of this file is dependency.

If your application needs to do any useful work, you need libraries and frameworks to do the work, such as storing and retrieving data from a database or rendering complex HTML.

In this version of ASP. NET Core, dependencies are all managed through the NuGet Package Manager.

NuGet has been in. NET for several years. Now, the main way to manage all your dependencies is by using the NuGet Package Manager.

All top-level NuGet packages that your application depends on must be stored in the project. json file.

"Microsoft.AspNetCore.Diagnostics": "1.0.0","Microsoft.AspNetCore.Server.IISIntegration": "1.0.0","Microsoft.AspNetCore.Server.Kestrel": "1.0.0","Microsoft.Extensions.Logging.Console": "1.0.0

From this file, you can see that our application depends on other packages, and the exact dependency may change the final version of ASP. NET. When you want to add a new dependency, such as the ASP. net mvc framework, you can easily write it into the project. json file. When editing this json file, you will also receive some smart prompts, as shown below:

You can right-click the reference in Solution Explorer on the user interface and choose manage NuGet packages. You can now see the currently installed software package.

These packages are the same as those in the project. json file. You can also use a browser to add reference packages, such as the following:

If you use the Install button to install the package, the package will also be stored in the project. json file. The framework part is another important part of project. json. This tutorial will show you which. NET frameworks can be used by ASP. NET applications.

"frameworks": {  "netcoreapp1.0": {   "imports": [    "dotnet5.6",    "portable-net45+win8"   ]  } },

In this case, you will see that "netcoreapp1.0" is the framework used in the project, you can also add. NET framework reference ,.. NET Framework is already installed when you install Visual Studio.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.