So in my Install.ps1 I can add a reference like this:
param($installPath, $toolsPath, $package, $project)
$project.Object.References.Add(\"YourDLL\")
Here's what we use for Machine.Specifications:
param($installPath, $toolsPath, $package, $project)
$project.Object.References | Where-Object { $_.Name -eq 'Machine.Specifications.TDNetRunner' } | ForEach-Object { $_.Remove() }
There are some casting issues to do this in powershell.
this is the c# to remove a reference.
DTE dte = (DTE)dteObject;
var targetProject = (VSProject)dte.GetProject(target).Object;
var refToRemove = targetProject.References.Cast<Reference>().Where(assembly => assembly.Name.EndsWith(library, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
if (refToRemove != null)
{
refToRemove.Remove();
}
If you want to use the Solution Factory nuget package you can use the powershell command that solution factory adds.
Remove-LibraryReference projectName system.web
Here is a link the the solution factory source http://solutionfactory.codeplex.com/SourceControl/network/Forks/erichexter/PowershellRewrite
Update: new url for solution factory: https://github.com/erichexter/SolutionFactory