Skip to content
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

Upgrade to .net6 #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions NetBarcode/Barcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,16 +621,16 @@ private Image GenerateImage()
}

float labelHeight = 0F, labelWidth = 0F;
TextOptions labelTextOptions = null;
RichTextOptions labelTextOptions = null;

if (_showLabel)
{
labelTextOptions = new TextOptions(GetEffeciveFont())
labelTextOptions = new RichTextOptions(GetEffeciveFont())
{
Dpi = 200,
};

var labelSize = TextMeasurer.Measure(_data, labelTextOptions);
var labelSize = TextMeasurer.MeasureAdvance(_data, labelTextOptions);
labelHeight = labelSize.Height;
labelWidth = labelSize.Width;
}
Expand Down Expand Up @@ -670,7 +670,7 @@ private Image GenerateImage()
imageContext.BackgroundColor(_backgroundColor);

//lines are fBarWidth wide so draw the appropriate color line vertically
var pen = new Pen(_foregroundColor, iBarWidth / iBarWidthModifier);
var pen = new SolidPen(_foregroundColor, iBarWidth / iBarWidthModifier);
var drawingOptions = new DrawingOptions
{
GraphicsOptions = new GraphicsOptions
Expand All @@ -684,7 +684,7 @@ private Image GenerateImage()
{
if (_encodedData[pos] == '1')
{
imageContext.DrawLines(drawingOptions, pen,
imageContext.DrawLine(drawingOptions, pen,
new PointF(pos * iBarWidth + shiftAdjustment + halfBarWidth, 0),
new PointF(pos * iBarWidth + shiftAdjustment + halfBarWidth, _height - labelHeight)
);
Expand Down
10 changes: 5 additions & 5 deletions NetBarcode/NetBarcode.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>net6.0</TargetFrameworks>
Copy link

@Bogatinov Bogatinov Apr 18, 2024

Choose a reason for hiding this comment

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

this breaks .NET Framework compatibility
https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0

Possible to use netstandard2.0 while also supporting the new SixLabors libs?

Choose a reason for hiding this comment

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

Hi @Bogatinov , Thanks for comment, I will check netstandard2.0 is supporting the new SixLabors libs or not and do a necessary update on it.

Copy link

@Bogatinov Bogatinov Apr 26, 2024

Choose a reason for hiding this comment

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

Hi @tommyliew-machines I checked it out

  • SixLabors.Fonts 1.0.1 works on netstandard2.0, but 2.0.0 is net6.0 dependent
  • SixLabors.ImageSharp.Drawing 1.0.0 works on netstandard2.0, but 2.0.0 is net6.0 dependent
  • SixLabors.ImageSharp 2.1.8 is the last version that allows netstandard2.0

I can open a PR and update the libraries

  • SixLabors.Fonts 1.0.1
  • SixLabors.ImageSharp.Drawing 1.0.0
  • SixLabors.ImageSharp 2.1.8
  • and any methods that are different between Beta version

Then we can do 2 changes

  • my PR to offer a small bump in v1.7.1.1, which is still compliant with netstandard2.0
  • this PR to offer update to v2.0.0 which will break net48 compatibility = if Author is okay with that decision

<PackageProjectUrl>https://github.com/Tagliatti/NetBarcode</PackageProjectUrl>
<PackageTags>barcode</PackageTags>
<PackageIconUrl>https://i.imgur.com/BhcO3DF.jpg</PackageIconUrl>
Expand All @@ -10,14 +10,14 @@
<Authors>Filipe Tagliatti</Authors>
<Company />
<Product />
<Description>Barcode generation library written in .NET Core compatible with .NET Standard 2.</Description>
<Description>Barcode generation library written in .NET Core compatible with .NET 6.</Description>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='AnyCPU'">
<DocumentationFile>bin\$(Configuration)\netstandard2.0\NetBarcode.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta17" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.1" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.6" />

Choose a reason for hiding this comment

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

conflict with #44 changes

<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions NetBarcode/Properties/PublishProfiles/FolderProfile net6.0.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>AnyCPU</LastUsedPlatform>
<publishUrl>../../Release/SDK/NetBarcode</publishUrl>
<DeleteExistingFiles>false</DeleteExistingFiles>
<TargetFramework>net6.0</TargetFramework>
<SelfContained>false</SelfContained>
<_IsPortable>true</_IsPortable>
</PropertyGroup>
</Project>