A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Hi Rod,
You are correct: appsettingsschema.json is not a file you created manually. It is generated during the project’s design-time/build process and is used by Visual Studio to provide validation and IntelliSense for appsettings.json.
Some NuGet packages provide JSON Schema fragments. These fragments are combined into a generated file under:
obj\<Configuration>\<TargetFramework>\appsettingsschema.json
That is why the file is under obj and should remain excluded from source control.
In this case, the duplicate CredentialSource entry is caused by a known schema-combination issue involving Azure.Core and System.ClientModel. Both schema fragments declared CredentialSource as required, and the schema combiner concatenated the required arrays without removing duplicate values. This resulted in something similar to:
"required": [
"CredentialSource",
"CredentialSource"
]
Because that array requires unique values, Visual Studio reports:
Items must be unique
The issue was corrected in Azure.Core by removing the duplicate declaration from its schema fragment. [github.com], [github.com]
How to resolve it
First, check which version of Azure.Core is being resolved by the project, including transitive dependencies:
dotnet list package --include-transitive
Look for Azure.Core in the output and identify which top-level Azure SDK package is bringing it into the project.
If possible, update that top-level Azure package. Alternatively, add or update the direct Azure.Core reference to a fixed compatible version, such as 1.54.0 or a newer stable version:
dotnet add package Azure.Core --version 1.54.0
Azure.Core version 1.54.0 is available on NuGet, and the related schema correction was implemented for that release line. [github.com], [nuget.org]
After updating the package:
- Close Visual Studio.
- Delete the project’s
binandobjfolders. - Restore the NuGet packages.
- Reopen Visual Studio and rebuild the project.
You can also run:
dotnet clean
dotnet restore
dotnet build
Do not manually edit appsettingsschema.json, because it is generated and your changes will be overwritten.
The warning concerns the schema used by the editor for validation and IntelliSense. It should not affect how the application reads its configuration at runtime.
The message appearing twice may mean that Visual Studio is validating multiple appsettings*.json files, such as appsettings.json and appsettings.Development.json, or that the generated schema is being processed by more than one design-time validation pass.
If updating the packages does not resolve it, please share the Azure.Core and System.ClientModel versions shown by:
dotnet list package --include-transitive
That will help identify which dependency is still contributing the affected schema.
If this answer helped resolve the issue, please consider marking it as Accepted Answer. This helps other community members find the solution more easily.