Reputation: 2470
I'm running Visual Studio 2015 Update 3. I chose to create a .Net Core Project with .Net framework option specifically to use MVC 6. I have some classes in the project that I would like to reference from a console application project that I have included in the same solution. Although I can successfully add a reference to the .Net Core Project from the Console App, when I try to use the class from the console app, i'm unable to successfully add a using statement. It was my understanding that using the project template .Net Core App "With Net Framework" would prevent such issues. I've seen other posts regarding csproj xproj incompatibility. But i'm trying to add the reference from one xproj to another xproj. Is this even supported anymore? What a mess.
FYI: I also disabled resharper.
Upvotes: 1
Views: 319
Reputation: 26773
add the reference from one xproj to another xproj
If I understand correctly, the projects you are trying to link are both using project.json, right? This can be done by editing the project.json files. For example, you have "WebApp" and want to reference "ClassLib", edit the project.json file in the "WebApp" project to contain:
{
"dependencies": {
"ClassLib": {
"type": "project"
}
}
}
This part assumes that "ClassLib" is targeting a framework that is compatible with "WebApp", as listed in the "frameworks" section in project.json If your WebApp is targeting .NET Framework 4.6 (net46), then Class Lib should also target net46 or one of the frameworks compatible with "net46", such as "net451" or "netstandard1.3".
Upvotes: 1