Skip to content

Commit 64012d9

Browse files
committed
Added net6.0-windows compatibility
1 parent 58caa70 commit 64012d9

File tree

7 files changed

+43
-8
lines changed

7 files changed

+43
-8
lines changed

QRCoder.Xaml/QRCoder.Xaml.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- <UseWindowsForms Condition="'$(TargetFramework)' == 'net5.0-windows' or '$(TargetFramework)' == 'net6.0-windows'">true</UseWindowsForms> -->
77
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows' or '$(TargetFramework)' == 'net6.0-windows'">true</UseWPF>
88
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
9+
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
910
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1011
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
1112
</PropertyGroup>

QRCoder/PostscriptQRCode.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0
1+
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS
22
using System;
33
using System.Drawing;
44
using static QRCoder.QRCodeGenerator;
55

66
namespace QRCoder
77
{
8+
9+
#if NET6_0_WINDOWS
10+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
11+
#endif
812
public class PostscriptQRCode : AbstractQRCode, IDisposable
913
{
1014
/// <summary>
@@ -139,6 +143,9 @@ sc sc scale
139143
";
140144
}
141145

146+
#if NET6_0_WINDOWS
147+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
148+
#endif
142149
public static class PostscriptQRCodeHelper
143150
{
144151
public static string GetQRCode(string plainText, int pointsPerModule, string darkColorHex, string lightColorHex, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, bool drawQuietZones = true, bool epsFormat = false)

QRCoder/QRCode.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0
1+
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS
22
using System;
33
using System.Drawing;
44
using System.Drawing.Drawing2D;
55
using static QRCoder.QRCodeGenerator;
66

77
namespace QRCoder
88
{
9+
#if NET6_0_WINDOWS
10+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
11+
#endif
912
public class QRCode : AbstractQRCode, IDisposable
1013
{
1114
/// <summary>
@@ -125,6 +128,9 @@ internal GraphicsPath CreateRoundedRectanglePath(RectangleF rect, int cornerRadi
125128
}
126129
}
127130

131+
#if NET6_0_WINDOWS
132+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
133+
#endif
128134
public static class QRCodeHelper
129135
{
130136
public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color darkColor, Color lightColor, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, Bitmap icon = null, int iconSizePercent = 15, int iconBorderWidth = 0, bool drawQuietZones = true)

QRCoder/QRCoder.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>net35;net40;netstandard1.3;netstandard2.0;net5.0;net5.0-windows;net6.0;net6.0-windows</TargetFrameworks>
55
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
66
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
7+
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
78
<CheckEolTargetFramework>false</CheckEolTargetFramework>
89
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
910
</PropertyGroup>
@@ -45,8 +46,11 @@
4546
</ItemGroup>
4647

4748
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net5.0-windows' ">
48-
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
49+
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
4950
</ItemGroup>
51+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0-windows' ">
52+
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
53+
</ItemGroup>
5054

5155
<PropertyGroup>
5256
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>

QRCoder/SvgQRCode.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0
1+
#if NETFRAMEWORK || NETSTANDARD2_0 || NET5_0 || NET6_0_WINDOWS
22
using QRCoder.Extensions;
33
using System;
44
using System.Collections;
@@ -11,6 +11,9 @@
1111

1212
namespace QRCoder
1313
{
14+
#if NET6_0_WINDOWS
15+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
16+
#endif
1417
public class SvgQRCode : AbstractQRCode, IDisposable
1518
{
1619
/// <summary>
@@ -376,6 +379,9 @@ public enum MediaType : int
376379
}
377380
}
378381

382+
#if NET6_0_WINDOWS
383+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
384+
#endif
379385
public static class SvgQRCodeHelper
380386
{
381387
public static string GetQRCode(string plainText, int pixelsPerModule, string darkColorHex, string lightColorHex, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute, SvgLogo logo = null)

QRCoderConsole/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
namespace QRCoderConsole
1111
{
12+
#if NET6_0_WINDOWS
13+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
14+
#endif
1215
class MainClass
1316
{
1417
public static void Main (string[] args)
@@ -21,6 +24,7 @@ public static void Main (string[] args)
2124

2225
QRCodeGenerator.ECCLevel eccLevel = QRCodeGenerator.ECCLevel.L;
2326
SupportedImageFormat imageFormat = SupportedImageFormat.Png;
27+
2428
int pixelsPerModule = 20;
2529
string foregroundColor = "#000000";
2630
string backgroundColor = "#FFFFFF";
@@ -247,6 +251,9 @@ public QRCodeGenerator.ECCLevel GetECCLevel(string value)
247251
return level;
248252
}
249253

254+
#if NET6_0_WINDOWS
255+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
256+
#endif
250257
public ImageFormat GetImageFormat(string value)
251258
{
252259
switch (value.ToLower())

QRCoderConsole/QRCoderConsole.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;net5.0;net5.0-windows</TargetFrameworks>
5-
<UseWindowsForms Condition="'$(TargetFramework)' == 'net5.0-windows'">true</UseWindowsForms>
6-
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows'">true</UseWPF>
4+
<TargetFrameworks>net45;net5.0;net5.0-windows;net6.0-windows</TargetFrameworks>
5+
<!-- <UseWindowsForms Condition="'$(TargetFramework)' == 'net5.0-windows' or '$(TargetFramework)' == 'net5.0-windows'">true</UseWindowsForms>-->
6+
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows' or '$(TargetFramework)' == 'net6.0-windows'">true</UseWPF>
77
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
8+
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0-windows'">$(DefineConstants);NET6_0_WINDOWS</DefineConstants>
89
<Externalconsole>true</Externalconsole>
910
<OutputType>Exe</OutputType>
1011
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@@ -22,7 +23,10 @@
2223
<Reference Include="WindowsBase" />
2324
</ItemGroup>
2425
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
25-
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
26+
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
27+
</ItemGroup>
28+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0-windows' ">
29+
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
2630
</ItemGroup>
2731
<ItemGroup>
2832
<PackageReference Include="NDesk.Options.Core" Version="1.2.5" />

0 commit comments

Comments
 (0)