Skip to content

Commit

Permalink
Changed TargetFramework to net6.0, updated the NuGet packages and sma…
Browse files Browse the repository at this point in the history
…ll fixes/code upgrades.
  • Loading branch information
giacomelli committed Sep 3, 2022
1 parent 59adc88 commit c598fa0
Show file tree
Hide file tree
Showing 28 changed files with 51 additions and 57 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 2.6.{build}
os: Visual Studio 2017
os: Visual Studio 2022
configuration: Release
environment:
clone_folder: c:\gs
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.2.108"
"version": "6.0.400"
}
}
10 changes: 7 additions & 3 deletions src/GeneticSharp.Benchmarks/DefaultConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Order;

Expand All @@ -9,10 +10,13 @@ public class DefaultConfig : ManualConfig
{
public DefaultConfig()
{
Set(new DefaultOrderer(SummaryOrderPolicy.Default, MethodOrderPolicy.Alphabetical));
Add(RankColumn.Arabic);

Orderer = new DefaultOrderer(SummaryOrderPolicy.Default, MethodOrderPolicy.Alphabetical);

Add(Job.Core
AddColumn(RankColumn.Arabic);

AddJob(Job.Default
.WithRuntime(CoreRuntime.Core60)
.WithMinIterationCount(15)
.WithMaxIterationCount(100));
}
Expand Down
6 changes: 3 additions & 3 deletions src/GeneticSharp.Benchmarks/GeneticSharp.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x86;osx-x64;linux-x64</RuntimeIdentifiers>
<ReleaseVersion>1.2.0</ReleaseVersion>
Expand All @@ -12,7 +12,7 @@
<ProjectReference Include="..\GeneticSharp.Domain\GeneticSharp.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.3" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions src/GeneticSharp.Domain.UnitTests/GeneticAlgorithmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,17 @@ public void Start_ParallelManyGenerations_Optimization()
target.TaskExecutor = taskExecutor;

Assert.AreEqual(GeneticAlgorithmState.NotStarted, target.State);
Assert.IsFalse(target.IsRunning);
Assert.IsFalse(target.IsRunning, "Should not be running before start");

target.Start();

Assert.AreEqual(GeneticAlgorithmState.TerminationReached, target.State);
Assert.IsFalse(target.IsRunning);
Assert.IsTrue(target.Population.CurrentGeneration.Chromosomes.Count >= 100);
Assert.IsTrue(target.Population.CurrentGeneration.Chromosomes.Count <= 150);
Assert.IsFalse(target.IsRunning, "Should not be running anymore");
Assert.IsTrue(target.Population.CurrentGeneration.Chromosomes.Count >= 100, "Chromosomes shoud be equal or greater than 100");
Assert.IsTrue(target.Population.CurrentGeneration.Chromosomes.Count <= 150, "Chromosomes shoud be equal or less than 150");
Assert.IsNotNull(target.Population.BestChromosome);
Assert.IsTrue(target.Population.BestChromosome.Fitness >= 0.9);
Assert.IsTrue(target.Population.Generations.Count > 0);
Assert.IsTrue(target.Population.BestChromosome.Fitness >= 0.9, $"Fitness should be equal or greater than 0.9, but is {target.Population.BestChromosome.Fitness}");
Assert.IsTrue(target.Population.Generations.Count > 0, "Generations should be greater than 0");
});

FlowAssert.IsAtLeastOneAttemptOk(20, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="..\msbuilds\GeneticSharp.unit-test.targets" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,13 +14,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="2.6.3">
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
<PackageReference Include="nunit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0-preview-20220726-02" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/GeneticSharp.Domain/Crossovers/CrossoverException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ private CrossoverException(SerializationInfo info, StreamingContext context)
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
3 changes: 1 addition & 2 deletions src/GeneticSharp.Domain/Fitnesses/FitnessException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ private FitnessException(SerializationInfo info, StreamingContext context)
/// Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
2 changes: 1 addition & 1 deletion src/GeneticSharp.Domain/GeneticSharp.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\msbuilds\GeneticSharp.common.targets" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>GeneticSharp.Domain</AssemblyName>
</PropertyGroup>
<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/GeneticSharp.Domain/Mutations/MutationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ private MutationException(SerializationInfo info, StreamingContext context)
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
/// </PermissionSet>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ private ReinsertionException(SerializationInfo info, StreamingContext context)
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
3 changes: 1 addition & 2 deletions src/GeneticSharp.Domain/Selections/SelectionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ private SelectionException(SerializationInfo info, StreamingContext context)
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
/// </PermissionSet>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="..\msbuilds\GeneticSharp.unit-test.targets" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,7 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
<PackageReference Include="nunit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Evolve_RandomPermutationsChromosome_VeryEasySudoku_Solved()
var sudoku = SudokuTestHelper.CreateBoard(SudokuTestDifficulty.VeryEasy);

IChromosome chromosome = new SudokuRandomPermutationsChromosome(sudoku,2,3);
var fitness = SudokuTestHelper.Eval(chromosome, sudoku, 50, 0, 10);
var fitness = SudokuTestHelper.Eval(chromosome, sudoku, 50, 0, 100);
Assert.AreEqual( 0, fitness);
}

Expand Down
2 changes: 1 addition & 1 deletion src/GeneticSharp.Extensions/GeneticSharp.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\msbuilds\GeneticSharp.common.targets" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>GeneticSharp.Extensions</AssemblyName>
<AssemblyCompany>Skahal Studios</AssemblyCompany>
<AssemblyProduct>GeneticSharp</AssemblyProduct>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="..\msbuilds\GeneticSharp.unit-test.targets" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +17,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
<PackageReference Include="nunit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\msbuilds\GeneticSharp.dotnet-core.targets" />
<Import Project="..\msbuilds\GeneticSharp.common.targets" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>GeneticSharp.Infrastructure.Framework</AssemblyName>
<PackageId>GeneticSharp.Infrastructure.Framework</PackageId>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
<Import Project="..\msbuilds\GeneticSharp.app.targets" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x86;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
<PackageReference Include="System.Drawing.Common" Version="4.5.0-preview1-26216-02" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NCalc.NetCore" Version="1.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.4.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2-beta2" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="12.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

Expand All @@ -19,10 +19,6 @@
<EmbeddedResource Remove="references\**" />
<None Remove="references\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.5.0-preview1-26216-02" />
</ItemGroup>

<ItemGroup Condition=" '$(OS)' == 'Unix' ">
<Reference Include="atk-sharp">
Expand Down Expand Up @@ -51,7 +47,7 @@
</Reference>
</ItemGroup>

<ItemGroup Condition=" '$(OS)' == 'Windows_NT' ">
<ItemGroup Condition=" '$(OS)' == 'Windows_NT' ">
<Reference Include="atk-sharp">
<HintPath>references\Windows_NT\atk-sharp.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
using GeneticSharp.Extensions.Drawing;
using GeneticSharp.Infrastructure.Framework.Texts;
using Gtk;
using GeneticSharp.Infrastructure.Framework.Commons;
using GeneticSharp.Domain;
using GeneticSharp.Infrastructure.Framework.Threading;
using System.Drawing.Imaging;

namespace GeneticSharp.Runner.GtkApp.Samples
{
Expand Down Expand Up @@ -134,15 +134,15 @@ public override void Draw()

using (var ms = new MemoryStream())
{
var converter = new ImageConverter();

var imageBytes = (byte[])converter.ConvertTo(bitmap, typeof(byte[]));
bitmap.Save(ms, ImageFormat.Png);
var imageBytes = ms.ToArray();
var pb = new Gdk.Pixbuf(imageBytes);
var width = Context.DrawingArea.Width;
var height = Context.DrawingArea.Height;

pb = pb.ScaleSimple(width, height, Gdk.InterpType.Nearest);
buffer.DrawPixbuf(gc, pb, 0, 0, 0, 100, width, height, Gdk.RgbDither.None, 0, 0);
buffer.DrawPixbuf(gc, pb, 0, 0, 0, 100, width, height, Gdk.RgbDither.None, 0, 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Samples/Issue1Sample/Issue1Sample/Issue1Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Import Project="..\..\..\msbuilds\GeneticSharp.app.targets" />

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x86;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Samples/Issue9Sample/Issue9Sample/Issue9Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Import Project="..\..\..\msbuilds\GeneticSharp.app.targets" />

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x86;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/content/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/content/TspBlazorApp/TspBlazorApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/content/TspConsoleApp/TspConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/msbuilds/GeneticSharp.app.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>

0 comments on commit c598fa0

Please sign in to comment.