Earlier I asked this question and got an answer that worked. In order to make your ASP.Net 5 application be able to reference a normal .Net class library that targets the .Net Framework 4.5, you must remove the ' "dnxcore50": { }' reference from your project.json file.
Great. That worked with a simple ClassLibrary project which did nothing.
Now I am trying to do it with more complicated class libraries. Class libraries which reference other NuGet Packages for instance (such as HtmlAgilityPack) and the same technique is not working.
This is very frustrating. I am a little dumbfounded that simply referencing a class library no longer works in the new version of ASP.Net.
One of the "features" that seems to be removed is the ability to reference a compiled DLL for a project that is not in your solution. The "Browse" button is gone from the Add Reference dialog in an ASP.Net 5 project:
Whereas a classic project still has the browse button:
Why? How do I reference a class library that is on my machine, yet I do not want to include in my project?
To reference a DLL on your machine but not in your Solution, you'll need to update the project.json as follows:
{
"frameworks" :
{
"dnx451" :
{
"bin" : { "assembly": "<path to dll>", "pdb": "<path to pdb if needed>" }
}
}
}
Unfortunately, much of the dnx tooling is not yet integrated into VS2015 (the teams are separate, and both are changing too quickly to keep up with each other particularly well), and the Asp.net documentation is still a work in progress.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With