可以将ClickOnce配置为删除旧的已发布目录吗? [英] Can ClickOnce be configured to delete off old published directories?

查看:67
本文介绍了可以将ClickOnce配置为删除旧的已发布目录吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

当前,每次完成一次ClickOnce发布后,都会在IIS服务器上创建一个新目录.此NEW目录包含整个应用程序的副本,该副本已下载.旧目录似乎不再使用,仅占用了大量空间.

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.

这里是正在创建的目录名称的示例.如您所见,名称中使用的是应用程序版本号.
EduBenesysNET_1_0_1_0
EduBenesysNET_1_0_1_1
….
EduBenesysNET_1_0_1_192
EduBenesysNET_1_0_1_193

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

我们有194(从零开始)构建,每个目录都在那里.在一个版本的大小约为50mb的情况下,您可以看到将旧目录保存在那里的方式将开始蚕食磁盘空间.

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.

推荐答案

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

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

再仔细一点即可发现,观察到的发布行为实际上并不是ClickOnce技术的功能,而是

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:

如果您使用Mage或自定义工具手动生成或更新ClickOnce应用程序出版物,您将不受此文件夹和文件结构的约束.对于任何特定的ClickOnce出版物,依赖项链包括以下内容:[...] [重点]

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]

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

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.

不幸的是,VS Publish Wizard似乎并没有提供删除旧版本的功能,至少在某些地方它既不可见也不可见.但是,鉴于生成的文件夹结构只是构建过程的产物,您不妨添加一个自定义构建步骤来执行此操作-确定详细信息(即访问VS自动化属性以获取最新发布的版本等)是不过不在您的问题范围内;)

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

关于您的子问题:

我希望删除旧目录应该不是问题.

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

绝对不是问题,这仅取决于最终要为回滚操作保留的数量,例如我可以从发布位置删除以前的旧版本吗?是由ClickOnce创建的吗?

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?

这篇关于可以将ClickOnce配置为删除旧的已发布目录吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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