1
我試圖從一個文檔到另一個導入XML節點。我使用兩個參數 - 節點和布爾參數在XmlDocument上調用ImportNode方法。從調用.NET的PowerShell法布爾參數
...
$connectionString = $anotherWebConfig.SelectSingleNode("//add[@name='ConnectionString']")
$WebConfig.ImportNode($connectionString, $True)
$WebConfig.SelectSingleNode("//connectionStrings").AppendChild($connectionString)
,但我得到一個錯誤
Exception calling "AppendChild" with "1" argument(s): "The node to be inserted is from a different document context."
我知道一定有什麼不對的進口。我試圖將$ True參數更改爲1,0,10,並將其刪除,但仍然無濟於事。我很驚訝,即使我用無效參數調用這個方法,它也會毫無例外地通過。
什麼是從布爾參數的PowerShell調用.NET方法的正確方法?
比你!我沒有注意到這個方法返回了一些東西。 –