sthewissen / Xamarin.Forms.PancakeView

An extended ContentView for Xamarin.Forms with rounded corners, borders, shadows and more!
MIT License
865 stars 108 forks source link

.NET Core Issues With Latest Version (2.3.0.759) #154

Open Axemasta opened 3 years ago

Axemasta commented 3 years ago

I was doing some routine package updates in my project and noticed upgrading from 2.1.0.714 to 2.3.0.759 causes my unit test project to no longer build.

I've been able to replicate my issue in a fresh project, a blank forms app and a .NET Core 3.1 Unit Test project. If you target the older pancake view version the whole solution builds and the test project runs. If you upgrade to the latest stable version the package restores with warnings and you see the following errors/warnings when building:

/usr/local/share/dotnet/sdk/3.1.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(5,5): 
Error NETSDK1073: 
The FrameworkReference 'Microsoft.WindowsDesktop.App' was not recognized (NETSDK1073) (UnitTestCore.Tests)
Warning NU1701: Package 'OpenTK 3.0.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. 
This package may not be fully compatible with your project. (NU1701) (UnitTestCore.Tests)

Since the change to .NET 5 I have noticed this error in a few places, I have fixed most of the errors by using a global.json pointed to .NET Core 3.1 however the issue persists with this single library. I wonder if the MSBuild.Sdk.Extras version needs to be updated to the latest version (I believe is now 3.0.22).

I have provided the reproduction project, if you swap between the versions you should be able to see the issue PancakeViewBreakUnitTestCore.zip.

AlejandroRuiz commented 3 years ago

Hey theres a workaround for this you can add the next line into your csproj

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>

    <!-- Add This Line -->
    <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>

seems that is something related to the pancakeview dependencies config

Axemasta commented 3 years ago

@AlejandroRuiz Thanks thats the workaround I went with in the end, Figured I'd raise this as an issue anyway since there's some issue with this libraries dependencies 😄