部署,无需安装运行Visual Studio应用程序的最佳方法 [英] Best way to deploy Visual Studio application that can run without installing

查看:165
本文介绍了部署,无需安装运行Visual Studio应用程序的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了使用C#/。NET一个相当简单的应用程序,并不能想出发布它的好方法。这是一个排序的工具用户将只运行一次,或运行每隔几个月的。正因为如此,我希望有一种方法它不需要安装运行(它可能只是通过双击EXE文件,下载后直接运行),我可以部署它。

但是,它仍然需要(在某种程度上),包括.NET,图书馆等的正确版本,以便正常运行。我知道这是包括使用ClickOnce的时候,却仍然安装应用程序到用户的计算机上。

有没有一种方法可以做到这一点?

编辑 - \\ BIN \\调试

  myAppName.application
myAppName.exe
myAppName.exe.config
myAppName.exe.manifest
myAppName.pdb
myAppName.vshost.application
myAppName.vshost.exe
myAppName.vshost.exe.config
myAppName.vshost.exe.manifest
extraLibrary.dll

以及两个文件夹

  app.publish
资源


解决方案

这是可能的,看似简单的:


  1. 发布应用程序(,比方说,在驱动器C的一些文件夹),无论是从菜单中的构建的或从项目的属性 - >发布。这将创建一个安装程序的ClickOnce应用程序。

  2. 不过的而不是使用所产生的安装程序的,找到生成的文件(EXE文件和的.config 名为.manifest 。应用的文件,以及任何DLL文件等) - 它们都在同一个文件夹,通​​常在下面的斌\\调试文件夹项目文件(的.csproj 的)。

  3. 邮编该文件夹(遗漏任何的 *虚拟主机。* 的文件和 app.publish 文件夹(不需要它们),以及该.pdb文件,除非你预见你的用户的系统(例如,通过遥控器))直接调试,并将其提供给用户。

另外一个好处是,作为一个ClickOnce应用程序,它不需要管理员权限才能运行(如果您的应用程序遵循哪些文件夹用于应用程序数据的正常准则,等等)。

对于.NET,您可以检查.NET的最低版本安装(或全部)应用程序(大多数用户将已经安装)和present一个链接到一个对话框在微软网站上下载页面(或点到您的网页可能会重定向到微软网页之一 - 这使得它更加坚固,如果微软URL变化)。由于它是一个小工具,你可以面向.NET 2.0,以减少用户的概率必须安装.NET。

它的工作原理。我们使用的开发和测试过程中这种方法,以避免不必不断卸载和安装该应用程序,仍然是相当接近最终应用将运行方式。

I wrote a fairly simple application with C#/.NET and can't figure out a good way to publish it. It's a sort of a "tool" that users would only run once, or run every few months. Because of this, I'm hoping that there is a way I could deploy it where it wouldn't need installing to run (it could just be run by double clicking an EXE file straight after downloading).

However, it still needs (somehow) to include the correct version of .NET, libraries, etc. so it will run correctly. I know this is included when using ClickOnce, but that still installs the application onto the user's computer.

Is there a way this can be done?

EDIT - \bin\Debug

myAppName.application
myAppName.exe
myAppName.exe.config
myAppName.exe.manifest
myAppName.pdb
myAppName.vshost.application
myAppName.vshost.exe
myAppName.vshost.exe.config
myAppName.vshost.exe.manifest
extraLibrary.dll

as well as two folders

app.publish
Resources

解决方案

It is possible and is deceptively easy:

  1. "Publish" the application (to, say, some folder on drive C), either from menu Build or from the project's properties -> Publish. This will create an installer for a ClickOnce application.
  2. But instead of using the produced installer, find the produced files (the EXE file and the .config, .manifest, and .application files, along with any DLL files, etc.) - they are all in the same folder and typically in the bin\Debug folder below the project file (.csproj).
  3. Zip that folder (leave out any *.vhost.* files and the app.publish folder (they are not needed), and the .pdb files unless you foresee debugging directly on your user's system (for example, by remote control)), and provide it to the users.

An added advantage is that, as a ClickOnce application, it does not require administrative privileges to run (if your application follows the normal guidelines for which folders to use for application data, etc.).

As for .NET, you can check for the minimum required version of .NET being installed (or at all) in the application (most users will already have it installed) and present a dialog with a link to the download page on the Microsoft website (or point to one of your pages that could redirect to the Microsoft page - this makes it more robust if the Microsoft URL change). As it is a small utility, you could target .NET 2.0 to reduce the probability of a user to have to install .NET.

It works. We use this method during development and test to avoid having to constantly uninstall and install the application and still being quite close to how the final application will run.

这篇关于部署,无需安装运行Visual Studio应用程序的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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