0

All I'm trying to do is do what I would normally have done in full Visual Studio -- put code in a child project and reference that project from a parent project.

  1. Install Visual Studio Community Edition for Mac from the Xamarin home page.

  2. Create a Xamarin Forms app and call it MyApp. Choose Android and iOS targets. That gets you a solution with the following projects in it: MyApp MyApp.Droid MyApp.iOS

  3. Right click the solution and say "Add New Project". Choose Multiplatorm -> Portable Library (or anything else). Call it "bob".

  4. See bob in the solution?

  5. How do you add a reference to bob from MyApp?

While we are on this, how do we add a NuGet package reference to MyApp? You can add one to MyApp.Droid, MyApp.iOS and bob (try it -- right click on each project, Add -> Add NuGet Packages

Darn'dest thing isn't it?

NOTE: My first guess was that it's a limitation of the free stuff. Well, that doesn't seem to hold up because you can add references between all the other projects. For all of that to be useful in my case, I need to be able to add a reference to the main one (the one with the App.xaml in it)

101010
  • 14,866
  • 30
  • 95
  • 172
  • if MyApp is a PCL, you can reference other PCL as long as they are the same profile. If MyApp is a Shared Library, then it can't directly reference other projects. – Jason Aug 20 '17 at 22:29
  • Ah, that must be it. The Mac version is probably creating a shared lib. – 101010 Aug 20 '17 at 22:39
  • there should be an option to choose PCL/Shared when you create a XForms project – Jason Aug 20 '17 at 22:48

0 Answers0