Skip to content

Instantly share code, notes, and snippets.

@blacktambourine
Created January 14, 2016 04:39
Show Gist options
  • Save blacktambourine/31d9c90558c561d4d12d to your computer and use it in GitHub Desktop.
Save blacktambourine/31d9c90558c561d4d12d to your computer and use it in GitHub Desktop.
Nuget Powershell to Set CopyLocal to false for dlls
param($installPath, $toolsPath, $package, $project)
$asms = $package.AssemblyReferences | %{$_.Name}
$configName = $project.ConfigurationManager.ActiveConfiguration.ConfigurationName
Write-Host "Updating dlls for configuration - ${configName}";
if ($configName -NotLike "*CD")
{
Write-Host "Updating dlls for Non-CD (Content Delivery) Environment";
foreach ($reference in $project.Object.References)
{
if ($asms -contains $reference.Name + ".dll")
{
$currentDLLName = $reference.Name + ".dll";
$reference.CopyLocal = $false;
Write-Host "CopyLocal set to false - ${currentDLLName}";
}
}
}
Write-Host "DLL Install and config complete.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment