Microsoft.Extensions.Configuration.Xml 8.0.0-preview.3.23174.8
About
XML configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read configuration parameters from XML files. You can use XmlConfigurationExtensions.AddXmlFile extension method on IConfigurationBuilder
to add XML configuration provider to the configuration builder.
For more information, see the documentation: XML configuration provider.
Example
The following example shows how to read the application configuration from XML file.
using System;
using Microsoft.Extensions.Configuration;
class Program
{
static void Main()
{
// Build a configuration object from XML file
IConfiguration config = new ConfigurationBuilder()
.AddXmlFile("appsettings.xml")
.Build();
// Get a configuration section
IConfigurationSection section = config.GetSection("Settings");
// Read simple values
Console.WriteLine($"Server: {section["Server"]}");
Console.WriteLine($"Database: {section["Database"]}");
// Read nested values
Console.WriteLine($"IPAddress: {section["Endpoint:IPAddress"]}");
Console.WriteLine($"Port: {section["Endpoint:Port"]}");
}
}
To run this example, include an appsettings.xml
file with the following content in your project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<Settings>
<Server>example.com</Server>
<Database>Northwind</Database>
<Endpoint>
<IPAddress>192.168.0.10</IPAddress>
<Port>80</Port>
</Endpoint>
</Settings>
</configuration>
You can include a configuration file using a code like this in your .csproj
file:
<ItemGroup>
<Content Include="appsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Showing the top 20 packages that depend on Microsoft.Extensions.Configuration.Xml.
Packages | Downloads |
---|---|
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application.
This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
|
10 |
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application.
This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
|
7 |
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application.
This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
|
6 |
Microsoft.AspNetCore.App
Microsoft.AspNetCore.App
|
6 |
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application.
This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
|
5 |
Microsoft.AspNetCore.App
Microsoft.AspNetCore.App
|
5 |
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.3.23174.8)
- System.Security.Cryptography.Xml (>= 8.0.0-preview.3.23174.8)
.NET 6.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.3.23174.8)
- System.Security.Cryptography.Xml (>= 8.0.0-preview.3.23174.8)
.NET 7.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.3.23174.8)
- System.Security.Cryptography.Xml (>= 8.0.0-preview.3.23174.8)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.3.23174.8)
- System.Security.Cryptography.Xml (>= 8.0.0-preview.3.23174.8)
.NET Standard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.3.23174.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.3.23174.8)
- System.Security.Cryptography.Xml (>= 8.0.0-preview.3.23174.8)