在桌面上部署 .NET (C#) exe 应用程序
我使用 MSVC 2010 Express、Forms/WPF/等在 C# 中开发应用程序。
应用程序由一些私有程序集(可能是 DLL)和 .exe 文件组成。它使用 .NET 4 功能。
如何将此应用程序部署到其他计算机?当然,如果他们有 .NET 4,我只需发送带有 .dll 的 .exe 的 zip 文件就可以了。但如果他们根本没有.NET(在 Win XP 机器上)怎么办?或者也许他们有较低版本的.NET?我应该指示他们从互联网安装 .NET 还是将其与我的应用程序一起打包还是什么?
谢谢
I develop application in C# with MSVC 2010 Express, with Forms/WPF/etc.
Application consist of some private assemblies (maybe DLLs) and .exe file. It uses .NET 4 features.
How I deploy this application to other computers? Of course if they have .NET 4 I just can send zip of .exe with .dlls and it work. But if they don't have .NET at all (on Win XP machine)? Or maybe they have lower version of .NET? Should I point them to install .NET from internet or package it with my app or what?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
微软提供了单击一次部署。它会自动执行大部分任务,包括确保您拥有正确的 .Net 版本以及在有新版本的应用程序可用时更新应用程序。
There is click-once deploy from microsoft. It automates most of the tasks, including making sure you have the right .Net version and updating the app if a new version of your app is available.
您应该创建一个安装程序包。如果您使用的是 Visual Studio 的 Express 版本,则可以使用一些免费工具,例如 WiX 或 Inno Setup。 WiX 可能是一个很难开始的选择,但它具有很大的灵活性。有教程和示例项目可供修改以适应您的需求。
http://www.tramontana.co.hu/wix/
此工具创建的安装程序可以检查用户计算机上是否安装了特定版本的 .NET Framework 以及其他条件。您还可以将 .NET 可再发行组件包含在程序包中,或指示用户下载并安装它。
You should create a installer package. If you are using the express versions of visual studio, you can use some free tools for this like WiX or Inno Setup. WiX is perhaps a difficult option to start with, but has a lot of flexibility. There are tutorials and example projects to modify to adapt them to your needs.
http://www.tramontana.co.hu/wix/
This tools create installers that can check if a certain version of the .NET framework is installed on the user computer, among other conditions. You can also include the .NET redistributable in your package, or point the user to download and install it.
我们尝试使部署尽可能简单,我们所做的一件事就是确保我们的应用程序只是一个可执行文件,不需要支持文件。
我们需要采取以下几个步骤来实现这一目标:
我们的下载站点上有以下内容:
We try to keep deployment as simple as possible, and one of the things we do is to ensure our application is just a single executable, no support files needed.
We several steps to get there:
We the following on our downloads site:
http://support.microsoft.com/kb/324733
http://support.microsoft.com/kb/324733
是的,您应该指示他们安装 .NET。否则他们将无法运行您的应用程序。
Yes, you should point them to install .NET. Otherwise it won't be possible for them to run your application.
你没有说他们是什么类型的客户(你是在制作一个小应用程序供你的朋友使用还是他们是付费客户),但无论哪种情况,我总是完全反对发送带有说明的 zip 文件描述如何处理它以及将其提取到哪个文件夹的文档。正如 Remy 所说,ClickOnce 并不是一个坏主意,但我发现设置起来有点麻烦(不过,一旦设置好,它就可以正常工作)。另一方面,部署项目更简单,如果我是你,这将是我首先要探索的事情。
You didn't say what type of clients they are (are you making a small app for your friends to use or are they paying customers), but whatever the case may be, I'm always completely against sending a zip file with an instruction document describing what to do with it and what folder to extract it to. As Remy said, ClickOnce is not a bad idea, but I've found it to be a bit of a pain to set up (once you get it set up, though, it works just fine). On the other hand, a Deployment project is simpler and if I were you, that would be the first thing I'd explore.
在这里使用xenocode
http://spoon.net/Studio/
无需安装任何东西。
它将您的 exe 间接转换为 Native 代码,您可以在 Windows 系统上的任何地方运行。
它还具有一些在内部添加框架的选项,总 exe 大小将约为 10MB + 您的应用程序 exe 大小。
谢谢
Use xenocode here
http://spoon.net/Studio/
No need to install anything.
It converts your exe to Native code indirectly and you can run anywhere on windows system.
It also has some option of adding framework inside and the total exe size will be somewhere arround 10MB + Your application exe size..
Thanks
是的!您必须提供一些有关运行软件的先决条件的一般说明,并且您可以提及框架版本 3.5 或 4.0 以及您需要的其他实用程序。
请参阅此文档,选择 Visual Studio 2010 中的部署策略,这可能会对您有所帮助
http://msdn.microsoft.com/en-us/library/e2444w33。 ASPX
yes! you have to give some general instruction about prerequisites to run your software and in that you can mention the Framework version 3.5 or 4.0 and other utilities you require.
please refer this document for Choosing a Deployment Strategy in Visual studio 2010 may this can help you
http://msdn.microsoft.com/en-us/library/e2444w33.aspx
当你打包你的应用程序时,你应该包含.NET Framework
when you package you application,you shoud include the .NET Framework
查看 Inno:http://www.jrsoftware.org/isinfo.php
它是免费的并且非常简单。
OTOH 我见过 QTTabBar 在其代码库中使用它,它实际上是一个文本文件(setup.iss)。让我看看是否可以找到他们的 SourceForge 页面的 URL,以便您可以看到源代码和构建...就是它 http://qttabbar.svn.sourceforge.net/viewvc/qttabbar/trunk/Install/ 如果您获取源代码树,您可能可以将其重新适合您的应用程序一天之内。
Check out Inno : http://www.jrsoftware.org/isinfo.php
It's free and pretty simple.
OTOH I've seen QTTabBar using it in its' codebase and it was literally one single text file (setup.iss). Let me see if I can find URL to their SourceForge page so you can see the source and the build ... There is it http://qttabbar.svn.sourceforge.net/viewvc/qttabbar/trunk/Install/ If you grab the source tree you can probably re-fit it for your app in a day.