4

I have an ASP.Net 5 project in which I wish to reference a number of .Net class libraries. However, I've had a lot of issues doing this successfully.

My project directory looks something like this:

WebProject
  NetLibrary1
  NetLibrary2
  NetLibrary3
  src
    Web Project Code
  wrap
    DevExpress.Data.v14.1
      project.json
    .
    .
    NetLibrary1
      project.json

The wrap folder contains a folder for each DLL that is referenced in the web project, and inside each one of those folders is a project.json file that I guess "wraps" the DLL into a faked Nuget package for the vNext project to consume.

My problem is that I seem unable to successfully wrap 2 of my NetLibrary projects so that my vNext project can reference them. I attempt to add the references by right-clicking and it puts the Project names in my Web's project.json file in the following manner:

"frameworks": {
"dnx451": {
  "dependencies": {
    "NetLibrary1": "1.0.0-*",
    "NetLibrary2": "1.0.0-*"
  }
 }
}

But then when it tries to restore the packages it says: "Unable to locate NetLibrary1 >= 1.0.0-*".

I'm incredibly frustrated having to deal with bleeding-edge technology like this and I'm looking for a clear method to fix my reference woes.

Thanks for any responses!

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
khrave
  • 173
  • 1
  • 9
  • 3
    "I'm incredibly frustrated having to deal with bleeding-edge technology like this and I'm looking for a clear method to fix my reference woes." Then why are you using it? ASP.NET 5 isn't even out of beta yet. If you're frustrated by things in motion, then probably a good idea to steer clear of them until they're released, bugs are fixed, and code is documented. – mason Oct 02 '15 at 22:14
  • If not using it was an option, I wouldn't be using it. – khrave Oct 05 '15 at 14:12
  • Are you using Visual Studio 2015? – mason Oct 05 '15 at 14:13
  • Yes, but I found a solution for now at least. Thanks for looking at this. – khrave Oct 05 '15 at 14:20

2 Answers2

1

You want to add old class library Foo.csproj to Bar.xproj as reference. It can be done without uploading packages in Beta8 but it is not simple as it should be.

  1. Go too Foo.csproj folder, type: dnv wrap Foo.csproj.
  2. You should now have some files generated, for me it was Foo/wrap/Foo/project.json. Go to your solution in Visual Studio, Add -> Existing project -> project.json.
  3. Now you have some more files, including Foo.xproj which is available in Visual Studio solution, but it does not build.
  4. Open cmd in Foo dir and execute dnv restore.
  5. After 4) completes with no error and Foo.xproj can be built you can now go to Bar.xproj and add Foo.xproj as reference.
  6. Open cmd in Bar directory and execute dnv restore.
  7. You can now build Bar.xproj

I really hope that this will be easier in final version.

watbywbarif
  • 6,487
  • 8
  • 50
  • 64
0

I found the answer to my question in JimmyD's response in this link

Issue Adding Reference to Class library project

The actual marked response in that question wasn't working but fortunately browsing to the project DLL in the actual file structure did.

Community
  • 1
  • 1
khrave
  • 173
  • 1
  • 9