Reputation: 119
I'm developing my ASP.NET 5 app using Visual Studio 2015. There is no problem at all since RC1 with working with multiple projects in one solution, and so on..
But for a few days I have to work with VS Code and I'm not sure how to solve missing classes problem. Let's say I have solution with project A and project B. They have it's own classes inside. In previous versions of ASP.NET all files have been referenced in .csproj file, but now, my .xproj files are nearly empty. There are no direct paths to files. And in my project A I've created new classes, they have all correct namespaces, project B has a reference to A (even my controller in project B uses classes from same A's namespace!), but there is a compiltion error which says that my classes cannot be found in project A :/
I thought that with VS Code I have to add some kind of references in project, to notify compiler about that new files,but I cannot find a correct place to do it. Any ideas?
Upvotes: 0
Views: 482
Reputation: 32699
You do this in the project.json file.
{
"dependencies": {
"ProjectA": "1.0.0-*"
}
}
You declare the dependency. If the source is available in the solution folder, it will find it and use it. If the source isn't available, it can pull down a NuGet package that matches the version number. The documentation I linked to above provides more information about this process.
Once you have a dependency registered, you can refer to the public classes in your project. You'll need to fully qualify the dependencies (use the full namespace) or add a using <namespace>
directive at the top of your file.
Upvotes: 2