ClickOnce 是否可以配置为删除旧的已发布目录?

发布于 2024-09-25 18:48:55 字数 518 浏览 1 评论 0原文

可以将 ClickOnce 配置为删除旧的发布目录吗?

或者

是否有人编写了一些代码来删除这些发布目录(也许保留最后 10 个目录)?

目前,每次ClickOnce 发布完成后,将在 IIS 服务器上创建新目录。这个新目录包含已下载的整个应用程序的副本。旧目录似乎不再使用,并且占用了大量空间。

以下是正在创建的目录名称的示例。正如您所看到的,名称中使用了应用程序版本号。
EduBenesysNET_1_0_1_0
EduBenesysNET_1_0_1_1
....
EduBenesysNET_1_0_1_192
EduBenesysNET_1_0_1_193

我们已经进行了 194 个(从零开始)构建,每个目录都保留在那里。由于一个构建的大小约为 50mb,您可以看到保留旧目录将如何开始消耗磁盘空间。

我们的应用程序的工作方式是您始终必须下载最新版本。您无法选择跳过下载,因此我希望删除旧目录应该不是问题。

Can ClickOnce be configured to delete off old published directories?

Or

Has anyone written some code that will delete off these publish directories (maybe keeping the last 10)?

Currently, every time a ClickOnce Publish is done a new directory is being created on the IIS Server. This NEW directory contains a copy of the whole application, which is downloaded. The old directories do not seem to be used anymore and is just taking up a lot of space.

Here is a sample of the directory names being created. As you can see the application version number is being used in the name.
EduBenesysNET_1_0_1_0
EduBenesysNET_1_0_1_1
….
EduBenesysNET_1_0_1_192
EduBenesysNET_1_0_1_193

We have had 194 (zero based) builds with each directory staying out there. With the size of one build being about 50mb, you can see how keeping the old directories out there will start to eat away at the disk space.

The way our application works is you always have to download the latest version. You do not have an option to skip the download so I am hoping that deleting off the old directories should not be a problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淤浪 2024-10-02 18:48:55

好问题 (+1) - 人们会认为这应该以某种方式可能......

仔细观察会发现观察到的发布行为实际上并不是 ClickOnce 技术的功能,而是 Visual Studio 发布向导 - 请参阅示例部分 ClickOnce 发布文件夹结构 ClickOnce 发布流程

如果您使用 Mage 或自定义工具手动生成或更新 ClickOnce 应用程序发布,您将不受此文件夹和文件结构的限制。对于任何特定的 ClickOnce 发布,依赖关系链包括以下内容:[...] [强调我的]

演练:手动部署 ClickOnce 应用程序 得出相同的结论,即 VS 使用的文件夹结构只是一种(合理的)约定/方法。

不幸的是,VS 发布向导似乎确实不提供删除旧版本的功能,至少它既不可见也不在某处记录。但是,鉴于生成的文件夹结构只是构建过程的产物,您不妨添加一个自定义构建步骤来执行此操作 - 弄清楚详细信息(即访问 VS 自动化属性以派生最后发布的版本等)不过,这超出了您的问题范围;)

关于您的子问题:

我希望删除旧目录不会成为问题。

绝对不是问题,这仅取决于您最终希望保留多少个用于回滚操作,请参见例如 我可以从 ClickOnce 创建的发布位置删除以前的旧版本吗?

Good question (+1) - one would think that this should be possible somehow ...

Looking a bit closer though reveals that the observed publishing behavior is not actually a feature of the ClickOnce technology, rather one of the Visual Studio Publish Wizard - see for example section ClickOnce publish folder structure in ClickOnce Publishing Process:

If you manually generate or update a ClickOnce application publication using either Mage or a custom tool, you are not constrained to this folder and file structure. For any particular ClickOnce publication, the chain of dependencies includes the following: [...] [emphasis mine]

The Walkthrough: Manually Deploying a ClickOnce Application yields the same conclusion, i.e. the folder structure in use by VS is simply a (reasonable) convention/approach.

Unfortunately the VS Publish Wizard doesn't seem to offer deleting older versions indeed, at least it is neither visible nor documented somewhere. However, given the resulting folder structure is just an artifact of the build process, you might as well add a custom build step doing just that - figuring out the details (i.e. accessing the VS automation properties to derive the last published version etc.) is outside of the scope of your question though ;)

Regarding your sub question:

I am hoping that deleting off the old directories should not be a problem.

Definitely not a problem, it just depends on how many of these you want to keep for rollback operations eventually, see e.g. Can I delete previous old versions from Publishing Location created by ClickOnce?

晚雾 2024-10-02 18:48:55

简而言之,这不是 Visual Studio 或 ClickOnce 部署中内置的内容,您必须找到另一种方法来执行此操作,也许是通过在服务器上运行的脚本。

如果您按需求推送更新,则可以删除除当前版本之外的所有版本。如果您不这样做,您将需要保留两个版本,以防用户恢复回某个版本。

The short answer is that this is not something that is built into Visual Studio or ClickOnce deployment, and you will have to find another way to do this, perhaps through a script that you run on your server.

You can delete all of the versions except the current one if you push updates as required updates. If you don't do that, you'll want to keep two versions in case the user reverts back a version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文