From 4f040be236f15b5d92410ca15b321f36c823fb46 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 6 Feb 2023 21:43:18 +0000 Subject: [PATCH] net6.0 --- .vscode/launch.json | 2 +- .vscode/tasks.json | 3 +- src/isn.abst/isn.abst.csproj | 4 +- src/isn/isn.csproj | 2 +- src/isnd/Controllers/NewUpdateController.cs | 2 +- src/isnd/Controllers/Packages/Catalog.cs | 14 +--- src/isnd/Controllers/Packages/Put.cs | 2 +- src/isnd/Data/Catalog/RegistrationPage.cs | 5 +- .../Data/Catalog/RegistrationPageIndex.cs | 15 +++- src/isnd/Interfaces/IPackageManager.cs | 6 +- src/isnd/Services/PackageManager.cs | 77 ++++++++++--------- .../RegistrationPageIndexQueryAndResult.cs | 0 src/isnd/Startup.cs | 23 +++--- src/isnd/isnd.csproj | 38 ++++----- test/isn.tests/isn.tests.csproj | 3 +- test/isnd.tests/UnitTestWebHost.cs | 36 +++++++-- test/isnd.tests/WebServerFixture.cs | 8 +- test/isnd.tests/isnd.tests.csproj | 3 +- 18 files changed, 144 insertions(+), 99 deletions(-) rename src/isnd/{Controllers/Packages => Services}/RegistrationPageIndexQueryAndResult.cs (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json index dcae1d6..b5a0c5f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -32,7 +32,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/src/isnd/bin/Debug/netcoreapp2.1/isnd.dll", + "program": "${workspaceFolder}/src/isnd/bin/Debug/net6.0/isnd.dll", "args": [], "cwd": "${workspaceFolder}/src/isnd", "stopAtEntry": false, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 64c3e0c..b56fe83 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,8 +21,7 @@ "build", "/p:Configuration=Debug", "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary", - "--ignore-failed-sources" + "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" }, diff --git a/src/isn.abst/isn.abst.csproj b/src/isn.abst/isn.abst.csproj index e679d19..a2a2986 100644 --- a/src/isn.abst/isn.abst.csproj +++ b/src/isn.abst/isn.abst.csproj @@ -2,7 +2,7 @@ 1.0.1 1.0.7 - net451; net472; net4.8; netcoreapp2.1 + net6.0 NETSDK1138 1.0.7.0 1.0.7.0 @@ -10,6 +10,6 @@ - + \ No newline at end of file diff --git a/src/isn/isn.csproj b/src/isn/isn.csproj index 4476947..b5aa589 100644 --- a/src/isn/isn.csproj +++ b/src/isn/isn.csproj @@ -1,7 +1,7 @@  Exe - netcoreapp2.1 + net6.0 nuget_cli 45b74c62-05bc-4603-95b4-3e80ae2fdf50 1.0.7 diff --git a/src/isnd/Controllers/NewUpdateController.cs b/src/isnd/Controllers/NewUpdateController.cs index 219f43a..045b1b0 100644 --- a/src/isnd/Controllers/NewUpdateController.cs +++ b/src/isnd/Controllers/NewUpdateController.cs @@ -10,7 +10,7 @@ namespace isnd.Controllers public class NewUpdateController : Controller { [Authorize(Policy = IsndConstants.RequireAdminPolicyName)] - public IActionResult NewRelease(NewReleaseInfo version) + public IActionResult NewRelease(NewReleaseInfo release) { throw new NotImplementedException("web hook"); } diff --git a/src/isnd/Controllers/Packages/Catalog.cs b/src/isnd/Controllers/Packages/Catalog.cs index d795d04..be7f754 100644 --- a/src/isnd/Controllers/Packages/Catalog.cs +++ b/src/isnd/Controllers/Packages/Catalog.cs @@ -12,20 +12,14 @@ namespace isnd.Controllers { // https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning [HttpGet(_pkgRootPrefix + ApiConfig.Catalog)] - public IActionResult CatalogIndex() + public async Task CatalogIndex() { - return Ok(PackageManager.CurrentCatalogIndex); + return Ok(await packageManager.GetCatalogIndexAsync()); } - [HttpGet(_pkgRootPrefix + ApiConfig.CatalogPage + "-{id}")] - public IActionResult Index(string id) - { - // https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning - return Ok(PackageManager.CurrentCatalogPages[int.Parse(id)]); - } [HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")] - public IActionResult CatalogRegistration(string apiVersion, string id, string lower) + public async Task CatalogRegistration(string apiVersion, string id, string lower) { if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase)) { @@ -34,7 +28,7 @@ namespace isnd.Controllers Query = id, Prerelease = true }; - var index = packageManager.GetPackageRegistrationIndex(query); + var index = await packageManager.GetPackageRegistrationIndexAsync(query); if (index == null) return NotFound(); // query.TotalHits = result.Items.Select(i=>i.Items.Length).Aggregate((a,b)=>a+b); return Ok(index); diff --git a/src/isnd/Controllers/Packages/Put.cs b/src/isnd/Controllers/Packages/Put.cs index 8d09d26..7f502fe 100644 --- a/src/isnd/Controllers/Packages/Put.cs +++ b/src/isnd/Controllers/Packages/Put.cs @@ -178,7 +178,7 @@ namespace isnd.Controllers } await dbContext.SaveChangesAsync(); - packageManager.ÛpdateCatalogFor(commit); + packageManager.ÛpdateCatalogForAsync(commit); logger.LogInformation($"new paquet : {spec.Name}"); } diff --git a/src/isnd/Data/Catalog/RegistrationPage.cs b/src/isnd/Data/Catalog/RegistrationPage.cs index cb9e23d..a12db3d 100644 --- a/src/isnd/Data/Catalog/RegistrationPage.cs +++ b/src/isnd/Data/Catalog/RegistrationPage.cs @@ -47,7 +47,7 @@ namespace isnd.Data.Catalog NuGetVersion upper = new NuGetVersion(0,0,0); // Assert.True(items.All(p=>p.Id == id)); - + long commitMax = 0; foreach (var p in items) { if (upper < p.NugetVersion) upper = p.NugetVersion; @@ -57,8 +57,11 @@ namespace isnd.Data.Catalog foreach (var p in items) { if (lower > p.NugetVersion) lower = p.NugetVersion; + if (p.CommitNId>commitMax) commitMax = p.CommitNId; } Lower = lower.ToFullString(); + Count = items.Count; + CommitId = commitMax.ToString(); } /// diff --git a/src/isnd/Data/Catalog/RegistrationPageIndex.cs b/src/isnd/Data/Catalog/RegistrationPageIndex.cs index 2e58a17..eb4b55a 100644 --- a/src/isnd/Data/Catalog/RegistrationPageIndex.cs +++ b/src/isnd/Data/Catalog/RegistrationPageIndex.cs @@ -12,6 +12,7 @@ namespace isnd.Data.Catalog /// /// [JsonProperty("@id")] + [JsonRequired] public string Id { get; protected set; } public RegistrationPageIndex() @@ -21,7 +22,9 @@ namespace isnd.Data.Catalog public RegistrationPageIndex(string bid, string id, string dlBase, IEnumerable pkgs) { + Items = new List(); + long cnid = 0; var pkgsGroups = pkgs.GroupBy(l => l.Id); // Pour tous les groupes par Id foreach (var gsp in pkgsGroups) @@ -32,13 +35,23 @@ namespace isnd.Data.Catalog foreach(var l in pkgsbi.Select(p => p.Versions)) { versions.AddRange(l); + foreach (var pv in l) + { + if (pv.CommitNId> cnid) + { + cnid = pv.CommitNId; + } + } } Items.Add(new RegistrationPage(bid, gsp.Key, dlBase, versions)); } + CommitId = cnid.ToString(); + Id = bid + $"/{id}/index.json"; + Count = Items.Count; } [JsonProperty("count")] - public int Count { get => Items?.Count ?? 0; } + public int Count { get ; private set; } [JsonProperty("items")] public List Items { get; set; } diff --git a/src/isnd/Interfaces/IPackageManager.cs b/src/isnd/Interfaces/IPackageManager.cs index 4d74ef2..834c9bc 100644 --- a/src/isnd/Interfaces/IPackageManager.cs +++ b/src/isnd/Interfaces/IPackageManager.cs @@ -20,15 +20,15 @@ namespace isnd.Interfaces string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25); IEnumerable GetResources(IUnleash unleashĈlient); - void ÛpdateCatalogFor(Commit commit); + Task ÛpdateCatalogForAsync(Commit commit); Task DeletePackageAsync(string pkgid, string version, string type); Task UserAskForPackageDeletionAsync(string userid, string pkgId, string lower, string type); Task GetPackageAsync(string pkgid, string version, string type); IEnumerable GetCatalogLeaf(string pkgId, string version, string pkgType); IEnumerable SearchById(string pkgId, string semver, string pkgType); - RegistrationPageIndex GetCatalogIndex(); - RegistrationPageIndex GetPackageRegistrationIndex(RegistrationPageIndexQuery query); + Task GetCatalogIndexAsync(); + Task GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query); Task SearchPackageAsync(RegistrationPageIndexQuery query); } diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index 6bd0d1e..cd1ef4f 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -31,7 +31,6 @@ namespace isnd.Services this.dbContext = dbContext; isndSettings = siteConfigOptionsOptions.Value; extUrl = isndSettings.ExternalUrl + "/"; - CurrentCatalogIndex = GetCatalogIndex(); } public IEnumerable GetResources(IUnleash unleashClient) @@ -55,9 +54,9 @@ namespace isnd.Services { Id = extUrl + ApiConfig.GetPackage, Type = "PackageBaseAddress/3.0.0", - Comment = "Package Base Address service" + Comment = @"Package Base Address service - Base URL of where NuGet packages are stored, in the format https:///nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg" }); - if (unleashClient.IsEnabled("pkg-autocomplete", true)) + if (unleashClient.IsEnabled("pkg-autocomplete", false)) res.Add( new Resource { @@ -65,7 +64,7 @@ namespace isnd.Services Type = "SearchAutocompleteService/" + BASE_API_LEVEL, Comment = "Auto complete service" }); - if (unleashClient.IsEnabled("pkg-search", true)) + if (unleashClient.IsEnabled("pkg-search", false)) res.Add( new Resource { @@ -73,7 +72,7 @@ namespace isnd.Services Type = "SearchQueryService/" + BASE_API_LEVEL, Comment = "Search Query service" }); - if (unleashClient.IsEnabled("pkg-catalog", true)) + if (unleashClient.IsEnabled("pkg-catalog", false)) res.Add( new Resource { @@ -86,7 +85,7 @@ namespace isnd.Services res.Add( new Resource { - Id = extUrl + "v" + BASE_API_LEVEL + "/" + ApiConfig.Registration, + Id = extUrl + "v3.0.0/" + ApiConfig.Registration, Type = "RegistrationsBaseUrl", Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages." }); @@ -161,32 +160,27 @@ namespace isnd.Services .Skip(skip).Take(take).ToArray(); } - public static RegistrationPageIndex CurrentCatalogIndex { get; protected set; } - public static List CurrentCatalogPages { get; protected set; } + public string CatalogBaseUrl => extUrl; private IsndSettings isndSettings; private string extUrl; - public virtual RegistrationPageIndex GetCatalogIndex() + public virtual async TaskGetCatalogIndexAsync() { - if (CurrentCatalogIndex == null) - { - ÛpdateCatalogFor(); - } - return CurrentCatalogIndex; + return await ÛpdateCatalogForAsync(null); } - public void ÛpdateCatalogFor(Commit reason = null) + + public async Task ÛpdateCatalogForAsync(Commit reason = null) { int i = 0; - var oldIndex = CurrentCatalogIndex; - var oldPages = CurrentCatalogPages; + string baseid = extUrl + ApiConfig.Catalog; string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}"; string basepageid = extUrl + ApiConfig.CatalogPage; - CurrentCatalogIndex = new RegistrationPageIndex(); - CurrentCatalogPages = new List(); + RegistrationPageIndex CurrentCatalogIndex = new RegistrationPageIndex(); + List CurrentCatalogPages = new List(); var scope = dbContext.Commits.OrderBy(c => c.TimeStamp); @@ -210,13 +204,12 @@ namespace isnd.Services CurrentCatalogIndex.Items.Add(pageRef); i = 0; } - var validPkgs = dbContext.Packages + var validPkgs = dbContext.Packages .Include(po => po.Owner) .Include(pkg => pkg.Versions) .Include(pkg => pkg.LatestVersion) - .Where( - pkg => pkg.Versions.Count(v => v.CommitId == commit.CommitId) > 0 - ).GroupBy((q) => q.Id); + .ToList() + .GroupBy((q) => q.Id); // pkg.Versions.OrderByDescending(vi => vi.CommitNId).First().FullString foreach (var pkgid in validPkgs) { @@ -251,6 +244,7 @@ namespace isnd.Services // From a fresh db CurrentCatalogIndex.CommitId = "none"; } + return CurrentCatalogIndex; } public async Task DeletePackageAsync(string pkgid, string version, string type) @@ -273,7 +267,7 @@ namespace isnd.Services } dbContext.PackageVersions.Remove(pkg); await dbContext.SaveChangesAsync(); - ÛpdateCatalogFor(commit); + await ÛpdateCatalogForAsync(commit); return new PackageDeletionReport { Deleted = true, DeletedVersion = pkg }; } @@ -330,13 +324,11 @@ namespace isnd.Services && (pkgType == null || pkgType == v.Type)); } - public RegistrationPageIndex GetPackageRegistrationIndex(RegistrationPageIndexQuery query) + public async Task GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query) { // RegistrationPageIndexAndQuery - var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner) - .Where(p => p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase) - && (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)) - && p.Versions.Count() > 0); + var scope = (await dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner) + .ToListAsync()) .Where(p => MatchingExact(p, query)); var total = scope.Count(); var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray(); string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}"; @@ -346,17 +338,30 @@ namespace isnd.Services public async Task SearchPackageAsync(RegistrationPageIndexQuery query) { string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}"; - // RegistrationPageIndexAndQuery + if (query.Query == null) query.Query = ""; - var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner) - .Where(p => p.Id.StartsWith(query.Query, StringComparison.InvariantCultureIgnoreCase) - && (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease))) - .Where(p => p.Versions.Count>0); - var total = await scope.CountAsync(); - var pkgs = await scope.Skip(query.Skip).Take(query.Take).ToArrayAsync(); + var scope = (await dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner) + .ToListAsync()) + .Where(p => Matching(p,query)) + ; + var total = scope.Count(); + var pkgs = scope.Skip(query.Skip).Take(query.Take); return new RegistrationPageIndex(bid, query.Query, extUrl, pkgs); } + + private static bool MatchingExact(Package p, RegistrationPageIndexQuery query) + { + return + p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase) + && (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)); + } + + private static bool Matching(Package p, RegistrationPageIndexQuery query) + { + return p.Id.StartsWith(query.Query, StringComparison.InvariantCultureIgnoreCase) + && (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)); + } } } \ No newline at end of file diff --git a/src/isnd/Controllers/Packages/RegistrationPageIndexQueryAndResult.cs b/src/isnd/Services/RegistrationPageIndexQueryAndResult.cs similarity index 100% rename from src/isnd/Controllers/Packages/RegistrationPageIndexQueryAndResult.cs rename to src/isnd/Services/RegistrationPageIndexQueryAndResult.cs diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index c5a26c2..bf4e1cd 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -20,12 +20,13 @@ using Microsoft.IdentityModel.Tokens; using System; using Microsoft.OpenApi.Models; using System.IO; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; namespace isnd { public class Startup { - public static string ExternalAddress { get; internal set; } public Startup(IConfiguration config) { @@ -57,7 +58,7 @@ namespace isnd .AddDefaultUI() .AddDefaultTokenProviders(); - services.AddMvc(); + services.AddMvc(o=>o.EnableEndpointRouting = false); services.AddDataProtection(); @@ -90,12 +91,14 @@ namespace isnd services.AddAuthentication("Bearer") .AddJwtBearer("Bearer", options => { - options.Authority = ExternalAddress; + options.Authority = isndSettingsconf.GetValue("ExternalUrl"); options.TokenValidationParameters = new TokenValidationParameters { ValidateAudience = false }; }); + services.AddControllersWithViews(); + services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo @@ -122,8 +125,9 @@ namespace isnd // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, - Microsoft.AspNetCore.Hosting.IHostingEnvironment env, - ApplicationDbContext dbContext) + IWebHostEnvironment env, + ApplicationDbContext dbContext, + IOptions isnSettingsOption ) { if (env.IsDevelopment()) { @@ -139,12 +143,9 @@ namespace isnd app.UseHsts(); dbContext.Database.Migrate(); } - app.UseStatusCodePages().UseStaticFiles().UseAuthentication().UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}"); - }); + app.UseStatusCodePages().UseStaticFiles().UseAuthentication(); + app.UseMvcWithDefaultRoute(); + } } } diff --git a/src/isnd/isnd.csproj b/src/isnd/isnd.csproj index ab5902c..e5566fc 100644 --- a/src/isnd/isnd.csproj +++ b/src/isnd/isnd.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + net6.0 85fd766d-5d23-4476-aed1-463b2942e86a true WTFPL @@ -11,34 +11,36 @@ 1.0.7 true + - - - - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + - - - - All - - + + - - - - diff --git a/test/isn.tests/isn.tests.csproj b/test/isn.tests/isn.tests.csproj index 2b69678..2e1dce0 100644 --- a/test/isn.tests/isn.tests.csproj +++ b/test/isn.tests/isn.tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + net6.0 false NETSDK1138 1.0.7.0 @@ -18,6 +18,7 @@ + \ No newline at end of file diff --git a/test/isnd.tests/UnitTestWebHost.cs b/test/isnd.tests/UnitTestWebHost.cs index 88cc721..e2d446b 100644 --- a/test/isnd.tests/UnitTestWebHost.cs +++ b/test/isnd.tests/UnitTestWebHost.cs @@ -11,9 +11,13 @@ using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.Extensions.Configuration; using isnd.tests; +using NuGet.Protocol; +using NuGet.Configuration; +using System.Threading.Tasks; +using NuGet.Protocol.Core.Types; namespace isnd.host.tests -{ +{ [Collection("Web server collection")] public class UnitTestWebHost : IClassFixture { @@ -29,7 +33,6 @@ namespace isnd.host.tests using (var serviceScope = server.Host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; - var isnSettings = services.GetRequiredService>().Value; var myDependency = services.GetRequiredService(); myDependency.Database.Migrate(); } @@ -42,8 +45,6 @@ namespace isnd.host.tests using (var serviceScope = server.Host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; - - var isnSettings = services.GetRequiredService>().Value; var dbContext = services.GetRequiredService(); var paul = dbContext.Users.FirstOrDefaultAsync(u => u.Email == "paul@pschneider.fr").Result; if (paul!=null) @@ -56,18 +57,41 @@ namespace isnd.host.tests [Fact] - public void NugetInstallsTest() { + using (var serviceScope = server.Host.Services.CreateScope()) + { var isnSettings = serviceScope.ServiceProvider.GetService>().Value; + string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json"; ProcessStartInfo psi = new ProcessStartInfo("nuget"); psi.ArgumentList.Add("install"); psi.ArgumentList.Add("gitversion"); psi.ArgumentList.Add("-PreRelease"); psi.ArgumentList.Add("-Source"); - psi.ArgumentList.Add("http://localhost:5000"); + psi.ArgumentList.Add(pkgSourceUrl); Process p = Process.Start(psi); p.WaitForExit(); Assert.True(p.ExitCode == 0, "nuget install failed!"); + } + } + + [Fact] + public void TestRegistrationV3Resource() + { + using (var serviceScope = server.Host.Services.CreateScope()) + { var isnSettings = serviceScope.ServiceProvider.GetService>().Value; + string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json"; + NullThrottle throttle = new NullThrottle(); + + PackageSource packageSource = new PackageSource(pkgSourceUrl); + HttpSource client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle); + NuGet.Protocol.RegistrationResourceV3 res = new NuGet.Protocol.RegistrationResourceV3(client , + new Uri(isnSettings.ExternalUrl + "/v3.4.0//registration")); + } + } + + private Task PkgSourceMessageHandler() + { + throw new NotImplementedException(); } } } diff --git a/test/isnd.tests/WebServerFixture.cs b/test/isnd.tests/WebServerFixture.cs index cc13169..b45be22 100644 --- a/test/isnd.tests/WebServerFixture.cs +++ b/test/isnd.tests/WebServerFixture.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Hosting.Server.Features; @@ -15,6 +16,8 @@ namespace isnd.tests public class WebServerFixture : IDisposable { public IWebHost Host { get; private set;} + public List Addresses { get; private set; } = new List(); + public WebServerFixture() { SetupHost(); @@ -31,8 +34,7 @@ namespace isnd.tests var webhostBuilder = new WebHostBuilder() .UseKestrel() .UseIISIntegration() - .UseContentRoot("../../../../../src/isnd" - ) + // .UseContentRoot("../../../../../src/isnd") .UseStartup(typeof(Startup)) .ConfigureAppConfiguration((builderContext, config) => { @@ -48,12 +50,14 @@ namespace isnd.tests void PrintAddresses(IServiceProvider services) { + Addresses.Clear(); Console.WriteLine("Checking addresses..."); var server = services.GetRequiredService(); var addressFeature = server.Features.Get(); foreach (var address in addressFeature.Addresses) { Console.WriteLine("Listing on address: " + address); + Addresses.Add(address); } } } diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj index 21554b4..8b40d77 100644 --- a/test/isnd.tests/isnd.tests.csproj +++ b/test/isnd.tests/isnd.tests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + net6.0 false d7144e46-4e63-4391-ba86-64b61f6e7be4 NETSDK1138 @@ -17,7 +17,6 @@ -