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

Update to .NET 8.0 #186

Open
wants to merge 3 commits 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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:

steps:

- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Set up .NET 5.0
uses: actions/setup-dotnet@v1
- name: Set up .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x

- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion Controllers/BadgeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task<ActionResult> GetBadgeAsync (string id, string v)

var content = DrawBadge (package);

HttpContext.Response.Headers.Add ("Cache-Control", "max-age=3600");
HttpContext.Response.Headers["Cache-Control"] = "max-age=3600";
var r = Content(content);
r.ContentType = "image/svg+xml";
return r;
Expand Down
4 changes: 2 additions & 2 deletions Data/PackageDependents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PackageDependentsCache : DataCache<string, PackageDependents>
{
public PackageDependentsCache () : base (TimeSpan.FromMinutes (20)) { }

protected override async Task<PackageDependents> GetValueAsync (string lowerId, HttpClient httpClient, CancellationToken token)
protected override Task<PackageDependents> GetValueAsync (string lowerId, HttpClient httpClient, CancellationToken token)
{
//
// ISSUE #155: Diabled due to database corruption.
Expand All @@ -48,7 +48,7 @@ protected override async Task<PackageDependents> GetValueAsync (string lowerId,
//catch (Exception ex) {
// Console.WriteLine (ex);
//}
return deps;
return Task.FromResult(deps);
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions FuGetGallery.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ICSharpCode.Decompiler" Version="3.2.0.3856" />
<PackageReference Include="Mono.Cecil" Version="0.10.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NGraphics" Version="0.6.0-beta1" />
<PackageReference Include="NuGet.Versioning" Version="5.3.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.258-beta" />
<PackageReference Include="System.CodeDom" Version="4.5.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.IO.Pipes.AccessControl" Version="4.5.0" />
<PackageReference Include="System.IO.Ports" Version="4.5.0" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="System.Threading.AccessControl" Version="4.5.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="System.CodeDom" Version="8.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.IO.Pipes.AccessControl" Version="5.0.0" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Security.Permissions" Version="8.0.0" />
<PackageReference Include="System.Threading.AccessControl" Version="8.0.0" />
<PackageReference Include="ListDiff" Version="1.0.7" />
</ItemGroup>
<ItemGroup>
Expand Down
70 changes: 61 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,61 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

Host.CreateDefaultBuilder (args)
.ConfigureWebHostDefaults (webBuilder => {
webBuilder.UseStartup<FuGetGallery.Startup> ();
})
.Build ()
.Run ();
using System;
using System.Net;
using System.Net.Http;
using FuGetGallery;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = WebApplication.CreateBuilder (args);

var services = builder.Services;

try {
new Database ().MigrateAsync ().Wait ();
services.AddScoped<Database, Database> ();
}
catch (Exception dbex) {
Console.WriteLine ($"Failed to open the database: {dbex}");
}
services.AddControllers ();
services.AddRazorPages (options =>
{
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}");
options.Conventions.AddPageRoute ("/packages/badges", "packages/{id}/badges");
options.Conventions.AddPageRoute ("/packages/dependents", "packages/{id}/dependents");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}/{dir}");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}/{dir}/{targetFramework}");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}/{dir}/{targetFramework}/{assemblyName}");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}/{dir}/{targetFramework}/{assemblyName}/{namespace}");
options.Conventions.AddPageRoute ("/packages/details", "packages/{id}/{version}/{dir}/{targetFramework}/{assemblyName}/{namespace}/{typeName}");
});
services.Configure<GzipCompressionProviderOptions> (options => options.Level = System.IO.Compression.CompressionLevel.Optimal);
services.AddResponseCompression ();
services.AddHttpClient ("")
.ConfigurePrimaryHttpMessageHandler (() => new HttpClientHandler {
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
});

var app = builder.Build ();

NugetPackageSources.Configure (app.Configuration);

app.UseResponseCompression ();

if (app.Environment.IsDevelopment ()) {
app.UseDeveloperExceptionPage ();
}
else {
app.UseExceptionHandler ("/error");
}

app.UseStaticFiles ();
app.UseRouting ();

app.MapControllers ();
app.MapRazorPages ();

app.Run ();

74 changes: 0 additions & 74 deletions Startup.cs

This file was deleted.

Loading