Question:
So in my Install.ps1 I can add a reference like this:
1 2 3 |
param($installPath, $toolsPath, $package, $project) $project.Object.References.Add("YourDLL") |
How do you remove a project reference in PowerShell?
Answer:
There are some casting issues to do this in powershell.
this is the c# to remove a reference.
1 2 3 4 5 6 7 8 |
DTE dte = (DTE)dteObject; var targetProject = (VSProject)dte.GetProject(target).Object; var refToRemove = targetProject.References.Cast 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.
1 2 |
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