Closed rozeboosje closed 5 days ago
I get this as well. It has been around for a while #2223. Using VS2019 16.11.35.
It's, at the very least, annoying. But it also leaves me wondering what I need to distribute in order to ensure that the software works without issues.
Please address this.
Any chance of a response from the Team? Even merely an acknowledgement that the issue has been noted and understood?
Issue still persists in the nuget packages for skiasharp 2.88.8
This is the code that is importing the native reference:
It has a condition that is not ever true on Windows, VS for Windows or WPF. Yet somehow the IDE is seeing it.
It does seem to only happen in the classic projects, so a workaround may be to upgrade to the SDK-style projects.
Sorry can you explain what you mean by "classic" and "SDK-style" projects?
We are using a product called Aspose.Words in a Solution with 84 projects in it. That product has now been changed to include references to SkiaSharp and that's how the nuget packages for SkiaSharp ended up pulled into our Solution. I am not sure that we can justify the amount of work involved in the workaround...
This appears to be a IDE warning, and not a compile warning. So the IDE is doing this all on its own and we have no way to control it. It should not be happening as there is a condition around it that is false. Looking at a binlog, this warning does not exist - and it does not have a code either so we cannot ignore or even do anything.
SDK style projects are the new way to write csproj: https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview
For example, a File | New project will look like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
All the clutter has been removed.
You can also easily update from the old projects to the new project with the .net upgrade assistant: https://dotnet.microsoft.com/en-us/platform/upgrade-assistant
This will not actually upgrade anything with your app, just the csproj format.
Running a test now to confirm...
Okay but this is a years old solution and we're stuck in .NET Framework 4.8 world so a move to .NET Core is not going to happen any time soon.
I had a look at the code you posted, though ... and I think I can see what the problem is.
<ShouldIncludeNativeSkiaSharp Condition=" '$(ShouldIncludeNativeSkiaSharp)' == '' ">True</ShouldIncludeNativeSkiaSharp>
So there is a condition under which the value is set to True, but there is no condition under which the value is set to False, so as far as I can tell from the code snippet, the value could be anything: '', 'george', 'something' or even null.
Similarly, the _AppIsFullMac value is set on the basis of various values != to some values, and again, I bet those values are not the "opposites" you're expecting them to be.
The condition is working as the second part ``'$(_AppIsFullMac)' == 'True' is false. When running a build, there is no warning and there is also all the cases where the checks are running and there are no native references:
Also, switching to SDK-style projects does not mean switching to .net core, you can just convert the xml to the modern format, and keep the same net46/net47/net48 that you already have - and you can mix it up as well.
But again, this is not a build issue - just the IDE/solution explorer bug.
Okay but it pollutes our "Error list" with spurious warnings. We are not in the habit of ignoring warnings as we've been bitten a few times before when an ignored warning led to an actual problem. With all these warnings cluttering the Error List we're risking missing one that DOES require our attention. If it's an IDE bug, where can I report that and ask the makers of Visual Studio to address it?
I even wrapped the whole <NativeReference>
item in a <ItemGroup Condition=" 'cat' == 'dog' ">
and the IDE still sees it.
You can use the VS feedback in the help menu or the
I will try replicate this in a simple project for you to add a code snippet.
Managed to reproduce this with the simplest thing:
<ItemGroup Condition=" 'dog' == 'cat' ">
<NativeReference Include="BadFile.dylib" />
</ItemGroup>
Add that near the end of your csproj and the warning will appear. The condition directly excludes this, yet it is still there in the IDE.
I think I found a hack to fix it:
<ItemGroup Condition=" 'dog' == 'cat' ">
<NativeReference Include="BadFile.dylib" />
</ItemGroup>
<ItemGroup Condition=" 'dog' != 'cat' ">
<NativeReference Remove="BadFile.dylib" />
</ItemGroup>
This is all sorts of wrong, but the IDE seems happier.
Let's see.
Thank you so much for putting effort into this
Description
Created a WPF project targeting .NET Framework 4.8 with no additional code, only nuget references to SkiaSharp 2.88.6 and also when upgrading this to 2.88.7
At first this builds without any errors but if you then save the project and reopen it later the following warning starts appearing in the Error List:
Severity Code Description Project File Line Suppression State Details Warning The referenced component 'C:\Users[*****]\packages\SkiaSharp.NativeAssets.macOS.2.88.7\build\net462....\runtimes\osx\native\libSkiaSharp.dylib' could not be found. Foo
Can something be done about this, please?
Additional information: Version 2.88.7 of SkiaSharp is presented as "Latest stable" in nuget. Also, we don't even use SkiaSharp ourselves; this is included in our project after installing a 3rd party nuget package which depends on SkiaSharp 2.88.6 ... However, even after removing the 3rd party software and leaving only SkiaSharp and its dependencies, the warning persists.
Code
The best way to share code for larger projects is a link to a GitHub repository: https://github.com/user/repo/tree/bug-123
But, you can also share a short block of code here:
You can also share some XAML:
Expected Behavior
Project should simply build without any warnings.
Actual Behavior
Warning is shown.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows
Devices
Laptop
Relevant Screenshots
Relevant Log Output
No response
Code of Conduct