如何防止必备文件在应用程序部署文件夹中重复?
我有一个 .NET 3.5 SP1 WinForms 应用程序。我已使用以下设置将其设置为 ClickOnce 部署:
- 发布到位置:\\fileserver\installers\myapp\
- 先决条件:Windows Installer 3.1、.NET Framework 3.5 SP1
- 从以下位置下载先决条件:\\fileserver\installers\common\
- 应用程序可脱机使用(安装到添加/删除程序和开始菜单)
我们的用户很可能无法访问互联网或已安装 3.5。由于它们都位于公司内联网上,因此我们已将必要的安装程序放在他们都可以访问的网络共享位置上。
在缺少 .NET 3.5 的计算机上测试安装时,一切正常。它安装了先决条件和应用程序,并且启动没有问题。
问题是,每次我部署应用程序(通过“发布”按钮)时,Visual Studio 2008 都会坚持将所有必备文件/文件夹从我的开发 PC 复制到网络位置(installers\myapp)。这导致我的 20MB 应用程序在文件夹中约为 200MB。这有效地复制了所有内容,因为大约 200MB 的先决条件已经位于 installers\common 文件夹中。不过,正如我所说,它安装得很好。如果我删除 VS 放入 myapp 文件夹中的先决条件,它甚至可以正常安装,大概是因为安装程序无论如何都会从公共位置获取它们(如先决条件对话框中指定的)。
这可能是一个微不足道的问题,因为没有任何问题并且会正常工作,但它很烦人,原因有两个:
- 它会减慢部署速度,因为每次我向它
- 浪费了我们文件服务器上的空间
我可以通过每次简单地删除文件夹来解决第二个问题,但这本身就是一个烦人的额外步骤。
I have a .NET 3.5 SP1 WinForms application. I have set it up for ClickOnce deployment with the following settings:
- Publish to location: \\fileserver\installers\myapp\
- Prerequisites: Windows Installer 3.1, .NET Framework 3.5 SP1
- Download prerequisites from the following location: \\fileserver\installers\common\
- Application is available offline (installs to Add/Remove Programs and Start Menu)
It is likely that our users will not have internet access or 3.5 installed already. Since they will all be on the company intranet, we've put the necessary installers on a network share location they'll all be able to access.
When testing installation on a machine that lacks .NET 3.5, everything works fine. It installs the prereqs and the app and it launches no problem.
The problem is that every time I deploy the application (via the Publish button) Visual Studio 2008 insists on copying all of the prerequisite files/folders from my development PC to the network location (installers\myapp). This causes my 20MB application to be about 200MB in the folder. This effectively duplicates everything since the ~200MB prereqs are already in the installers\common folder. As I said, though, it installs fine. It even installs fine if I delete the prereqs that VS puts in the myapp folder, presumably because the installer is getting them from the common location anyway (as specified in the Prerequisites dialog).
This is perhaps a trivial issue, since nothing goes wrong and it'll work fine, but it is annoying for two reasons:
- It slows down deployment since I have to transfer 200+ megs over the wire every time I publish a small change to the application
- It wastes space on our file server
I can resolve the second issue by simply deleting the folders every time, but that in itself is an annoying extra step.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的一件事是使用引导程序清单生成器来满足您自己的先决条件。将 URL 设置为您想要提供部署的位置。然后将VS中的选项设置为“从供应商位置下载”。
它将从您在 BMG 中设置的 URL 下载部署,并且不会在您每次发布 ClickOnce 应用程序时部署先决条件。
One thing you can do is roll your own prerequisites using the Bootstrapper Manifest Generator. Set the URL to the location where you want to serve up the deployment. Then set the option in VS to "download from vendor location".
It will download the deployment from the URL you set in the BMG, and won't deploy the prerequisites each time you publish the ClickOnce application.