I am trying to make an install script with powershell using the microsoft build api. I know how I can do what I want in C#, I have tested a little example, and almost got it ready in powershell. I only need to know what to fill in as key value pair.
C#:
ProjectItemGroupElement slItemGroup = project.Xml.CreateItemGroupElement();
project.Xml.InsertAfterChild(slItemGroup, project.Xml.LastChild);
List<KeyValuePair<string, string>> metadata = new List<KeyValuePair<string, string>>();
var testkvp = new KeyValuePair<string, string>(@"HintPath",@"MyPath");
metadata.Add(testkvp);
slItemGroup.AddItem(@"Reference", @"microsoft.deployment.windowsinstaller", metadata);
In powershell I got as far as this, which works, but I have no idea how to define the third parameter. Can you give me a hint?
$itemGroup = $msBuildProj.Xml.CreateItemGroupElement()
$msBuildProj.Xml.InsertBeforeChild($itemGroup, $myImport)
$itemGroup.AddItem('Reference', 'Microsoft.Deployment.WindowsInstaller')
#$itemGroup.AddItem('Reference', 'Microsoft.Deployment.WindowsInstaller', ???)