bobwki
bobwki

Reputation: 944

How can I use Acr.Userdialogs in a Xamarin.Forms UWP shared code project? Or any XF UWP project

I have a project that until now has been XF (4.8) with iOS only. It started many years ago as a "shared code" project. I've been using Acr.Userdialogs successfully in iOS.

Now I need UWP. I've made good progress in half a day. But as soon as a pop-up would pop-up I get exception

"[Acr.UserDialogs] This is the bait library, not the platform library.  You must install the nuget package in your main executable/application project"

Many answers say to make sure I add the nuget to both the platform and the main project, but that is not how shared code projects are organized. It's a bit late to change to another orientation now.

I feel I'm missing something obvious. I looked for an "Init()" method, but it does not seem to exist. All I did was add the nuget in. Is there anything more I shoud add? Any line of code I need in App.xaml.cs

ADDITIONAL NOTE: I just tried an empty project fresh from VS2022, and it is Xamarin.Forms 5.0. I added Acr.Userdialogs to all projects. I got SAME RESULT. Code is simple enough:

private void Button_Clicked(object sender, EventArgs e)
{
    UserDialogs.Instance.Alert("hi");
}

Does Acr.Userdialogs will work with UWP?

Upvotes: 2

Views: 953

Answers (1)

amirali
amirali

Reputation: 54

Change the target version of your UWP application to windows 10, 19041.

Upvotes: 3

Related Questions