4

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.

Gekctek
  • 1,161
  • 2
  • 12
  • 23
  • This definitely sounds like a smoking gun. Every time you build the project will be compiled for the full .NET framework (.NET 4.6) and for .NET Execution Core which is cross platform and cloud optimized. As a suggestion try deleting the packages folder and have it automatically restored on next build. – Fanie Reynders Jun 16 '15 at 22:35
  • Tried deleting all unnecessary files and starting fresh. Seems like specifically a Visual Studio thing rather than my source code but I could be wrong. – Gekctek Jun 17 '15 at 00:53
  • You can eliminate that assumption by trying it with Visual Studio Code https://code.visualstudio.com. Follow an example here https://code.visualstudio.com/Docs/ASPnet5 – Fanie Reynders Jun 17 '15 at 06:18
  • What version of .NET are you targeting in the project.json files in all your projects? – Fanie Reynders Jun 17 '15 at 06:20
  • I ran visual studio code and it seems to work fine with it in the editor unlike full Visual Studio. I am going to just assume it is a bug and report it. – Gekctek Jun 17 '15 at 15:20
  • I am using the following frameworks: dnx451 and dnxcore50 – Gekctek Jun 17 '15 at 15:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/80793/discussion-between-fanie-reynders-and-gekctek). – Fanie Reynders Jun 17 '15 at 15:24

2 Answers2

5

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

ahammond
  • 325
  • 4
  • 13
0

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

Gekctek
  • 1,161
  • 2
  • 12
  • 23