[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.