私はpowershellのXML機能を使用して.configファイルを変更しています。 を呼び出すXMLDocument.Saveは、完全なパス名を指定しないかぎり、何の効果もありません。XMLファイルをpowershellに保存するには完全なパスが必要です。どうして?
# Open the xml file
$config = [xml](get-content web.config)
#
# modify the XML
$config.SelectNodes("./configuration/connectionStrings/add[@name='LocalSqlServer']") | % { $connNode = $_ }
$connNode.connectionString = $connNode.connectionString -replace '^(.*)Server=[^;]+(.*)$', '$1Server=192.168.5.2$2'
#
#
# Now I save it again
#
# This doesn't save it!
$config.Save("web.config");
# However, this works
$config.Save("{0}\\web.config" -f (get-location));
なぜ$ config.Save( "web.config")が機能しないのですか?
ローカルディレクトリ以外で別の場所に保存することになりましたか?
$ homeのポイントは何ですか?それはそこにあるはずです –
それに関する完全なソースコードの任意のソリューション? – Kiquenet