Microsoft.Extensions.Configuration.Xml 9.0.0-preview.5.24306.7
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.
How to Use
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>
Additional Documentation
Feedback & Contributing
Microsoft.Extensions.Configuration.Xml is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
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 |
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.
This package was built from the source at:
https://github.com/aspnet/Universe/tree/1016eae4004686f7fdad13f5c329f63bbae1f3a1
|
5 |
Microsoft.AspNetCore.App
Provides a default set of API 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.
This package was built from the source at:
https://github.com/aspnet/Universe/tree/c0686cbb3c353de256da1db32829d58143b567f5
|
5 |
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.
|
4 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.5.24306.7)
- System.Security.Cryptography.Xml (>= 9.0.0-preview.5.24306.7)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.5.24306.7)
- System.Security.Cryptography.Xml (>= 9.0.0-preview.5.24306.7)
.NET 9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.5.24306.7)
- System.Security.Cryptography.Xml (>= 9.0.0-preview.5.24306.7)
.NET Standard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.5.24306.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.5.24306.7)
- System.Security.Cryptography.Xml (>= 9.0.0-preview.5.24306.7)