Skip to content

Commit

Permalink
Merge pull request #259 from leo-schick/upgrate-to-net8
Browse files Browse the repository at this point in the history
Upgrate to .Net 8
  • Loading branch information
1iveowl committed Jan 13, 2024
2 parents 680f52b + 46f31bf commit a7d34a3
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 107 deletions.
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Saas.Admin/Saas.Admin.Service/Program.cs
Expand Up @@ -140,7 +140,7 @@ void InitializeDevEnvironment()

// For local development, use the Secret Manager feature of .NET to store a connection string
// and likewise for storing a secret for the permission-api app.
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-7.0&tabs=windows
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows

var appConfigurationconnectionString = builder.Configuration.GetConnectionString("AppConfig")
?? throw new NullReferenceException("App config missing.");
Expand Down
2 changes: 1 addition & 1 deletion src/Saas.Application/Saas.Application.Web/Program.cs
Expand Up @@ -169,7 +169,7 @@ void InitializeDevEnvironment()

// For local development, use the Secret Manager feature of .NET to store a connection string
// and likewise for storing a secret for the permission-api app.
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-7.0&tabs=windows
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows

var appConfigurationconnectionString = builder.Configuration.GetConnectionString("AppConfig")
?? throw new NullReferenceException("App config missing.");
Expand Down

This file was deleted.

Expand Up @@ -52,7 +52,7 @@
}

// Add configuration settings data using Options Pattern.
// For more see: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0
// For more see: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-8.0
builder.Services.Configure<PermissionsApiOptions>(
builder.Configuration.GetRequiredSection(PermissionsApiOptions.SectionName));

Expand Down Expand Up @@ -148,7 +148,7 @@ void InitializeDevEnvironment()

// For local development, use the Secret Manager feature of .NET to store a connection string
// and likewise for storing a secret for the permission-api app.
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-7.0&tabs=windows
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows

var appConfigurationconnectionString = builder.Configuration.GetConnectionString("AppConfig")
?? throw new NullReferenceException("App config missing.");
Expand Down
Expand Up @@ -16,7 +16,7 @@ public class GraphAPIService(
{
private readonly ILogger _logger = logger;

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-7.0
// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-8.0
private static readonly Action<ILogger, Exception> _logError = LoggerMessage.Define(
LogLevel.Error,
new EventId(1, nameof(GraphAPIService)),
Expand Down
10 changes: 5 additions & 5 deletions src/Saas.Identity/Saas.Permissions/readme.md
Expand Up @@ -43,10 +43,10 @@ The SaaS Permissions Service API can be run locally during development, testing
To run the API locally, you must have the following installed on your developer machine:

- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (recommended) or [Visual Studio Code](https://code.visualstudio.com/download).
- [.NET 7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
- [ASP.NET Core 7.0](https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-7.0)
- [.NET 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- [ASP.NET Core 8.0](https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-8.0)

> *Tip*: .NET 7.0 and ASP.NET Core 7.0 can also be installed as part of the latest version Microsoft Visual Studio 2022.
> *Tip*: .NET 8.0 and ASP.NET Core 8.0 can also be installed as part of the latest version Microsoft Visual Studio 2022.
### Configuration, settings and secrets when running locally

Expand All @@ -69,7 +69,7 @@ az account show # use this to see if you're already logged into your Azure tanen
az login
```

Code have been added to the [ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-7.0) project leveraging the local Azure CLI environment. You'll find this code in in `Program.cs`:
Code have been added to the [ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core?view=aspnetcore-8.0) project leveraging the local Azure CLI environment. You'll find this code in in `Program.cs`:

```csharp
if (builder.Environment.IsDevelopment())
Expand All @@ -89,7 +89,7 @@ if (builder.Environment.IsDevelopment())

To manage access to Azure App Configuration, securely, we need one more thing.

From your local development environment, you can leverage the Dotnet [Secret Manager](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-7.0&tabs=windows), to securely store a `connection string` allowing the local app to access the provisioned Azure App Configuration instance.
From your local development environment, you can leverage the Dotnet [Secret Manager](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows), to securely store a `connection string` allowing the local app to access the provisioned Azure App Configuration instance.

This is a two step process:

Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Expand Up @@ -68,8 +68,8 @@ resource signupAdministrationWeb 'Microsoft.Web/sites@2022-03-01' = {
http20Enabled: true
keyVaultReferenceIdentity: userAssignedIdentity.id // Must specify this when using User Assigned Managed Identity. Read here: https://learn.microsoft.com/en-us/azure/app-service/app-service-key-vault-references?tabs=azure-cli#access-vaults-with-a-user-assigned-identity
detailedErrorLoggingEnabled: true
netFrameworkVersion: 'v7.0'
// linuxFxVersion: 'DOTNETCORE|7.0'
netFrameworkVersion: 'v8.0'
// linuxFxVersion: 'DOTNETCORE|8.0'
}
}
identity: {
Expand Down
Expand Up @@ -21,7 +21,7 @@ public class ClientAssertionSigningProvider(
{
private readonly ILogger _logger = logger;

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-7.0
// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-8.0
private static readonly Action<ILogger, Exception> _logError = LoggerMessage.Define(
LogLevel.Error,
new EventId(1, nameof(ClientAssertionSigningProvider)),
Expand Down
Expand Up @@ -15,7 +15,7 @@ public class PublicX509CertificateDetailProvider(
{
private readonly ILogger _logger = logger;

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-7.0
// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-8.0
private static readonly Action<ILogger, Exception> _logError = LoggerMessage.Define(
LogLevel.Error,
new EventId(1, nameof(PublicX509CertificateDetailProvider)),
Expand Down
Expand Up @@ -15,7 +15,7 @@ public class SaasApiAuthenticationProvider<TProvider, TOptions> : DelegatingHand
{
private readonly ILogger _logger;

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-7.0
// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-8.0
private static readonly Action<ILogger, Exception> _logError = LoggerMessage.Define(
LogLevel.Error,
new EventId(1, nameof(SaasApiAuthenticationProvider<TProvider, TOptions>)),
Expand Down
Expand Up @@ -14,7 +14,7 @@ public class SaasGraphClientCredentialsProvider<TOptions>(
private readonly ILogger _logger = logger;
private readonly SaasApiAuthenticationProvider<ISaasMicrosoftGraphApi, TOptions> _authProvider = authProvider;

// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-7.0
// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-8.0
private static readonly Action<ILogger, Exception> _logError = LoggerMessage.Define(
LogLevel.Error,
new EventId(1, nameof(SaasGraphClientCredentialsProvider<TOptions>)),
Expand Down
Expand Up @@ -192,7 +192,7 @@ void InitializeDevEnvironment()

// For local development, use the Secret Manager feature of .NET to store a connection string
// and likewise for storing a secret for the permission-api app.
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-7.0&tabs=windows
// https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows

var appConfigurationconnectionString = builder.Configuration.GetConnectionString("AppConfig")
?? throw new NullReferenceException("App config missing.");
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/TestUtilities/TestUtilities.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down

0 comments on commit a7d34a3

Please sign in to comment.