2

So it sounds like a trivial task, I just want to use common code from my class library in both my web api and webapp but I am unable to reference the class library from my webapp projects, so I made a clean project to test it out.
I have 3 projects:ClassLib1, ClassLib2, WebApp I am able to reference ClassLib1 From ClassLib2 but I cannot referance either Class librarys from the webapp project Here are my project.json's

ClassLib1

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
    }
  }
}

ClassLib2 is exactly the same as ClassLib1

Web App

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "ClassLib1": "1.0.0-*"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

SS showing using ClassLib1 in ClassLib2 successfully

enter image description here

SS showing error in webapp when trying to use ClassLib1

enter image description here

The error when moused over is `cannot resolve symbol 'ClassFromLib1'

Edit: I just noticed that if I change the web app to use netstandard1.5 from netcoreapp1.0 I can then referance code between the projects. Should I do this? are there any downside by changing the framework in targeting?

1 Answer 1

1

So I figured out that the issue I was having was with Resharper. It was making the text red and giving me the errors, it did actually build and work fine but I just didn't see past the red text.

Sign up to request clarification or add additional context in comments.

1 Comment

I experience the exact same behavior. Everything builds fine, but even if I disable the R# extension, the editor cannot properly resolve symbols defined by class libraries. Navigating to the symbol under the cursor does not work either...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.