Description
After upgrading our ASP.Net 7 application (that started life as Core 1.1 and upgraded through several .Net Core versions) to .Net 8, when building in a DevOps pipeline, the following error happens:
BindingExtensions.g.cs(131,71): error CS0104: 'Options' is an ambiguous reference between 'myProject.Options' and 'Microsoft.Extensions.Options.Options'
According to the docs, the Configuration Binding Source Generator is disabled by default, yet we have needed to add <EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator> to the csproj to work around the error. We are not using AOT, and never have.
Note, the project references a Microsoft.NET.Sdk.BlazorWebAssembly project. I'm not sure if that's relevant.
Reproduction Steps
- Take an existing .Net 7 web project,
- put an Options class in the root namespace and use with WebApplicationBuilder.Services.Configure.
- Upgrade to .Net 8.
- Do not intentionally enable the Configuration-binding source generator.
- Do not use AOT
Expected behavior
Project should build successfully. Configuration-binding source generator should not be enabled.
Actual behavior
Project fails to build with the following error:
BindingExtensions.g.cs(131,71): error CS0104: 'Options' is an ambiguous reference between 'myProject.Options' and 'Microsoft.Extensions.Options.Options'
Configuration-binding source generator appears to be enabled despite it supposedly being disabled by default.
Regression?
No response
Known Workarounds
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator> in the csproj
Configuration
.Net 8
Other information
No response
Description
After upgrading our ASP.Net 7 application (that started life as Core 1.1 and upgraded through several .Net Core versions) to .Net 8, when building in a DevOps pipeline, the following error happens:
BindingExtensions.g.cs(131,71): error CS0104: 'Options' is an ambiguous reference between 'myProject.Options' and 'Microsoft.Extensions.Options.Options'According to the docs, the Configuration Binding Source Generator is disabled by default, yet we have needed to add
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator>to the csproj to work around the error. We are not using AOT, and never have.Note, the project references a Microsoft.NET.Sdk.BlazorWebAssembly project. I'm not sure if that's relevant.
Reproduction Steps
Expected behavior
Project should build successfully. Configuration-binding source generator should not be enabled.
Actual behavior
Project fails to build with the following error:
BindingExtensions.g.cs(131,71): error CS0104: 'Options' is an ambiguous reference between 'myProject.Options' and 'Microsoft.Extensions.Options.Options'Configuration-binding source generator appears to be enabled despite it supposedly being disabled by default.
Regression?
No response
Known Workarounds
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator>in the csprojConfiguration
.Net 8
Other information
No response