Skip to content

Commit

Permalink
Upgrade DLL build to .NET 5
Browse files Browse the repository at this point in the history
  • Loading branch information
DasSkelett committed Nov 11, 2020
1 parent a494e1d commit cd3b5b3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.301'
dotnet-version: '5.0.x'
- name: Restore cache for _build/tools
uses: actions/cache@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions Core/CKAN-core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Choose>
<When Condition="$(Configuration.EndsWith('NetCore'))">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
Expand Down Expand Up @@ -48,7 +48,7 @@
<Reference Include="System" />
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="System.Security.Permissions" Version="4.7.0" />
Expand All @@ -75,4 +75,4 @@
<Exec Command="powershell ../build.ps1 Generate-GlobalAssemblyVersionInfo" Condition="!Exists('../_build/meta/GlobalAssemblyVersionInfo.cs') And '$(OS)' == 'Windows_NT'" />
<Exec Command="sh ../build Generate-GlobalAssemblyVersionInfo" Condition="!Exists('../_build/meta/GlobalAssemblyVersionInfo.cs') And '$(OS)' == 'Unix'" />
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Core/Configuration/JsonConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private void LoadConfig()
// Ensure the directory exists
new FileInfo(configFile).Directory.Create();

#if !NETSTANDARD
#if !NETCOREAPP
// If we are not running on .NET Standard, try to migrate from the real registry
if (Win32RegistryConfiguration.DoesRegistryConfigurationExist())
{
Expand Down
2 changes: 2 additions & 0 deletions Core/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ public static ICollection<T> AsCollection<T>(this IEnumerable<T> source)
return source is ICollection<T> collection ? collection : source.ToArray();
}

#if NET45
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source)
{
if (source == null)
throw new ArgumentNullException(nameof(source));

return new HashSet<T>(source);
}
#endif

public static IEnumerable<T> Memoize<T>(this IEnumerable<T> source)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Core/Relationships/SanityChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void ConflictWithDll()
public void FindUnsatisfiedDepends()
{
var mods = new List<CkanModule>();
var dlls = CKAN.Extensions.EnumerableExtensions.ToHashSet(Enumerable.Empty<string>());
var dlls = Enumerable.Empty<string>().ToHashSet();
var dlc = new Dictionary<string, ModuleVersion>();

Assert.IsEmpty(CKAN.SanityChecker.FindUnsatisfiedDepends(mods, dlls, dlc), "Empty list");
Expand Down
8 changes: 4 additions & 4 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Choose>
<When Condition="$(Configuration.EndsWith('NetCore'))">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
Expand All @@ -29,7 +29,7 @@
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<DefaultItemExcludes>$(DefaultItemExcludes);NetKAN\**;GUI\**</DefaultItemExcludes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug_NetCore' ">
Expand All @@ -56,7 +56,7 @@
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -88,4 +88,4 @@
<Exec Command="powershell ../build.ps1 Generate-GlobalAssemblyVersionInfo" Condition="!Exists('../_build/meta/GlobalAssemblyVersionInfo.cs') And '$(OS)' == 'Windows_NT'" />
<Exec Command="sh ../build Generate-GlobalAssemblyVersionInfo" Condition="!Exists('../_build/meta/GlobalAssemblyVersionInfo.cs') And '$(OS)' == 'Unix'" />
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Text.RegularExpressions;
using Semver;

var buildNetCore = "netcoreapp3.1";
var buildNetCore = "net5.0";
var buildNetFramework = "net45";

var target = Argument<string>("target", "Default");
Expand Down
2 changes: 1 addition & 1 deletion packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.38.4" />
<package id="Cake" version="0.38.5" />
</packages>

0 comments on commit cd3b5b3

Please sign in to comment.