vitalii-vov / Maui.PDFView

This repository contains a control for .NET MAUI and allows you to display PDF in View
MIT License
27 stars 4 forks source link

net8.0 not compatible makes testing difficult #7

Closed hpathanjaly closed 2 months ago

hpathanjaly commented 3 months ago

I'm pretty new to MAUI so I might have missed something here but since the PdfView is not compatible with net8.0 on its own and xUnit's target framework is net8.0, adding my project as a dependency to the test project led to a bunch of errors wherever the pdf view was mentioned. I had to add preprocessor directives to check whether the program was running on windows, mac, ios, or android and then include the pdf view. this also forced me to add the pdf view element from the code behind. Was there a better way to do this or did i miss something? I have attached images of my workaround image image

nikitaKlymchukGunnebo commented 3 months ago

I have same issue. My test project targets net8.0 in this way: <TargetFramework>net8.0</TargetFramework> and have a reference for my maui project, which also tatgets net8.0, it looks like this:

<TargetFrameworks>net8.0-android</TargetFrameworks>
    <TargetFrameworks>$(TargetFrameworks);net8.0</TargetFrameworks>

You can have a look on how maui community toolkit makes taragetting: https://github.com/CommunityToolkit/Maui/blob/main/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj

You will see that they have $(NetVersion) which will be transformed to net8.0 in our case: <TargetFrameworks>$(NetVersion);$(NetVersion)-android;$(NetVersion)-ios;$(NetVersion)-maccatalyst</TargetFrameworks>

So basically, you need to change csproj to make TargetFrameworks look like this: <TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>

And fix related issues that might appear

vitalii-vov commented 3 months ago

@hpathanjaly @nikitaKlymchukGunnebo Please check version 1.0.5

nikitaKlymchukGunnebo commented 3 months ago

1.0.5 fixed this issue

hpathanjaly commented 3 months ago

image Updated and still showing this wherever I use the package. Am i doing something wrong?

hpathanjaly commented 3 months ago

Just fully uninstalling and reinstalling the package seems to have worked. Ill close the issue after a little more testing. Thank you for the quick responses!