Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created December 29, 2020 14:06
Show Gist options
  • Save johnmmoss/13f9da3d8e1f0bdea3c999c8db460a0d to your computer and use it in GitHub Desktop.
Save johnmmoss/13f9da3d8e1f0bdea3c999c8db460a0d to your computer and use it in GitHub Desktop.
Script hack to update web.config before build
$server = "127.0.0.1"
$database = "TomatoFarm123"
$username ="use12356"
$password = "pAssWord!"
$connectionString = "Server=$server;Database=$database;User Id=$username;Password=$password;"
$webConfig = "C:\Code\tomatofarm\Api\Api\Web.Config"
$xml = New-Object xml
$xml.PreserveWhitespace = $true
$xml.Load($webConfig)
$xml.configuration.connectionStrings.add.connectionString = $connectionString
$xml.Save($webConfig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment