Dnx 4.5.1/Dnx Core 5.0 Ambiguous reference

5.7k views Asked by At

In many projects that I and others I have there is an Ambiguous reference error that pops up if i use an object that is apart of a different asp.net5 project. Funny enough it still compiles and works but there is no intellisense and my code is covered in red lines.

An example of this is I have a Tests project pointing to my MVC project. When i try to create a new instance of XController, it will show an error that it doesnt know which XController to use the DNX 4.5.1 or DNX 5.0. I am aware of what those are but it wont let me choose, even though I feel like I shouldnt. Again, it works, just frustrating.

The only way I can get this to work is if I choose only one framework for my MVC project. I dont like doing this because I want to know if dnxcore50 doesnt support something that I am writing in the MVC app. I tried only using one framework in the unit test project but that did not work.

I want to be clear that I do understand that asp.net 5 stuff is in beta and there are many bugs. I am wondering if this is a a bug or if I am just doing something wrong.

Update 1: It seems the problem only occurs if I have a new Asp.Net 5 Class library referencing a Asp.Net 5 Mvc project. Library to library works and mvc to library also works.

2

There are 2 answers

0
ahammond On BEST ANSWER

After spending some time talking to the guys involved with the Asp.net 5 development team, we've come to the conclusion that this was, in my case certainly, a ReSharper issue.

If you switch off ReSharper the errors disappear.

Thanks

2
Gekctek On

Looks like the solution is to only use one framework when referencing an MVC Project from another project. Seems to be just a bug.