Nuget更新调用uninstall.ps1然后install.ps1 [英] Nuget update calls uninstall.ps1 and then install.ps1

查看:35
本文介绍了Nuget更新调用uninstall.ps1然后install.ps1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 Nuget 更新已安装的包时,它会先调用uninstall.ps1",然后再调用install.ps1".对于我正在处理的自定义项目,我需要在uninstall.ps1"中知道调用卸载的原因是什么.是因为软件包正在更新或删除吗?基于我想要处理不同逻辑的原因.

似乎有可能知道差异,因为更新的控制台输出说:

<块引用>

解决了安装包'[Id].[Version]'的操作,正在执行脚本文件'uninstall.ps1'...

但是对于卸载它说:

<块引用>

解决了卸载包'[Id].[Version]'的操作正在执行脚本文件'uninstall.ps1'...

请注意,调用的脚本相同,但 Nuget 操作不同.Nuget 操作(安装与卸载)是否可以从某个变量、属性甚至临时文件中检索?无论使用 VS2012、VS2013 还是 VS2015,此行为似乎都相同.

解决方案

也许您可以在此处分享有关如何真正安装和更新您身边的软件包的详细步骤.你的 VS2015 和 NuGet 版本是什么?

When using Nuget to update an already installed package, it calls "uninstall.ps1" and then "install.ps1". For the custom project I am working on, I need to know in "uninstall.ps1" what the reason for the call to uninstall is. Is it because the package is being updated or removed? Based on the reason I would want to process different logic.

It seems that it might be possible to know the difference because the console output for an update says:

Resolved actions to install package '[Id].[Version]' Executing script file 'uninstall.ps1'...

but for an uninstall it says:

Resolved actions to uninstall package '[Id].[Version]' Executing script file 'uninstall.ps1'...

Notice that the script called is the same but the Nuget action is different. Is the Nuget action (install vs uninstall) retrievable from some variable, property, or even a temporary file? This behavior seems to be the same no matter if using VS2012, VS2013, or VS2015.

解决方案

Maybe you could share the detailed steps here about how you really install and update the package in your side. What is your VS2015 and NuGet version?

Alternative for Uninstall.ps1 as it is not run for nuget 3.x

I test a simple sample using the Package manager console in the latest VS2015 with NuGet 3.5, I install an old package, and then I install the new one or update it, it would remove the old version even if I didn't find the same messages as yours.

这篇关于Nuget更新调用uninstall.ps1然后install.ps1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆