eestein
eestein

Reputation: 5114

Cannot access DLL inside Shared Project

I have a Xamarin.Forms Shared project. I need to add a reference to System.Net.Http and after some research I found out it should be done via the regular right click -> select assembly (at every regular project), done that. But now, if I go to any class on my shared project and try to use that DLL I can't (see image)

enter image description here

What am I doing wrong?

I've added the reference to every other project (iOS, Android and WinPhone) but can't access it on my Shared Project classes.

EDIT

After much try-and-error I figured it out... I have 3 projects (iOS, Android AND WP8.1).

I was able to add System.Net.Http to iOS and Android projects but when I tried to do that at the WP project I got a message saying all needed DLLs were already in the SDK (how presumptuous!).

Anyway, I decided to unload WP project and it worked =/

So the problem now is: How can I add that DLL to the WP project, since I want to support it, but I NEED System.Net.Http?

Thanks.

Upvotes: 0

Views: 412

Answers (2)

eestein
eestein

Reputation: 5114

Well, I figured it out.

The way I solved it was by unloading the WP project and reloading it. Perfect, it worked =)

After reloading the project I checked the .NET for Windows Phone reference and System.Net.Http is indeed there. Maybe this was just a cache thing, I don't know.

All I know is unloading the project and reloading it did the trick.

Upvotes: 0

tequila slammer
tequila slammer

Reputation: 2881

You can not add a reference to a project type of SharedProject. Instead you have to add this reference to the project you referenced the SharedProject to.

Consider the following:

You have a solution with a console project and a - lets call it core project - as a SharedProject.

Your console project references core. If you now want to use System.Net.WebClient you have to add the reference to System.Net to the console project.

Upvotes: 0

Related Questions