Add existing assembly to an mvc 6 project

2020-03-05 03:17发布

问题:

I'm testing Visual Studio 2015 and playing with mvc 6, all is fine, but when I try to add a reference, only proyects in the current solution are shown, I have an existing assembly already and I want to add it, but I don't see the option, how can I add a reference to a mvc 6 Project to an existing assembly?

回答1:

I think Visual studio 2015 is in preview and we can not add reference that we used to do it Visual Studio 2013.

For now onwards we add nuget package to Web Application ( ASP.net 5 or Say ASp.net MVC 6)

Now suppose you decided to build your own class library and I have successfully created library into another solution and added to my mvc 6 project.

Following are the step.

  1. Create ASP.net 5 Class Library project.
  2. Implement your functionality and I have just added few class.
  3. After this step I publish project to say location C:\published ( During publish mark option pre-compilation) Just like image below
  4. After this step if you visit location C:\published then it has path like C:\published\approot\packages.
  5. Now set following thing in Visual studio 2015 preview for package able to search.
  6. Now go to project.json file of your mvc project. Add reference to your library.

I hope this help you.