visual-studio 部署 VB.NET 应用程序的最佳方式是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3544/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:20:42  来源:igfitidea点击:

What is the best way to deploy a VB.NET application?

vb.netvisual-studioinstallerclickonce

提问by Grant

Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are.

通常当我在构建 VB.NET 程序时使用 ClickOnce 但它有一些缺点。我从来没有真正使用过其他任何东西,所以我不确定我的选择是什么。

Downsides to ClickOnce:

ClickOnce 的缺点:

  • Consists of multiple files - Seems easier to distribute one file than manageing a bunch of file and the downloader to download those files.
  • You have to build it again for CD installations (for when the end user dosn't have internet)
  • Program does not end up in Program Files - It ends up hidden away in some application catch folder, making it much harder to shortcut to.
  • 由多个文件组成 - 分发一个文件似乎比管理一堆文件和下载这些文件的下载器更容易。
  • 您必须为 CD 安装再次构建它(当最终用户没有互联网时)
  • 程序不会在程序文件中结束 - 它最终隐藏在某个应用程序捕获文件夹中,使其更难快捷访问。

Pros to ClickOnce:

ClickOnce 的优点:

  • It works. Magically. And it's built into VisualStudio 2008 express.
  • Makes it easy to upgrade the application.
  • 有用。神奇地。它内置在 VisualStudio 2008 express 中。
  • 使应用程序升级变得容易。

Does Windows Installer do these things as well? I know it dosen't have any of the ClickOnce cons, but It would be nice to know if it also has the ClickOnce pros.

Windows Installer 是否也做这些事情?我知道它没有任何 ClickOnce 的缺点,但是很高兴知道它是否也具有 ClickOnce 的优点。

Update: I ended up using Wix 2 (Wix 3 was available but at the time I did the project, no one had a competent tutorial). It was nice because it supported the three things I (eventually) needed. An optional start-up-with-windows shortcut, a start-up-when-the-installer-is-done option, and three paragraphs of text that my boss thinks will keep uses from clicking the wrong option.

更新:我最终使用了 Wix 2(Wix 3 可用,但在我做这个项目的时候,没有人有合适的教程)。这很好,因为它支持我(最终)需要的三件事。一个可选的 Windows 启动快捷方式,一个安装程序完成时启动选项,以及我老板认为可以防止用户点击错误选项的三段文字。

采纳答案by Dillie-O

Have you seen WiX yet?

你见过 WiX 吗?

http://wix.sourceforge.net/

http://wix.sourceforge.net/

It builds windows installers using an XML file and has additional libraries to use if you want to fancify your installers and the like. I'll admit the learning curve for me was medium-high in getting things started, but afterwards I was able to build a second installer without any hassles.

它使用 XML 文件构建 Windows 安装程序,并且如果您想要幻想安装程序等,还可以使用其他库。我承认我的学习曲线在开始时处于中等高度,但之后我能够毫不费力地构建第二个安装程序。

It will handle updates and other items if you so desire, and you can apply folder permissions and the like to the installers. It also gives you greater control on where exactly you want to install files and is compatible with all the standardized Windows folder conventions, so you can specify "PROGRAM_DATA" or something to that effect and the installer knows to put it in C:\Documents and Settings\All Users\Application Data or C:\ProgramData depending on if you're running XP or Vista.

如果您愿意,它将处理更新和其他项目,并且您可以将文件夹权限等应用于安装程序。它还使您可以更好地控制要安装文件的确切位置,并且与所有标准化的 Windows 文件夹约定兼容,因此您可以指定“PROGRAM_DATA”或类似的内容,安装程序知道将其放在 C:\Documents 和Settings\All Users\Application Data 或 C:\ProgramData 取决于您运行的是 XP 还是 Vista。

The rumor is that Office 2007 and Visual Studio 2008 used WiX to create their installer, but I haven't been able to verify that anywhere. I do believe is is developed by some Microsoft folks on the inside.

有传言说 Office 2007 和 Visual Studio 2008 使用 WiX 来创建它们的安装程序,但我无法在任何地方验证。我相信它是由一些微软内部人员开发的。

回答by Robbo

I agree with Joseph, my experience with ClickOnce is its great for the vast majority of projects especially in a corporate environment where it makes build, publish and deployment easy. Implementing the "forced upgrade" to ensure users have the latest version when running is so much easier in ClickOnce, and a main reason for my usage of it.

我同意 Joseph 的观点,我在 ClickOnce 方面的经验对绝大多数项目都非常有用,尤其是在企业环境中,它使构建、发布和部署变得容易。在 ClickOnce 中实施“强制升级”以确保用户在运行时拥有最新版本要容易得多,这也是我使用它的一个主要原因。

Issues with ClickOnce: In a corporate environment it has issues with proxy servers and the workarounds are less than ideal. I've had to deploy a few apps in those cases from UNC paths...but you can't do that all the time. Its "sandbox" is great, until you want to find the executable or create a desktop shortcut.

ClickOnce 的问题:在公司环境中,它存在代理服务器问题,并且解决方法不太理想。在这些情况下,我不得不从 UNC 路径部署一些应用程序……但你不能一直这样做。它的“沙箱”很棒,直到您想要找到可执行文件或创建桌面快捷方式。

Have not deployed out of 2008 yet so not sure if those issues still exist.

2008 年之后还没有部署,所以不确定这些问题是否仍然存在。

回答by Pat

ClickOnce can be problematic if you have 3rd party components that need to be installed along with your product. You can skirt this to some extent by creating installers for the components however with ClickOnce deployment you have to create the logic to update said component installers.

如果您的产品需要安装 3rd 方组件,则 ClickOnce 可能会出现问题。您可以通过为组件创建安装程序来在一定程度上避免这种情况,但是对于 ClickOnce 部署,您必须创建更新所述组件安装程序的逻辑。

I've in a previous life used Wise For Windows Installer to create installation packages. While creating upgrades with it were not automatic like ClickOnce is, they were more precise and less headache filled when it came to other components that needed to be registered/added.

我以前曾使用 Wise For Windows Installer 创建安装包。虽然使用它创建升级不像 ClickOnce 那样自动,但当涉及到需要注册/添加的其他组件时,它们更精确并且更少令人头疼。

回答by Greg Hurlman

Creating an installer project, with a dependency on your EXE (which in turn depends on whatever it needs) is a fairly straightforward process - but you'll need at least VS Standard Edition for that.

创建一个安装程序项目,依赖于你的 EXE(这又取决于它需要的任何东西)是一个相当简单的过程 - 但你至少需要 VS 标准版。

Inside the installer project, you can create custom tasks and dialog steps that allow you to do anything you code up.

在安装程序项目中,您可以创建自定义任务和对话步骤,允许您执行任何您编写的代码。

What's missing is the auto-upgrade and version-checking magic you get with ClickOnce. You can still build it in, it's just not automatic.

缺少的是您通过 ClickOnce 获得的自动升级和版本检查魔法。您仍然可以内置它,它只是不是自动的。

回答by Joseph Sturtevant

I don't believe there is any easy way to make a Windows Installer project have the ease or upgradability of ClickOnce. I use ClickOnce for all the internal .NET apps I develop (with the exception of Console Apps). I find that in an enterprise environment, the ease of deployment outweighs the lack of flexibility.

我不相信有任何简单的方法可以使 Windows Installer 项目具有 ClickOnce 的易用性或可升级性。我将 ClickOnce 用于我开发的所有内部 .NET 应用程序(控制台应用程序除外)。我发现在企业环境中,部署的简易性胜过缺乏灵活性。