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 projects targeting net6 to net8 - part 2 #9018

Merged
merged 2 commits into from
Sep 20, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.159.1-preview" />
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<VersionPrefix>0.2.0</VersionPrefix>

<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private async Task SendDownstreamResponse(HttpResponse response, UpstreamRespons
response.StatusCode = upstreamResponse.StatusCode;
foreach (var header in upstreamResponse.Headers)
{
response.Headers.Add(header.Key, header.Value);
response.Headers.Append(header.Key, header.Value);
}

_logger.LogInformation("Started writing response body, {actualLength}", contentBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackAsTool>True</PackAsTool>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<OutputType>Exe</OutputType>
<PackAsTool>true</PackAsTool>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<PackAsTool>true</PackAsTool>
<ToolCommandName>pipeline-generator</ToolCommandName>
Expand Down
3 changes: 1 addition & 2 deletions tools/pixel-server/PixelServer/PixelServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ApplicationInsightsResourceId>/subscriptions/a18897a6-7e44-457d-9260-f2854c0aca42/resourcegroups/sdk-bi-data/providers/microsoft.insights/components/azure-sdk-bi</ApplicationInsightsResourceId>
<ApplicationInsightsAnnotationResourceId>/subscriptions/a18897a6-7e44-457d-9260-f2854c0aca42/resourcegroups/sdk-bi-data/providers/microsoft.insights/components/azure-sdk-bi</ApplicationInsightsAnnotationResourceId>
<UserSecretsId>317bfab0-0fc1-4048-b61e-67e8f96c2b3a</UserSecretsId>
Expand All @@ -13,7 +13,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
</ItemGroup>

Expand Down
7 changes: 4 additions & 3 deletions tools/pixel-server/PixelServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -10,6 +10,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Hosting;

namespace PixelServer
{
Expand All @@ -27,11 +28,11 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddMemoryCache();
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvcCore();
services.AddMvcCore(options => options.EnableEndpointRouting = false);
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>

<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.ResourceManager.Authorization" Version="1.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected override async Task HandleCommandAsync(ILogger logger, RotationConfigu
bool onlyRotateExpiring = invocationContext.ParseResult.GetValueForOption(this.expiringOption);
bool whatIf = invocationContext.ParseResult.GetValueForOption(this.whatIfOption);

var timeProvider = new TimeProvider();
var timeProvider = TimeProvider.System;

IEnumerable<RotationPlan> plans = rotationConfiguration.GetAllRotationPlans(logger, timeProvider);
bool success = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public StatusCommand() : base("status", "Show secret rotation status")
protected override async Task HandleCommandAsync(ILogger logger, RotationConfiguration rotationConfiguration,
InvocationContext invocationContext)
{
var timeProvider = new TimeProvider();
var timeProvider = TimeProvider.System;
RotationPlan[] plans = rotationConfiguration.GetAllRotationPlans(logger, timeProvider).ToArray();

logger.LogInformation($"Getting status for {plans.Length} plans");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Core" Version="1.40.0" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Azure.Sdk.Tools.SecretRotation.Core\Azure.Sdk.Tools.SecretRotation.Core.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task ExecuteAsync(bool onlyRotateExpiring, bool whatIf)
using IDisposable? loggingScope = this.logger.BeginScope(operationId);
this.logger.LogInformation("\nProcessing rotation plan '{PlanName}'", Name);

DateTimeOffset shouldRotateDate = this.timeProvider.GetCurrentDateTimeOffset().Add(RotationThreshold);
DateTimeOffset shouldRotateDate = this.timeProvider.GetUtcNow().Add(RotationThreshold);

this.logger.LogInformation("Getting current state of plan");

Expand Down Expand Up @@ -88,7 +88,7 @@ public async Task<RotationPlanStatus> GetStatusAsync()
{
try
{
DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();

SecretState primaryStoreState = await PrimaryStore.GetCurrentStateAsync();

Expand All @@ -106,9 +106,9 @@ public async Task<RotationPlanStatus> GetStatusAsync()

SecretState[] allStates = secondaryStoreStates.Prepend(primaryStoreState).ToArray();

DateTimeOffset rotationThresholdDate = this.timeProvider.GetCurrentDateTimeOffset().Add(RotationThreshold);
DateTimeOffset rotationThresholdDate = this.timeProvider.GetUtcNow().Add(RotationThreshold);

DateTimeOffset warningThresholdDate = this.timeProvider.GetCurrentDateTimeOffset().Add(WarningThreshold);
DateTimeOffset warningThresholdDate = this.timeProvider.GetUtcNow().Add(WarningThreshold);

DateTimeOffset? minExpirationDate = allStates
.Where(x => x.ExpirationDate.HasValue)
Expand Down Expand Up @@ -159,7 +159,7 @@ private async Task RotateAsync(string operationId, SecretState currentState, boo
* A user can combine origin and primary only when origin can be marked as complete in some way (e.g. Key Vault Certificates can be tagged)
*/

DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();

SecretValue newValue = await OriginateNewValueAsync(operationId, invocationTime, currentState, whatIf);
// TODO: some providers will issue secrets for longer than we requested. Should we propagate the real expiration date, or the desired expiration date?
Expand Down Expand Up @@ -244,7 +244,7 @@ private async Task<SecretValue> OriginateNewValueAsync(string operationId,

private async Task RevokeRotationArtifactsAsync(bool whatIf)
{
DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();

IEnumerable<SecretState> rotationArtifacts = await PrimaryStore.GetRotationArtifactsAsync();

Expand Down

This file was deleted.

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

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Moq" Version="4.18.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void GetAllRotationPlans_ValidConfiguration_ReturnsPlan()
RotationConfiguration configuration = RotationConfiguration.From(names, tags, configRoot, storeFactories);

// Act
IEnumerable<RotationPlan> plans = configuration.GetAllRotationPlans(Mock.Of<ILogger>(), new TimeProvider());
IEnumerable<RotationPlan> plans = configuration.GetAllRotationPlans(Mock.Of<ILogger>(), TimeProvider.System);

Assert.AreEqual(1, plans.Count());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task GetStatusAsync_ExpectExpirationState(

var rotationPlan = new RotationPlan(
Mock.Of<ILogger>(),
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
"TestPlan",
Mock.Of<SecretStore>(),
Mock.Of<SecretStore>(x => x.GetCurrentStateAsync() == Task.FromResult(primaryState)),
Expand Down Expand Up @@ -101,7 +101,7 @@ public async Task GetStatusAsync_RequiresRevocation(int hoursUntilRevocation, bo

var rotationPlan = new RotationPlan(
Mock.Of<ILogger>(),
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
"TestPlan",
Mock.Of<SecretStore>(),
Mock.Of<SecretStore>(
Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task RotatePlansAsync_RequiresRevocation_DoesRevocation()

var rotationPlan = new RotationPlan(
Mock.Of<ILogger>(),
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
"TestPlan",
originStore,
primaryStore,
Expand Down
2 changes: 1 addition & 1 deletion tools/secret-management/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<Description>Generates code snippets for readmes in the azure-sdk-for-net repo.</Description>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>snippet-generator</ToolCommandName>
<VersionPrefix>1.0.0</VersionPrefix>
Expand Down