Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

CAP-3Shape/Logging.AzureAppServices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cannot build in .NET 7 when referencing Microsoft.Extensions.Logging.AzureAppServices

I was trying to upgrade a couple of NuGet packages in my C# ASP.NET Core application, including Microsoft.Extensions.Logging.AzureAppServices 8.0.0.

I cannot compile with this NuGet. At least not with .NET 7.0. It fails with this error message:

Startup.cs(18,18): error CS0121: The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.Validat eOnStart(Microsoft.Extensions.Options.OptionsBuilder)' and 'Microsoft.Extensions.DependencyInjectio n.OptionsBuilderExtensions.ValidateOnStart(Microsoft.Extensions.Options.OptionsBuilder)'

The code line it complains about looks like this:

services.AddOptions<MyOptions>()
    .Bind(Configuration.GetSection(MyOptions.Name))
    .ValidateDataAnnotations()
    .ValidateOnStart();

I have tried to rewrite this to call the method in Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions explicitly. That did not help. I haven't found any workaround that lets me compile this against .NET 7.0.

About

Minimal working example to demonstrate an apparent bug

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages