Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How not to modify the project from Install.ps1
#This script edits the project file and marks the talkfx-c.dll files to always be copied to the output directory
param($installPath, $toolsPath, $package, $project)
# Load project XML.
$doc = New-Object System.Xml.XmlDocument
$namespace = ''
# Find the node containing the file. The tag "Content" may be replace by "None" depending of the case, check your .csproj file.
$talkFXDlls = Select-Xml "//msb:Project/msb:ItemGroup/msb:Content[contains(@Include, 'talkfx-c.dll')]" $doc -Namespace @{msb = $namespace}
foreach($xmlNode in $talkFXDlls)
$nodeName = "CopyToOutputDirectory"
#Check if the property already exists, just in case.
$property = $xmlNode.Node.SelectSingleNode($nodeName)
if($property -eq $null)
$property = $doc.CreateElement($nodeName, $namespace)
# Save changes.
Write-Warning "If Visual Studio prompts you wether to Save As... or Discard, you need to chose Discard changes."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment