简体   繁体   中英

Nuget: script for removing a DLL reference in 'uninstall.ps1'

Somewhere in the mists of time I found an example of a Nuget uninstall.ps1 script to remove a DLL reference that I've been blindly copying ever since. This is it:

param($installPath, $toolsPath, $package, $project)
$project.Object.References.Remove("Dll.Name");

But now when invoking a package uninstall I'm getting an error saying that Remove is not a method. What script should I be using to remove a DLL reference?

It does not look like References has a Remove method. You can use the following if you know the assembly name.

$project.Object.References.Item("System.Xml.Linq").Remove()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM