Skip to content

Commit 05465c2

Browse files
authored
Update projects targeting net6 to net8 - part 2 (#9018)
* Second batch of projects to update from net6 to net8 * Remove the Core/TimeProvider in favor of System.TimeProvider in net8
1 parent b03fc8b commit 05465c2

File tree

28 files changed

+54
-43
lines changed

28 files changed

+54
-43
lines changed

tools/agent-time-extractor/AgentTimeExtractor/AgentTimeExtractor.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.159.1-preview" />
9+
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
1010
</ItemGroup>
1111

1212
</Project>

tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/Azure.Sdk.Tools.HttpFaultInjector.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<VersionPrefix>0.2.0</VersionPrefix>
55

6-
<TargetFramework>net6.0</TargetFramework>
6+
<TargetFramework>net8.0</TargetFramework>
77

88
<IsPackable>true</IsPackable>
99
<PackAsTool>true</PackAsTool>

tools/http-fault-injector/Azure.Sdk.Tools.HttpFaultInjector/FaultInjectingMiddleware.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private async Task SendDownstreamResponse(HttpResponse response, UpstreamRespons
239239
response.StatusCode = upstreamResponse.StatusCode;
240240
foreach (var header in upstreamResponse.Headers)
241241
{
242-
response.Headers.Add(header.Key, header.Value);
242+
response.Headers.Append(header.Key, header.Value);
243243
}
244244

245245
_logger.LogInformation("Started writing response body, {actualLength}", contentBytes);

tools/http-fault-injector/sample-clients/net/storage-blobs/Azure.Sdk.Tools.HttpFaultInjector.StorageBlobsSample.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" />
9+
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.0" />
1010
</ItemGroup>
1111

1212
</Project>

tools/http-fault-injector/sample-servers/net/http-server/Azure.Sdk.Tools.HttpFaultInjector.HttpServerSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen.Tests/Azure.SDK.Management.ChangelogGen.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Azure.SDK.Management.ChangelogGen.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<PackAsTool>True</PackAsTool>

tools/perf-automation/Azure.Sdk.Tools.PerfAutomation.Tests/Azure.Sdk.Tools.PerfAutomation.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/Azure.Sdk.Tools.PerfAutomation.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55

66
<OutputType>Exe</OutputType>
77
<PackAsTool>true</PackAsTool>

tools/pipeline-generator/Azure.Sdk.Tools.PipelineGenerator/Azure.Sdk.Tools.PipelineGenerator.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66

77
<PackAsTool>true</PackAsTool>
88
<ToolCommandName>pipeline-generator</ToolCommandName>

tools/pixel-server/PixelServer/PixelServer.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

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

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
16-
<PackageReference Include="Microsoft.AspNetCore.App" />
1716
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
1817
</ItemGroup>
1918

tools/pixel-server/PixelServer/Startup.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
@@ -10,6 +10,7 @@
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.Extensions.Logging;
1212
using Microsoft.Extensions.Options;
13+
using Microsoft.Extensions.Hosting;
1314

1415
namespace PixelServer
1516
{
@@ -27,11 +28,11 @@ public void ConfigureServices(IServiceCollection services)
2728
{
2829
services.AddMemoryCache();
2930
services.AddApplicationInsightsTelemetry(Configuration);
30-
services.AddMvcCore();
31+
services.AddMvcCore(options => options.EnableEndpointRouting = false);
3132
}
3233

3334
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
34-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
35+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
3536
{
3637
if (env.IsDevelopment())
3738
{

tools/secret-management/Azure.Sdk.Tools.AccessManagement.Tests/Azure.Sdk.Tools.AccessManagement.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66

77
<IsPackable>false</IsPackable>

tools/secret-management/Azure.Sdk.Tools.AccessManagement/Azure.Sdk.Tools.AccessManagement.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Azure.Identity" Version="1.12.0" />
59
<PackageReference Include="Azure.ResourceManager.Authorization" Version="1.0.1" />

tools/secret-management/Azure.Sdk.Tools.SecretManagement.Cli/Azure.Sdk.Tools.SecretManagement.Cli.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<EnableWindowsTargeting>true</EnableWindowsTargeting>
77
<IsPackable>true</IsPackable>
88
<PackAsTool>true</PackAsTool>

tools/secret-management/Azure.Sdk.Tools.SecretManagement.Cli/Commands/RotateCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override async Task HandleCommandAsync(ILogger logger, RotationConfigu
2323
bool onlyRotateExpiring = invocationContext.ParseResult.GetValueForOption(this.expiringOption);
2424
bool whatIf = invocationContext.ParseResult.GetValueForOption(this.whatIfOption);
2525

26-
var timeProvider = new TimeProvider();
26+
var timeProvider = TimeProvider.System;
2727

2828
IEnumerable<RotationPlan> plans = rotationConfiguration.GetAllRotationPlans(logger, timeProvider);
2929
bool success = true;

tools/secret-management/Azure.Sdk.Tools.SecretManagement.Cli/Commands/StatusCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public StatusCommand() : base("status", "Show secret rotation status")
1414
protected override async Task HandleCommandAsync(ILogger logger, RotationConfiguration rotationConfiguration,
1515
InvocationContext invocationContext)
1616
{
17-
var timeProvider = new TimeProvider();
17+
var timeProvider = TimeProvider.System;
1818
RotationPlan[] plans = rotationConfiguration.GetAllRotationPlans(logger, timeProvider).ToArray();
1919

2020
logger.LogInformation($"Getting status for {plans.Length} plans");

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Azure/Azure.Sdk.Tools.SecretRotation.Azure.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Azure.Core" Version="1.40.0" />
59
<PackageReference Include="Azure.Identity" Version="1.12.0" />

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Configuration/Azure.Sdk.Tools.SecretRotation.Configuration.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<ProjectReference Include="..\Azure.Sdk.Tools.SecretRotation.Core\Azure.Sdk.Tools.SecretRotation.Core.csproj" />
59
</ItemGroup>

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Core/Azure.Sdk.Tools.SecretRotation.Core.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
59
</ItemGroup>

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Core/RotationPlan.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public async Task ExecuteAsync(bool onlyRotateExpiring, bool whatIf)
5454
using IDisposable? loggingScope = this.logger.BeginScope(operationId);
5555
this.logger.LogInformation("\nProcessing rotation plan '{PlanName}'", Name);
5656

57-
DateTimeOffset shouldRotateDate = this.timeProvider.GetCurrentDateTimeOffset().Add(RotationThreshold);
57+
DateTimeOffset shouldRotateDate = this.timeProvider.GetUtcNow().Add(RotationThreshold);
5858

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

@@ -88,7 +88,7 @@ public async Task<RotationPlanStatus> GetStatusAsync()
8888
{
8989
try
9090
{
91-
DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
91+
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();
9292

9393
SecretState primaryStoreState = await PrimaryStore.GetCurrentStateAsync();
9494

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

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

109-
DateTimeOffset rotationThresholdDate = this.timeProvider.GetCurrentDateTimeOffset().Add(RotationThreshold);
109+
DateTimeOffset rotationThresholdDate = this.timeProvider.GetUtcNow().Add(RotationThreshold);
110110

111-
DateTimeOffset warningThresholdDate = this.timeProvider.GetCurrentDateTimeOffset().Add(WarningThreshold);
111+
DateTimeOffset warningThresholdDate = this.timeProvider.GetUtcNow().Add(WarningThreshold);
112112

113113
DateTimeOffset? minExpirationDate = allStates
114114
.Where(x => x.ExpirationDate.HasValue)
@@ -159,7 +159,7 @@ private async Task RotateAsync(string operationId, SecretState currentState, boo
159159
* 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)
160160
*/
161161

162-
DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
162+
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();
163163

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

245245
private async Task RevokeRotationArtifactsAsync(bool whatIf)
246246
{
247-
DateTimeOffset invocationTime = this.timeProvider.GetCurrentDateTimeOffset();
247+
DateTimeOffset invocationTime = this.timeProvider.GetUtcNow();
248248

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

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Core/TimeProvider.cs

-9
This file was deleted.

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Tests/Azure.Sdk.Tools.SecretRotation.Tests.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
59
<PackageReference Include="Moq" Version="4.18.3" />

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Tests/CoreTests/RotationConfigurationTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void GetAllRotationPlans_ValidConfiguration_ReturnsPlan()
158158
RotationConfiguration configuration = RotationConfiguration.From(names, tags, configRoot, storeFactories);
159159

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

163163
Assert.AreEqual(1, plans.Count());
164164
}

tools/secret-management/Azure.Sdk.Tools.SecretRotation.Tests/CoreTests/RotationPlanTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public async Task GetStatusAsync_ExpectExpirationState(
5858

5959
var rotationPlan = new RotationPlan(
6060
Mock.Of<ILogger>(),
61-
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
61+
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
6262
"TestPlan",
6363
Mock.Of<SecretStore>(),
6464
Mock.Of<SecretStore>(x => x.GetCurrentStateAsync() == Task.FromResult(primaryState)),
@@ -101,7 +101,7 @@ public async Task GetStatusAsync_RequiresRevocation(int hoursUntilRevocation, bo
101101

102102
var rotationPlan = new RotationPlan(
103103
Mock.Of<ILogger>(),
104-
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
104+
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
105105
"TestPlan",
106106
Mock.Of<SecretStore>(),
107107
Mock.Of<SecretStore>(
@@ -161,7 +161,7 @@ public async Task RotatePlansAsync_RequiresRevocation_DoesRevocation()
161161

162162
var rotationPlan = new RotationPlan(
163163
Mock.Of<ILogger>(),
164-
Mock.Of<TimeProvider>(x => x.GetCurrentDateTimeOffset() == staticTestTime),
164+
Mock.Of<TimeProvider>(x => x.GetUtcNow() == staticTestTime),
165165
"TestPlan",
166166
originStore,
167167
primaryStore,

tools/secret-management/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>enable</ImplicitUsings>
55
<Nullable>enable</Nullable>
66
<IsPackable>false</IsPackable>

tools/snippet-generator/Azure.Sdk.Tools.SnippetGenerator.Tests/Azure.Sdk.Tools.SnippetGenerator.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

tools/snippet-generator/Azure.Sdk.Tools.SnippetGenerator/Azure.Sdk.Tools.SnippetGenerator.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
44
<Description>Generates code snippets for readmes in the azure-sdk-for-net repo.</Description>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<PackAsTool>true</PackAsTool>
77
<ToolCommandName>snippet-generator</ToolCommandName>
88
<VersionPrefix>1.0.0</VersionPrefix>

0 commit comments

Comments
 (0)