Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# UWP - Can't add reference to project in same solution

I need to write a UI for an API utility that I need to use. I have created a new Universal Windows App for the UI, added the API utility project to the solution and now need to reference the API utility from the UWP project - but I just get 'Unable to add a reference to project 'XXX'.

If I create a Windows Forms Application or a console project and add that to the solution, I can do the referencing, no probs.

What is it about UWP that I don't understand?

like image 257
Dave Tapson Avatar asked Mar 27 '16 18:03

Dave Tapson


1 Answers

In the project that you are trying to reference, make sure the TargetFrameworks moniker doesn't contain .NET Core or .NET Framework.

  1. Right mouse button click on the project you are referencing.
  2. Edit Project File
  3. Find <TargetFrameworks>
  4. Remove the targets you don't need. For UWP you may leave only the .NET Standard 2.0 target:
<TargetFrameworks>netstandard2.0</TargetFrameworks>
like image 136
Artemious Avatar answered Oct 01 '22 15:10

Artemious