How can I use Studio Shell to replace all references from within a solution?

Feb 4, 2014 at 1:37 PM
I have tried this kind of line

get-childitem Solution/Projects | foreach-object{$_.References} | where {$_.Name -like "nunit"} | remove-item

but it this wasn't getting me anywhere.
Any ideas?
Feb 5, 2014 at 1:53 PM
I just tried this, and it doesn't work. It doesn't look possible.

§ DTE:\solution\projects\ClassLibrary1\References>dir| select | where {$_.name -match '^nunit';$_.Remove()}

Exception calling "Remove" with "0" argument(s): "This reference cannot be removed from the project because it is always
referenced by the compiler."
At line:1 char:55
  • dir| select | where {$_.name -match '^nunit';$_.Remove <<<< ()}
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : DotNetMethodException
Coordinator
Feb 5, 2014 at 7:11 PM
Try this:

cd dte:/solution/projects

DTE:\solution\projects>dir | where { test-path "$($_.pspath)/references" } | dir -path {"$($_.pspath)/references/nunit"} | select -expand pspath | remove-item
Feb 6, 2014 at 9:22 AM
So how to I use new-item to add a reference?