Skiasharp: [BUG] Unit test project no longer finding DLL after upgrade from 1.68.3 -> 2.80

Created on 13 Jul 2020  路  3Comments  路  Source: mono/SkiaSharp

Description

This was all working fine in 1.68
I have Skia in my Core PCL project and an NUnit project for testing that references this.

Previously I had the project properties as follows (as taken from a different issue I saw reported a while back)...

<PropertyGroup>
    <TargetFramework>net461</TargetFramework> 
    <ShouldIncludeNativeSkiaSharp>True</ShouldIncludeNativeSkiaSharp>
    <PreferredNativeSkiaSharp>x86</PreferredNativeSkiaSharp>
</PropertyGroup>

However now my tests which touch the areas of code that have usings to SkiaSharp fail with,

System.DllNotFoundException libSkiaSharp assembly:<unknown assembly> type:<unknown type> member:(null)

I've tried adding direct reference to the SkiaSharp nuget, and removing the ShouldIncludeNativeSkiaSharp and PreferredNativeSkiaSharp properties above in case they were no longer required. Nothing working though.

Any pointers on how to get this NUnit project happy?

Most helpful comment

Hi, Really sorry for going AWOL on this!

Just managed to fix it (i think, will confirm when Azure does a successful remote build!) but the issue was my TargetFramework (thanks mattleibow for the example project!)

I was targetting net461. Changed it to net472 and I think its working now (with package reference added). 馃憤

All 3 comments

@IainS1986 I am not able to reproduce this... I tried in both VS 2019 and via the console runner.

I got a test project: NUnitTestProject1.zip

I had a similar case with android while changing from 1.68.1 to 2.80.1.
Adding the SkiaSharp assemblies to the main or executing project solved it.
In your case, try to add additional SkiaSharp to the NUnit project.

Hi, Really sorry for going AWOL on this!

Just managed to fix it (i think, will confirm when Azure does a successful remote build!) but the issue was my TargetFramework (thanks mattleibow for the example project!)

I was targetting net461. Changed it to net472 and I think its working now (with package reference added). 馃憤

Was this page helpful?
0 / 5 - 0 ratings