简体   繁体   English

Nuget:用于删除“ uninstall.ps1”中的DLL参考的脚本

[英]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. 某处在时间的迷雾,我发现一个的NuGet uninstall.ps1脚本示例删除DLL的参考,我一直在盲目照搬至今。 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? 我应该使用哪个脚本来删除DLL参考?

It does not look like References has a Remove method. 看起来引用没有具有Remove方法。 You can use the following if you know the assembly name. 如果知道程序集名称,则可以使用以下内容。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有NuGet依赖项的参考DLL - Reference DLL with NuGet dependencies 使用从 C# DLL 获取 PS 脚本名称? 获取“对象引用未设置为 object 的实例。” - Using to get PS script name from a C# DLL? Getting "Object reference not set to an instance of an object." 我应该使用NuGet还是DLL参考? - Should I use NuGet or DLL reference? 重新安装nuget时出现多个dll参考失败 - Multiple dll reference failure on nuget reinstall 如何调试 NuGet package 的 install.ps1 脚本 - How to debug install.ps1 script of NuGet package NuGet:在不创建引用的情况下复制 .DLL 文件? - NuGet: Copying .DLL file without creating a reference? 在install.ps1 nuget脚本中获取所有项目“种类” - Getting all project “kinds” in a install.ps1 nuget script Xamarin Linker 删除对第三方的引用 dll - Xamarin Linker removing reference to third party dll 如何将 dll 作为引用包含在 nuget 中,当 nuget 添加到项目时,该引用也被复制为引用 - How do I include dll as reference in nuget that also gets copied as reference when nuget added to project NuGet包无法为lib目录中的DLL添加对项目的引用 - NuGet Package fails to add reference to project for DLL inside lib directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM