Skip to content

Use SkiaSharp to support SvgQRCode in .NET6 #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 72 additions & 55 deletions QRCoder/QRCoder.csproj
Original file line number Diff line number Diff line change
@@ -1,63 +1,80 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net40;netstandard1.3;netstandard2.0;net5.0;net5.0-windows;net6.0;net6.0-windows</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn />
</PropertyGroup>

<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageId>QRCoder</PackageId>
<Version>1.4.3</Version>
<Authors>Raffael Herrmann</Authors>
<PackageOwners>Raffael Herrmann</PackageOwners>
<AssemblyName>QRCoder</AssemblyName>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/codebude/QRCoder/</PackageProjectUrl>
<PackageIcon>nuget-icon.png</PackageIcon>
<PackageReadmeFile>nuget-readme.md</PackageReadmeFile>
<PackageTags>c# csharp qr qrcoder qrcode qr-generator qr-code-generator</PackageTags>
<RepositoryUrl>https://github.com/codebude/QRCoder.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>QRCoder is a simple library, written in C#.NET, which enables you to create QR codes.</Description>
</PropertyGroup>

<ItemGroup>
<None Include="Assets\nuget-icon.png" Pack="true" PackagePath="\" />
<None Include="Assets\nuget-readme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35' or '$(TargetFramework)' == 'net40' ">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' or '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net5.0-windows' ">
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>net35;net40;netstandard1.3;netstandard2.0;net5.0;net5.0-windows;net6.0;net6.0-windows</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn />
</PropertyGroup>

<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageId>QRCoder</PackageId>
<Version>1.4.3</Version>
<Authors>Raffael Herrmann</Authors>
<PackageOwners>Raffael Herrmann</PackageOwners>
<AssemblyName>QRCoder</AssemblyName>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/codebude/QRCoder/</PackageProjectUrl>
<PackageIcon>nuget-icon.png</PackageIcon>
<PackageReadmeFile>nuget-readme.md</PackageReadmeFile>
<PackageTags>c# csharp qr qrcoder qrcode qr-generator qr-code-generator</PackageTags>
<RepositoryUrl>https://github.com/codebude/QRCoder.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>QRCoder is a simple library, written in C#.NET, which enables you to create QR codes.</Description>
</PropertyGroup>

<ItemGroup>
<None Include="Assets\nuget-icon.png" Pack="true" PackagePath="\" />
<None Include="Assets\nuget-readme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35' or '$(TargetFramework)' == 'net40' ">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' or '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net5.0-windows' ">
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0-windows' ">
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="SkiaSharp">
<Version>2.88.3</Version>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
<PackageReference Include="SkiaSharp">
<Version>2.88.3</Version>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="SkiaSharp">
<Version>2.88.3</Version>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageSharp 3.0.1 has a conditionally commercial license, can this be a problem?
https://github.com/SixLabors/ImageSharp/blob/v3.0.1/LICENSE

Copy link
Author

@JimmyPun610 JimmyPun610 Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting question, I am not an expert about this but below is my thought

For my understanding, QRCoder is a open source package under MIT license, which is able to apply apache license.
For developer using QRCoder, ImageSharp is serve as Transitive Package so it may also apply apache license.

  Works in Source or Object form are licensed to You under the Apache License, Version 2.0 if.

   - You are consuming the Work in for use in software licensed under an Open Source or Source Available license.
   - You are consuming the Work as a Transitive Package Dependency.
   - You are consuming the Work as a Direct Package Dependency in the capacity of a For-profit company/individual with
     less than 1M USD annual gross revenue.
   - You are consuming the Work as a Direct Package Dependency in the capacity of a Non-profit organization
     or Registered Charity.

   For all other scenarios, Works in Source or Object form are licensed to You under the Six Labors Commercial License
   which may be purchased by visiting https://sixlabors.com/pricing/.

Copy link

@AntonKorn AntonKorn Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guy in medium says that if the dependency depends on something with the license that isn't compliant it is a reason to worry https://medium.com/@vovabilonenko/licenses-of-npm-dependencies-bacaa00c8c65. So, the commercial project won't be able to safely use QRCoder with this dependency. Probably it will be good to move the potentially dangerous dependency to the separate package. Or to downgrade image sharp to 2.*, because it is under apache 2.0. Probably it is something that maintainers will decide

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be a concern, I just committed another one that remove ImageSharp and use SkiaSharp only.

</ItemGroup>


<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>

</Project>
Loading