Skip to content

Commit

Permalink
upgrading libraries and removing netstandard from some projects issue…
Browse files Browse the repository at this point in the history
… #130
  • Loading branch information
kdcllc committed Aug 13, 2020
1 parent b4a3e0f commit ef6d5f3
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 208 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ branches:
pull_requests:
do_not_increment_build_number: true
image: Visual Studio 2019
## temporary until 3.1.106 sdk is installed
## temporary until 5.0.100-preview.7.20366.6 sdk is installed
install:
- ps: $urlCurrent = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.301/dotnet-sdk-3.1.301-win-x64.zip"
- ps: $urlCurrent = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/5.0.100-preview.7.20366.6/dotnet-sdk-5.0.100-preview.7.20366.6-win-x64.zip"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
- ps: $tempFileCurrent = [System.IO.Path]::GetTempFileName()
Expand Down
37 changes: 16 additions & 21 deletions build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,15 @@
</PropertyGroup>

<PropertyGroup>
<AspNetCoreVersion>2.2</AspNetCoreVersion>
<EFCommonVersion>2.2</EFCommonVersion>
<ExtensionsVersion>2.2</ExtensionsVersion>
<AspNetCoreVersion>3.1.7</AspNetCoreVersion>
<EFCommonVersion>3.1.7</EFCommonVersion>
<ExtensionsVersion>3.1.7</ExtensionsVersion>
<MLCommon>1.5.1</MLCommon>
<SwashbuckleCommon>5.5.1</SwashbuckleCommon>
<MicrosoftAzureStorageCommon>11.1.7</MicrosoftAzureStorageCommon>
<MicrosoftAzureStorageCommon>11.2.0</MicrosoftAzureStorageCommon>
<MicrosoftAzureManagementCommon>1.34.0</MicrosoftAzureManagementCommon>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2' Or '$(TargetFramework)' == 'netstandard2.0'">
<AspNetCoreVersion>2.2.0</AspNetCoreVersion>
<EFCommonVersion>2.2.0</EFCommonVersion>
<ExtensionsVersion>2.2.0</ExtensionsVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'netstandard2.1'">
<AspNetCoreVersion>3.1.6</AspNetCoreVersion>
<EFCommonVersion>3.1.6</EFCommonVersion>
<ExtensionsVersion>3.1.6</ExtensionsVersion>
</PropertyGroup>

<ItemGroup Label="Microsoft.AspNetCore Sample Applications" Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Update="Microsoft.ApplicationInsights.AspNetCore" Version="2.14.0" />
<PackageReference Update="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="$(EFCommonVersion)" />
Expand Down Expand Up @@ -61,6 +49,7 @@
</ItemGroup>

<ItemGroup Label="Microsoft.Extensions.Configuration">
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.CommandLine" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.UserSecrets" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(ExtensionsVersion)" />
Expand Down Expand Up @@ -99,20 +88,26 @@
<PackageReference Update="Microsoft.Azure.Management.AppService.Fluent" Version="$(MicrosoftAzureManagementCommon)" />
<PackageReference Update="Microsoft.Azure.Management.Dns.Fluent" Version="$(MicrosoftAzureManagementCommon)" />
<PackageReference Update="Microsoft.Azure.Management.Fluent" Version="$(MicrosoftAzureManagementCommon)" />
<PackageReference Update="Microsoft.Identity.Client" Version="4.16.1" />
<PackageReference Update="Microsoft.Identity.Client" Version="4.17.1" />
</ItemGroup>

<ItemGroup Label="Microsoft.FeatureManagement">
<PackageReference Update="Azure.Identity" Version="1.2.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="3.0.2" />
<PackageReference Update="Microsoft.FeatureManagement" Version="2.0.0" />
</ItemGroup>

<ItemGroup Label="Unit Tests">
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Update="Moq" Version="4.14.5" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Update="coverlet.collector" Version="1.3.0" />
</ItemGroup>

<ItemGroup Label="Serilog">
<PackageReference Update="Serilog" Version="2.9.0" />
<PackageReference Update="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Update="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Update="Serilog.Extensions.Hosting" Version="3.1.0" />
<PackageReference Update="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Update="Serilog.Settings.Configuration" Version="3.1.0" />
Expand Down Expand Up @@ -142,7 +137,7 @@
<PackageReference Update="Polly" Version="7.2.1" />
<PackageReference Update="CronScheduler.AspNetCore" Version="3.0.0" />
<PackageReference Update="CronScheduler.Extensions" Version="3.0.0" />
<PackageReference Update="Microsoft.IO.RecyclableMemoryStream" Version="1.3.4" />
<PackageReference Update="Microsoft.IO.RecyclableMemoryStream" Version="1.3.5" />
<PackageReference Update="System.Threading.Channels" Version="4.7.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion build/settings.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup Label="Basic Settings">
<VersionPrefix>3.1.6-preview1</VersionPrefix>
<VersionPrefix>3.1.7-preview1</VersionPrefix>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<NoWarn>$(NoWarn);CA2208;</NoWarn>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CA2208;SA1011;</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Bet.Extensions.AzureStorage/StorageBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public sealed class StorageBlob<TOptions> : IStorageBlob<TOptions>

foreach (var item in segment.Results)
{
if (item is CloudBlockBlob && item != null)
if (item is CloudBlockBlob blob && item != null)
{
result.Add((CloudBlockBlob)item);
result.Add(blob);
}
}
}
Expand Down
49 changes: 3 additions & 46 deletions src/Bet.Extensions.AzureVault/AzureVaultKeyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ public static class AzureVaultKeyBuilder
string hostingEnviromentName,
bool usePrefix = true,
int tokenAuthRetry = 2,
#if NETSTANDARD2_0
string sectionName = "AzureVault")
#elif NETSTANDARD2_1
string sectionName = "AzureVault",
TimeSpan? reloadInterval = null)
#endif
{
var config = builder.Build();
var options = config.Bind<AzureVaultOptions>(sectionName);
Expand All @@ -74,21 +70,9 @@ public static class AzureVaultKeyBuilder
KeyVaultClient Kv() => new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));

var keyVaultClient = policy.Execute(Kv);
#if NETSTANDARD2_0
// load values that are not specific to the environment.
builder.AddAzureKeyVault(options?.BaseUrl, keyVaultClient, new PrefixExcludingKeyVaultSecretManager());

if (!string.IsNullOrEmpty(prefix))
{
builder.AddAzureKeyVault(options?.BaseUrl, keyVaultClient, new PrefixKeyVaultSecretManager(prefix));
}
else
{
builder.AddAzureKeyVault(options?.BaseUrl, keyVaultClient, new DefaultKeyVaultSecretManager());
}
#elif NETSTANDARD2_1
// load values that are not specific to the environment.
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options.BaseUrl)
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options?.BaseUrl)
{
Client = keyVaultClient,
Manager = new PrefixExcludingKeyVaultSecretManager(),
Expand All @@ -97,7 +81,7 @@ public static class AzureVaultKeyBuilder

if (!string.IsNullOrEmpty(prefix))
{
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options.BaseUrl)
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options?.BaseUrl)
{
Client = keyVaultClient,
Manager = new PrefixKeyVaultSecretManager(prefix),
Expand All @@ -106,14 +90,13 @@ public static class AzureVaultKeyBuilder
}
else
{
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options.BaseUrl)
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options?.BaseUrl)
{
Client = keyVaultClient,
Manager = new DefaultKeyVaultSecretManager(),
ReloadInterval = reloadInterval,
});
}
#endif

return builder.Build();
}
Expand All @@ -135,19 +118,7 @@ public static class AzureVaultKeyBuilder
&& !string.IsNullOrWhiteSpace(options?.ClientSecret))
{
var secret = options?.ClientSecret.FromBase64String();
#if NETSTANDARD2_0
// load values that are not specific to the environment.
builder.AddAzureKeyVault(options?.BaseUrl, options?.ClientId, secret, new PrefixExcludingKeyVaultSecretManager());

if (!string.IsNullOrEmpty(prefix))
{
builder.AddAzureKeyVault(options?.BaseUrl, options?.ClientId, secret, new PrefixKeyVaultSecretManager(prefix));
}
else
{
builder.AddAzureKeyVault(options?.BaseUrl, options?.ClientId, secret, new DefaultKeyVaultSecretManager());
}
#elif NETSTANDARD2_1
// load values that are not specific to the environment.
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(options?.BaseUrl, options?.ClientId, secret)
{
Expand All @@ -171,7 +142,6 @@ public static class AzureVaultKeyBuilder
ReloadInterval = reloadInterval
});
}
#endif
}

return builder.Build();
Expand All @@ -190,12 +160,8 @@ public static class AzureVaultKeyBuilder
this IConfigurationBuilder builder,
string keyVaultEndpoints,
bool usePrefix = true,
#if NETSTANDARD2_0
string? hostingEnviromentName = null)
#elif NETSTANDARD2_1
string? hostingEnviromentName = null,
TimeSpan? reloadInterval = null)
#endif
{
if (!string.IsNullOrEmpty(keyVaultEndpoints))
{
Expand All @@ -212,14 +178,6 @@ public static class AzureVaultKeyBuilder

foreach (var splitEndpoint in keyVaultEndpoints.Split(';'))
{
#if NETSTANDARD2_0
builder.AddAzureKeyVault(splitEndpoint, keyVaultClient, new PrefixExcludingKeyVaultSecretManager());

if (!string.IsNullOrEmpty(prefix))
{
builder.AddAzureKeyVault(splitEndpoint, keyVaultClient, new PrefixKeyVaultSecretManager(prefix));
}
#elif NETSTANDARD2_1
builder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions(splitEndpoint)
{
Client = keyVaultClient,
Expand All @@ -236,7 +194,6 @@ public static class AzureVaultKeyBuilder
ReloadInterval = reloadInterval
});
}
#endif
}
}

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Microsoft.Azure.Services.AppAuthentication;

#if NETSTANDARD2_1
using Microsoft.Azure.Storage;
using Microsoft.Azure.Storage.Auth;
using Microsoft.Azure.Storage.Blob;
#endif

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

#if NETSTANDARD2_0
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
#endif

namespace Bet.Extensions.DataProtection.AzureStorage
{
public class KeyManagementOptionsSetup : IPostConfigureOptions<KeyManagementOptions>
Expand All @@ -44,11 +36,7 @@ public void PostConfigure(string name, KeyManagementOptions options)
var cloudBlobContainer = CreateCloudBlobContainer(_dataProtectionOptions.Value, cloudStorageAccount).GetAwaiter().GetResult();
var blob = cloudBlobContainer.GetBlockBlobReference(_dataProtectionOptions.Value.KeyBlobName);

#if NETSTANDARD2_0
options.XmlRepository = new AzureBlobXmlRepository(() => blob);
#elif NETSTANDARD2_1
options.XmlRepository = new AzureBlobXmlRepository(() => blob);
#endif
}

private async Task<NewTokenAndFrequency> TokenRenewerAsync(object state, CancellationToken cancellationToken)
Expand Down Expand Up @@ -157,11 +145,9 @@ private async Task<(AppAuthenticationResult result, TimeSpan ticks)> GetToken(ob
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();

var cloudBlobContainer = cloudBlobClient.GetContainerReference(options.ContainerName);
#if NETSTANDARD2_1

var created = await cloudBlobContainer.CreateIfNotExistsAsync(cancellationToken);
#elif NETSTANDARD2_0
var created = await cloudBlobContainer.CreateIfNotExistsAsync();
#endif

if (created)
{
_logger.LogInformation("[Azure Blob][DataProtection] No Azure Blob [{blobName}] found - so one was auto created.", options.ContainerName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<Description>The Data Protection Azure Based Libaray for AspNetCore and GenericHost.</Description>
<PackageTags>aspnetcore, dotnetcore ,logging ,serilog ,extensions</PackageTags>
<Description>The Data Protection Azure Based Library for AspNetCore and GenericHost.</Description>
<PackageTags>AspNetCore, DotNetCore ,Data Protection</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.KeyVault" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureKeyVault" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" />
<PackageReference Include="Microsoft.Azure.KeyVault" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Bet.Extensions.Options\Bet.Extensions.Options.csproj" />
<ProjectReference Include="..\Bet.Extensions\Bet.Extensions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@ namespace Bet.Extensions.HealthChecks.SigtermCheck
{
public class SigtermHealthCheck : IHealthCheck
{
#if NETCOREAPP3_1 || NETSTANDARD2_1
private readonly IHostApplicationLifetime _applicationLifetime;

public SigtermHealthCheck(IHostApplicationLifetime applicationLifetime)
{
_applicationLifetime = applicationLifetime;
}
#else
private readonly IApplicationLifetime _applicationLifetime;

public SigtermHealthCheck(IApplicationLifetime applicationLifetime)
{
_applicationLifetime = applicationLifetime;
}
#endif

public Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context,
Expand Down
2 changes: 1 addition & 1 deletion src/Bet.Extensions.Hosting/Bet.Extensions.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Loading

0 comments on commit ef6d5f3

Please sign in to comment.