XmlConfigurationExtensions.AddXmlFile Method

Definition

Overloads

AddXmlFile(IConfigurationBuilder, Action<XmlConfigurationSource>)

Adds an XML configuration source to builder.

AddXmlFile(IConfigurationBuilder, String)

Adds the XML configuration provider at path to builder.

AddXmlFile(IConfigurationBuilder, String, Boolean)

Adds the XML configuration provider at path to builder.

AddXmlFile(IConfigurationBuilder, String, Boolean, Boolean)

Adds the XML configuration provider at path to builder.

AddXmlFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

Adds an XML configuration source to builder.

AddXmlFile(IConfigurationBuilder, Action<XmlConfigurationSource>)

Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs

Adds an XML configuration source to builder.

public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Action<Microsoft.Extensions.Configuration.Xml.XmlConfigurationSource>? configureSource);

Parameters

configureSource
Action<XmlConfigurationSource>

Configures the source.

Returns

The IConfigurationBuilder.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

AddXmlFile(IConfigurationBuilder, String)

Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs

Adds the XML configuration provider at path to builder.

public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path);

Parameters

path
String

Path relative to the base path stored in Properties of builder.

Returns

The IConfigurationBuilder.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

AddXmlFile(IConfigurationBuilder, String, Boolean)

Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs

Adds the XML configuration provider at path to builder.

public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional);

Parameters

path
String

Path relative to the base path stored in Properties of builder.

optional
Boolean

true if the file is optional.

Returns

The IConfigurationBuilder.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

AddXmlFile(IConfigurationBuilder, String, Boolean, Boolean)

Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs

Adds the XML configuration provider at path to builder.

public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange);

Parameters

path
String

Path relative to the base path stored in Properties of builder.

optional
Boolean

true if the file is optional.

reloadOnChange
Boolean

Whether the configuration should be reloaded if the file changes.

Returns

The IConfigurationBuilder.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

AddXmlFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs
Source:
XmlConfigurationExtensions.cs

Adds an XML configuration source to builder.

public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider? provider, string path, bool optional, bool reloadOnChange);

Parameters

provider
IFileProvider

The IFileProvider to use to access the file.

path
String

Path relative to the base path stored in Properties of builder.

optional
Boolean

true if the file is optional.

reloadOnChange
Boolean

Whether the configuration should be reloaded if the file changes.

Returns

The IConfigurationBuilder.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)