NuGet Uninstall.ps1

编程入门 行业动态 更新时间:2024-10-26 08:28:46
本文介绍了NuGet Uninstall.ps1 - 删除项目引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以在我的 Install.ps1 中,我可以添加这样的引用:

So in my Install.ps1 I can add a reference like this:

param($installPath, $toolsPath, $package, $project) $project.Object.References.Add("YourDLL")

如何在 PowerShell 中删除项目引用?

How do you remove a project reference in PowerShell?

推荐答案

在 powershell 中执行此操作存在一些强制转换问题.

There are some casting issues to do this in powershell.

这是删除引用的 c#.

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(); }

如果您想使用解决方案工厂 nuget 包,您可以使用解决方案工厂添加的 powershell 命令.

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

这是解决方案工厂源的链接 solutionfactory.codeplex/SourceControl/network/Forks/erihexter/PowershellRewrite

Here is a link the the solution factory source solutionfactory.codeplex/SourceControl/network/Forks/erichexter/PowershellRewrite

更新:解决方案工厂的新网址:github/erichexter/SolutionFactory

Update: new url for solution factory: github/erichexter/SolutionFactory

更多推荐

NuGet Uninstall.ps1

本文发布于:2023-11-07 14:48:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566741.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NuGet   Uninstall

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!