0
votes

I have a console app started in VS2015. I need three references added to the project, but I can't get all three to be correctly referenced and compiled. Here is what I am trying to do:

  1. I have two older .NET class libraries compiled to DLL's. I copied the DLL's into the console app project folder:

z:\Documents\Visual Studio 2015\Projects\[solution1]\console app\FirstFile.dll

z:\Documents\Visual Studio 2015\Projects\[solution1]\console app\SecondFile.dll

  1. My project.json file dependencies section now looks like this:

    "dependencies": {
      "FirstFile": "1.0.0-*",
      "SecondFile": "1.0.0-*"
    }
    

    This works correctly. I can compile, use the classes in the DLLs and all is well.

  2. I next needed to add a reference to an EF project that is in a different solution, and in a different solution folder. In my console solution, I added the EF project from its solution to my console solution using Solution > Add Existing Project. I then added a Project Reference to my console app.

The physical layout on my drive looks like this:

z:\Documents\Visual Studio 2015\Projects\[solution1]\[console app project]

z:\Documents\Visual Studio 2015\Projects\[solution2]\[referenced EF project]

The console app and the EF project both reference the same .NET framework 4.5.1.

After I add the project reference, the dependencies section in the console app project.json file now looks like:

    "dependencies": {
      "FirstFile": "1.0.0-*",
      "EF Project": "1.0.0-*",
      "SecondFile": "1.0.0-*"
    }

I then run dnu restore. It immediately returns error message that it cannot find any of the dependencies:

Unable to locate Dependency FirstFile >= 1.0.0-*

Unable to locate Dependency SecondFile >= 1.0.0-*

Unable to locate Dependency EF Project >= 1.0.0-*

  1. I added a global.json file with the following source option:

    {
      "sources":["","Z:\\Documents\\Visual Studio 2015\\Projects\\solution2\\referenced EF Project"]
    }
    
  2. I re-ran the dun restore, but it has the same three cannot find dependencies errors.

Any suggestions to get this scenario working?

1

1 Answers

0
votes

@@ccampj, you should use bin configuration section, here is how to do:

You can create an project that, instead of compiling, references an already compiled dll and generates a package containing that dll. To do this you use syntax like this:

{
"frameworks" : {
  "dnx451" : {
      "bin" : { "assembly":"<path to dll>", "pdb" :"<path to pdb if needed>" }
   }
}
}