Skip to content

Instantly share code, notes, and snippets.

@michaelkc
Created December 9, 2014 15:20
Show Gist options
  • Save michaelkc/767a3fd8e937b71a66ac to your computer and use it in GitHub Desktop.
Save michaelkc/767a3fd8e937b71a66ac to your computer and use it in GitHub Desktop.
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$csprojInFile,
[Parameter(Mandatory=$True,Position=2)]
[string]$csprojOutFile
)
$csproj = [xml](get-content $csprojInFile)
$xmlns = $csproj.Project.xmlns
foreach ($ref in $csproj.Project.ItemGroup.Reference)
{
if ($ref.HintPath)
{
if (-not $ref.Private)
{
$private = $csproj.CreateElement("Private", $xmlns)
$private.InnerText = "True"
$ref.AppendChild($private) | out-null
}
}
}
$csproj.Save($csprojOutFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment