[Step-by-step MVC6] First-dependency node of Project. json, mvc6project. json

Source: Internet
Author: User

[Step-by-step MVC6] First-dependency node of Project. json, mvc6project. json

Project. json unifies packages. config, NuGet configuration (nuspec) and Project file (csprojs) versions earlier than ASP. NET vNext, and integrates them into Project. json.

Let's take a look at the dependencies node, as the name implies: dependency. So what is this node used?

This node is used to replace the project reference of the previous generation. net. Let's take a look at this example. If we create a controller and add an action Bulid, the following error will be reported:

Severity Code Description project file line

Error CS0234 The namespace "Microsoft. AspNet" does not contain a type or namespace name "Mvc" (is the Assembly reference missing ?)


As follows:

So how can we solve the problem?

The answer is the same as the previous idea: Add a project reference. OK. Let's take a look at how the next generation of. net adds project references;

That is, add "Microsoft. AspNet. Mvc": "6.0.0-beta4" to the dependencies (dependency) node of the project. json file. After Bulid, we found that there is one more Microsoft. AspNet. Mvc (6.0.0-beta4) under the references file. We can see that it is very convenient and dynamic. As follows:

Then we can compile the program to run normally.

Conclusion:This article focuses on applications and solves the Assembly reference problem. We hope to shake hands with project. json for other functions of project. json.

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.