How do I distribute C# apps to computers with an unknown version of .Net?
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 m开发者_运维问答y 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
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).
It's possible to be done, but not an easy or cheap way.
For example, see http://www.remotesoft.com/
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.
From Wikipedia (not the absolute authority, but usually reliable about this sort of thing):
Windows Vista includes version 3.0 of the .NET Framework.
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.
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.
精彩评论