如何将 C# 应用程序分发到具有未知版本 .Net 的计算机?
我编写了一个小应用程序,需要分发到 700 多台计算机,问题是这些计算机可以运行任何版本的 Windows(尽管很可能是 XP 或更好),并且安装了任何版本的 .Net 框架,并且所有互联网连接都来自 OC3拨号。
我考虑过将 .Net 与我的应用程序捆绑在一起,但 .net 安装程序至少有 39mb,对于使用拨号的人来说,这实际上需要几个小时。
那么有没有一种方法可以捆绑应用程序所需的特定 DLL,或者将整个内容转换为本机代码?
谢谢 - 麦克风
I wrote a small app that I need to distribute to 700+ computers, the problem being that the computers can be running any version of Windows (though most likely XP or better) with any version of .Net framework installed with internet connections all from OC3 to dialup.
I considered bundling .Net with my application but the .net installer is at least 39mb and that would literally take hours for someone with dialup.
So is there a way I can either bundle the specific DLLs that the application needs, or convert the whole thing to native code?
Thanks
--Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用安装程序。
Microsoft 提供了一个基本解决方案,以便您可以检查依赖项(如果缺少,则安装它们),以确保您部署应用程序的计算机满足应用程序的最低框架(和依赖项)要求。
如果您需要更复杂的东西,您可以使用 Nullsoft 脚本化安装系统、InstallAware,或 InstallShield。
但请记住,如果您要创建 .NET 应用程序,用户将需要以一种或另一种方式安装运行时。安装程序不会强迫您将 .NET 安装程序与您的应用程序捆绑在一起,从而使事情变得更好。它将允许用户在安装时下载 .NET 运行时。
如果您想消除对 .NET Framework 的依赖,那么您将必须用可编译为本机代码的内容重写您的应用程序(如果不安装 Framework,即使 NGEN 也无法工作)。
Use an Installer.
Microsoft provides a basic solution so that you can check for dependencies (and install them if they are missing) to ensure that the computer you are deploying your application to meets minimum Framework (and dependency) requirements for your app.
If you need something more complex, you can use something like the Nullsoft Scriptable Install System, InstallAware, or InstallShield.
Keep in mind though, if you're creating a .NET application, that the user is going to need to install the runtime one way or the other. An Installer makes things nice by not forcing you to bundle the .NET installer with your app. It will allow the user to download the .NET runtime at install time.
If you want to remove the dependency on the .NET Framework, then you're going to have to rewrite your application in something that compiles down into native code (even NGEN won't work without the Framework being installed).
这是可能做到的,但不是一种简单或廉价的方法。
例如,参见
http://www.remotesoft.com/
It's possible to be done, but not an easy or cheap way.
For example, see
http://www.remotesoft.com/
如果他们没有您需要的运行时环境,那么您就很难找到 .Net 解决方案。使用安装程序,您可以安装适当的运行时环境(如果不存在)。
实际上,如果您绝对担心人们下载该框架的一部分,那么最好的选择就是不要使用它。在用本机代码重写应用程序之前,我会真正查看您的受众,看看他们没有它的可能性有多大,以及他们的连接速度是多少。
如果您不想用本机代码编写它,您的另一个选择是使用较低版本的框架。 1.1 的市场渗透率将比 4.0 的市场渗透率高得多。
If they don't have the runtime environment you need, you're pretty much out of luck with a .Net solution. With an installer, you can install the appropriate runtime environment if it's not there.
Really, if you are absolutely concerned about people downloading part of the framework, you best bet is to not use it. Before rewriting the app in native code though I would really look at your audience to see how likely it is that they don't have it, and what is their connection speed.
If you don't want write it in native code, your other bet is to use a lower version of the framework. The market penetration will be much greater for 1.1 than say 4.0.
来自维基百科(不是绝对权威,但通常对此类事情是可靠的):
因此 Windows 7 也将包含此功能。
因此,您真正需要担心的只是您的 XP 客户端。
我最近不得不重新安装 Windows XP,当我获得 SP3 和所有后续补丁时,我也安装了 .NET 3.5。虽然我也安装了 Visual Studio,但我不能 100% 保证每个人都会安装必要的 .NET 版本,但它会占很大比例,所以你可能会过度担心。
From Wikipedia (not the absolute authority, but usually reliable about this sort of thing):
So Windows 7 will include this as well.
Therefore, it's only really your XP clients you have to worry about.
I recently had to reinstall Windows XP and by the time I'd got SP3 and all the subsequent patches I had .NET 3.5 installed as well. Though as I was installing Visual Studio as well I can't give you a 100% guarantee that everyone will have the necessary version of .NET installed, but it's going to be a significant proportion, so you might be worrying unduly.
不要使用.NET。如果您无法控制环境,需要广泛分发,并且不想要求 30 MB 下载,那么您几乎会陷入使用本机代码的境地。你最好的选择是 C++。
或者,正如其他人所建议的,您可以尝试使用 Remotesoft 之类的东西。
Don't use .NET. If you have no control over the enviornment, need wide distribution, and don't want to require 30 MB download, then you are pretty much stuck using native code. Your best bet would be C++.
Alternatively, as others have suggested, you could try using something like Remotesoft.