From 410649952099a90db71021877da44306c1d1c603 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 6 May 2020 15:53:01 -0500 Subject: [PATCH] Remove usage of PlatformAbstractions (#192) * Remove unnecessary using The PlatformAbstractions library is going to be removed from dotnet/runtime. Contributes to https://github.com/dotnet/runtime/issues/3470 * Change ApplicationBasePath to AppContext.BaseDirectory --- src/NugetSymbolServer/Startup.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/NugetSymbolServer/Startup.cs b/src/NugetSymbolServer/Startup.cs index 702f89d3..5c65ac20 100644 --- a/src/NugetSymbolServer/Startup.cs +++ b/src/NugetSymbolServer/Startup.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.DotNet.PlatformAbstractions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -17,7 +16,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host { Configuration = new ConfigurationBuilder() - .SetBasePath(ApplicationEnvironment.ApplicationBasePath) + .SetBasePath(AppContext.BaseDirectory) .Add(hostProvidedConfiguration) .AddJsonFile("config.json", optional: hostingEnvironment.IsDevelopment()) .AddJsonFile($"config.{hostingEnvironment.EnvironmentName}.json", optional: true) @@ -28,7 +27,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host LoggingConfiguration = new ConfigurationBuilder() - .SetBasePath(ApplicationEnvironment.ApplicationBasePath) + .SetBasePath(AppContext.BaseDirectory) .AddJsonFile("logging.json", optional: true) .AddJsonFile($"logging.{hostingEnvironment.EnvironmentName}.json", optional: true) .AddEnvironmentVariables() @@ -52,7 +51,7 @@ public void ConfigureServices(IServiceCollection services) throw new Exception("No configuration specified for FileCache:CachePath"); } cachePath = Environment.ExpandEnvironmentVariables(cachePath); - options.RootPath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, cachePath); + options.RootPath = Path.Combine(AppContext.BaseDirectory, cachePath); }) .Configure(options => { @@ -62,7 +61,7 @@ public void ConfigureServices(IServiceCollection services) throw new Exception("No configuration specified for PackageSource:SourcePath"); } sourcePath = Environment.ExpandEnvironmentVariables(sourcePath); - options.SourcePath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, sourcePath); + options.SourcePath = Path.Combine(AppContext.BaseDirectory, sourcePath); }) .AddSingleton() .AddSingleton() @@ -88,4 +87,4 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) app.UseStaticFiles(); } } -} \ No newline at end of file +}