* added dotnet 7

* github workflow - set dotnet 7

* dockerfile, workflows, packages - net 7

* indentation fix

Co-authored-by: Pavel Gajdusek <pgajdusek@microsoft.com>
Co-authored-by: Neil <49037171+neilr81@users.noreply.github.com>
This commit is contained in:
gajdusep 2022-11-14 18:22:03 +01:00 коммит произвёл GitHub
Родитель 4180bd30d0
Коммит 739ae123e4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 32 добавлений и 29 удалений

Просмотреть файл

@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/dotnet/.devcontainer/base.Dockerfile
# [Choice] .NET version: 5.0, 3.1, 2.1
ARG VARIANT="6.0"
ARG VARIANT="7.0"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.

2
.github/workflows/build.yml поставляемый
Просмотреть файл

@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
- name: Build with dotnet
run: dotnet build --configuration ${{ matrix.configuration }}
- name: Run Unit Tests

2
.github/workflows/codeql-analysis.yml поставляемый
Просмотреть файл

@ -39,7 +39,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

Просмотреть файл

@ -6,7 +6,7 @@
</PropertyGroup>
<PropertyGroup Label="Target Platforms" >
<NetCoreVersions>net6.0</NetCoreVersions>
<NetCoreVersions>net7.0</NetCoreVersions>
<NetStandardVersions>netstandard2.0</NetStandardVersions>
<LibraryTargetFrameworks>$(NetCoreVersions);$(NetStandardVersions)</LibraryTargetFrameworks>
<ExecutableTargetFrameworks>$(NetCoreVersions)</ExecutableTargetFrameworks>

Просмотреть файл

@ -5,27 +5,27 @@
<PackageReference Update="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="4.3.1" />
<PackageReference Update="Microsoft.CodeAnalysis.Csharp" Version="4.3.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Update="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.10" />
<PackageReference Update="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Update="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.ObjectPool" Version="6.0.10" />
<PackageReference Update="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Options.DataAnnotations" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.ObjectPool" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Options.DataAnnotations" Version="7.0.0" />
<PackageReference Update="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Update="Microsoft.Net.Test.Sdk" Version="17.3.2" />
<PackageReference Update="Microsoft.SourceLink.AzureRepos.Git" Version="1.1.1" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageReference Update="Moq" Version="4.18.2" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Update="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
<PackageReference Update="System.Text.Json" Version="6.0.6" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="7.0.0" />
<PackageReference Update="System.Text.Json" Version="7.0.0" />
<PackageReference Update="System.Threading.Tasks" Version="4.3.0" />
<PackageReference Update="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

Просмотреть файл

@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.402",
"version": "7.0.100",
"rollForward": "latestMajor"
},
"msbuild-sdks": {

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<!--
<SettingsFile>$(SolutionDir)\src\CodeGenerators\SettingsGen.Example\Settings.xml</SettingsFile>
<GenerateSettingsFile>True</GenerateSettingsFile> -->

Просмотреть файл

@ -99,7 +99,8 @@ namespace Microsoft.Extensions.Hosting
{
if (endpoint.UseHttps)
{
string certificateSubject = context.Configuration.GetValue<string>(endpoint.SettingForCertificateCommonName);
string settingForCertificateCommonName = Validation.ThrowIfNullOrWhiteSpace(endpoint.SettingForCertificateCommonName);
string certificateSubject = Validation.ThrowIfNullOrWhiteSpace(context.Configuration.GetValue<string>(settingForCertificateCommonName));
listenOptions.UseHttps(StoreName.My, certificateSubject, true, StoreLocation.LocalMachine);
}
});

Просмотреть файл

@ -28,7 +28,7 @@ namespace Microsoft.Omex.Extensions.Logging
m_replayer = replayer;
}
public IDisposable BeginScope<TState>(TState state) => m_externalScopeProvider.Push(state);
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => m_externalScopeProvider.Push(state);
public bool IsEnabled(LogLevel logLevel) => m_logsEventSender.IsEnabled(logLevel);

Просмотреть файл

@ -101,7 +101,7 @@ namespace Hosting.Services.UnitTests
{
public List<(EventId id, LogLevel level, string message)> Messages = new();
public IDisposable BeginScope<TState>(TState state) => throw new NotImplementedException();
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => throw new NotImplementedException();
public bool IsEnabled(LogLevel logLevel) => true;

Просмотреть файл

@ -88,7 +88,7 @@ namespace Hosting.Services.UnitTests
{
public List<Exception?> Exceptions { get; } = new();
public IDisposable BeginScope<TState>(TState state) => throw new NotImplementedException();
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => throw new NotImplementedException();
public bool IsEnabled(LogLevel logLevel) => true;

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" PrivateAssets="all" />

Просмотреть файл

@ -29,7 +29,7 @@ namespace Microsoft.Omex.Extensions.Hosting.Services.UnitTests
{
void CheckTypeRegistration<TContext>() where TContext : ServiceContext
{
object obj = new ServiceCollection()
object? obj = new ServiceCollection()
.AddOmexServiceFabricDependencies<TContext>()
.AddSingleton(new Mock<IHostEnvironment>().Object)
.BuildServiceProvider()

Просмотреть файл

@ -21,7 +21,7 @@ namespace Microsoft.Omex.Extensions.Hosting.UnitTests
[DataRow(typeof(ActivitySource))]
public void AddOmexServices_TypesRegistered(Type type)
{
object collectionObj = new ServiceCollection()
object? collectionObj = new ServiceCollection()
.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()) // Added IConfiguration because one of the dependency depends on IOptions which in turn depends on IConfiguration
.AddSingleton<IHostEnvironment>(new HostingEnvironment())
.AddOmexServices()

Просмотреть файл

@ -173,7 +173,9 @@ namespace Microsoft.Omex.Extensions.Logging.UnitTests
using IDisposable resultMock = new Mock<IDisposable>().Object;
scopeProviderMock.Setup(p => p.Push(obj)).Returns(resultMock);
using IDisposable result = logger.BeginScope(obj);
using IDisposable? result = logger.BeginScope(obj);
Assert.IsNotNull(result, "Failed to begin scope");
scopeProviderMock.Verify(p => p.Push(obj), Times.Once);
Assert.AreEqual(resultMock, result);