Forum Xamarin.Android

How can I reference from my .NET Standard library to my Xamarin App?

Hi, this is my first time using Xamarin (Mono), and I start having problems when I try to reference from my library to my app.

I'm using the latest version of Visual Studio (15.3) and .NET Core (2.0)

  1. File > New Project > Blank App (Android)
  2. Add > New Project > .NET Standard
  3. Edit the Class file:
namespace MeowLibrary
{
    public static class Class1
    {
        public static string Meow()
        {
            return "Meow prr...";
        }
    }
}
  1. Add Reference > Projects > Select my library and Ok
  2. Open the MainActivity.cs and adds some lines:
using MeowLibrary;

But doesn't works, someone can help me? Maybe my Mono version doesn't support it?

Answers

  • batmacibatmaci DEMember ✭✭✭✭✭

    @raky291 I have exactly same problem after converting from PCL to Net Standard project. It doesnt recognize the static class but other classes works. did you find a solution for this?

  • DannyNDannyN USUniversity ✭✭

    I just converted my PCL project to a .net standard library. I have run into the same thing. I can no longer reference objects in the .net standard library anymore. Any solution to this?

  • TyRoesleTyRoesle Member ✭✭

    When I get this error usually deleting bin/obj in each the Android and .NET Standard library folders then rebuilding the app resolves it for me

Sign In or Register to comment.