2

Working in VS 2015 Community, I've created a Services class library project, targeted at .NET 4.6. Now, in my main Api project, all references fall under DNX 4.5.1 and DNX Core 5. When I add the reference to Services, I get the compiler error :

Dependency Services >= 1.0.0-* could not be resolved Api C:\Development\Surveys\src\Api\project.json

What do I have to do to make my class library compatible with the Api project?

8
  • Did you migrated Services class library project to DNX 4.5.1 and DNX Core 5 or you tried to use previously compiled dll targeted to .NET 4.6 directly in MVC6 project without migration? Commented Nov 9, 2015 at 8:24
  • All project should be in the same folder. See: stackoverflow.com/questions/33565019/… Commented Nov 9, 2015 at 8:51
  • 2
    Try change the reference "dnx451" to "dnx46". stackoverflow.com/questions/33242352/… or otherwise compile your class library as .net 4.5.1 Commented Nov 9, 2015 at 9:33
  • @Oleg, how would I migrate the project? In Project Properties, I don't have any DNX as a platform to select? Commented Nov 9, 2015 at 12:30
  • @JuergenGutsch How can you point me to an unanswered question, especially where the question is about references not working when they're not in the same folder? Projects having to be in the same folder is a ridiculous solution, as VS should keep folder information when I add a project reference, or if ASP.NET 5 Beta is still buggy, I should be able to add path info to project.json. Anyway, they are all in the same solution folder. Commented Nov 9, 2015 at 12:33

1 Answer 1

2
  1. Both of your projects have to target DNX Core 5 if your main (Api) project supports it
  2. You can't reference .net project that has higher version than source one. So both of your projects should target 4.6

The way you described the problem I'm not sure if Services is normal (let's call it old) Class Library or ASP.NET 5 Class Library. If it is old then your main project can not target core clr. Just remove this TFM from project.json.

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

1 Comment

Different .NET versions on the 2 projects. Doh!

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.