Ensure AppSetting
  • 14 May 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

Ensure AppSetting

  • Dark
    Light
  • PDF

Article Summary

This is generated from the built in components of BuildMaster 7.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.

Ensure AppSetting

Ensures a .NET application configuration file has the specified appSetting key/value pair.

Script usage:

DotNet::Ensure-AppSetting(
	File: <text>,
	Key: <text>,
	Value: <text>,
	[AppSettingsXPath: <text>]
);

Arguments:

NameFormatScript UsageUsage Notes
Config file path
text
File
The file path of the configuration file, typically web.config or app.config. This argument is required.
AppSetting key
text
Key
This argument is required.
AppSetting value
text
Value
This argument is required.
XPath for appSettings
text
AppSettingsXPath

Note: By default, the "appSettings" section must exist in the file under the "configuration" element in order to ensure the key/value pair is present. Use the AppSettingsXPath argument to select a different element instead.

Example:

# ensures that the application is configured to use test mode for the example third-party API
DotNet::Ensure-AppSetting(
	File: E:\Website\web.config,
	Key: Accounts.ThirdParty.PaymentApi,
	Value: https://test.example.com/api/v3
);

Was this article helpful?