Skip to content

Commit

Permalink
Update to ASP.NET Core 3.1 (#446)
Browse files Browse the repository at this point in the history
Updates BaGet to ASP.NET Core 3.1. This is based off @MarkZither's work (see #443). Thank you for all the help @MarkZither!

Part of #439
  • Loading branch information
loic-sharma authored Jan 22, 2020
1 parent 8f2facb commit df8a805
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .azure/pipelines/ci-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
vmImage: vs2017-win2016
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK 3.0.X'
displayName: 'Use .NET Core SDK 3.1.X'
inputs:
version: 3.0.x
version: 3.1.x

- task: Npm@1
displayName: Install frontend dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/BaGet.Aws/BaGet.Aws.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet;Amazon;Cloud</PackageTags>
<Description>The libraries to host BaGet on AWS.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/BaGet.Azure/BaGet.Azure.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet;Azure;Cloud</PackageTags>
<Description>The libraries to host BaGet on Azure.</Description>
Expand Down
3 changes: 2 additions & 1 deletion src/BaGet.Core.Server/BaGet.Core.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>BaGet's NuGet server implementation</Description>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/BaGet.Core/BaGet.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>The core libraries that power BaGet.</Description>
</PropertyGroup>

Expand Down
6 changes: 4 additions & 2 deletions src/BaGet.Core/Entities/AbstractContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ private void BuildPackageEntity(EntityTypeBuilder<Package> package)
.HasMaxLength(MaxPackageVersionLength);

package.Property(p => p.Authors)
.HasMaxLength(DefaultMaxStringLength)
.HasConversion(StringArrayToJsonConverter.Instance)
.HasMaxLength(DefaultMaxStringLength);
.Metadata.SetValueComparer(StringArrayComparer.Instance);

package.Property(p => p.IconUrl)
.HasConversion(UriToStringConverter.Instance)
Expand All @@ -84,8 +85,9 @@ private void BuildPackageEntity(EntityTypeBuilder<Package> package)
.HasMaxLength(DefaultMaxStringLength);

package.Property(p => p.Tags)
.HasMaxLength(DefaultMaxStringLength)
.HasConversion(StringArrayToJsonConverter.Instance)
.HasMaxLength(DefaultMaxStringLength);
.Metadata.SetValueComparer(StringArrayComparer.Instance);

package.Property(p => p.Description).HasMaxLength(DefaultMaxStringLength);
package.Property(p => p.Language).HasMaxLength(MaxPackageLanguageLength);
Expand Down
19 changes: 19 additions & 0 deletions src/BaGet.Core/Entities/Converters/StringArrayComparer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore.ChangeTracking;

namespace BaGet.Core
{
public class StringArrayComparer : ValueComparer<string[]>
{
public static readonly StringArrayComparer Instance = new StringArrayComparer();

public StringArrayComparer()
: base(
(c1, c2) => c1.SequenceEqual(c2),
c => c.Aggregate(0, (a, v) => HashCode.Combine(a, v.GetHashCode())),
c => c.ToArray())
{
}
}
}
7 changes: 5 additions & 2 deletions src/BaGet.Database.MySql/BaGet.Database.MySql.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>The libraries to host BaGet on MySQL.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.0" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>The libraries to host BaGet on PostgreSQL.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/BaGet.Database.SqlServer/BaGet.Database.SqlServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>The libraries to host BaGet on SQL Server.</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/BaGet.Database.Sqlite/BaGet.Database.Sqlite.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet</PackageTags>
<Description>The libraries to host BaGet on SQLite.</Description>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>

<PackageTags>NuGet;Google;Cloud</PackageTags>
<Description>The libraries to host BaGet on the Google Cloud Platform.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/BaGet.Protocol/BaGet.Protocol.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NuGet.Protocol" Version="$(NuGetPackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="4.5.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BaGet/BaGet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>

<SpaRoot>..\BaGet.UI\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

<!-- NuGet dependencies shared across projects -->
<PropertyGroup>
<MicrosoftAspNetCorePackageVersion>3.0.2</MicrosoftAspNetCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>3.0.2</MicrosoftEntityFrameworkCorePackageVersion>
<MicrosoftExtensionsPackageVersion>3.0.2</MicrosoftExtensionsPackageVersion>
<MicrosoftAspNetCorePackageVersion>3.1.1</MicrosoftAspNetCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>3.1.1</MicrosoftEntityFrameworkCorePackageVersion>
<MicrosoftExtensionsPackageVersion>3.1.1</MicrosoftExtensionsPackageVersion>
<NuGetPackageVersion>5.0.0-rtm.5856</NuGetPackageVersion>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions tests/BaGet.Core.Tests/BaGet.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/BaGet.Protocol.Tests/BaGet.Protocol.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/BaGet.Tests/BaGet.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit df8a805

Please sign in to comment.