Reputation: 2309
I'm having an issue with adding a dll reference to a shared project. As seen in the picture below I have a Universal solution with a project for windows and a project for windows phone.
In the HubApp1.Shared project I need to add a reference for some code in Class.cs. I will be using Class.cs in both the Windows project and the Windows Phone project. I have scoured Bing for how to fix this and I couldn't find anything.
Upvotes: 12
Views: 8064
Reputation: 161
I know this is an old question but I had a similar problem with a shared project. I needed a class in the shared project to use ConfigurationManager and the normal way would be to add a reference to the project, but you can't do that with a shared project.
In my case the solution was so simple it should have been obvious (but I was overthinking it!) - just give the full reference when using the configuration manager - EG:
var someVal = System.Configuration.ConfigurationManager.AppSettings["someKey"];
Not very elegant but simple enough.
Upvotes: 0
Reputation: 1097
You must add the reference in both WP and Windows project.
The reason for this is that shared project is not compiled into any output DLL - it is compiled into the project that references it, so it cannot reference any other project types except other Shared Projects.
Upvotes: 11