Giter Club home page Giter Club logo

Comments (17)

mattleibow avatar mattleibow commented on June 9, 2024 2

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.

from skiasharp.

lbras avatar lbras commented on June 9, 2024

I get this as well. It has been around for a while #2223. Using VS2019 16.11.35.

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

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.

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

Any chance of a response from the Team? Even merely an acknowledgement that the issue has been noted and understood?

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

Issue still persists in the nuget packages for skiasharp 2.88.8

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

This is the code that is importing the native reference:

https://github.com/mono/SkiaSharp/blob/release/2.x/binding/SkiaSharp/nuget/build/net462/SkiaSharp.targets#L11-L16

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.

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

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...

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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.

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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.

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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...

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

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.

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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:

image

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.

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

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?

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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
image

I will try replicate this in a simple project for you to add a code snippet.

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

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.

from skiasharp.

mattleibow avatar mattleibow commented on June 9, 2024

Let's see.

from skiasharp.

rozeboosje avatar rozeboosje commented on June 9, 2024

Thank you so much for putting effort into this

from skiasharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.