开发者

Coded installer

Is it ok to code your 开发者_Go百科own c# application in order to create your installer (I mean code the installer, an not use InstallShield or Visual Studio setup project or anything else?


Yes, it's "okay" to do that, but I question the desire -

The problem with doing this is two fold:

  1. You're doing a lot of work that an installation program can do for you, and probably do better, as they've been tested heavily. Why avoid a perfectly good tool that does a reasonable job in order to develop your own (likely poor) substitute?

  2. If you code this in C#, you'll have a requirement that the .NET framework be installed prior to your installer being able to execute. Normally, a native bootstrapper makes sure the framework is installed before calling your installer.


If by ok you mean recommended then no, you should use ClickOnce instead, it is a lot easier/faster than coding you own solution.


In a sense, you're going to be reinventing the wheel, and the odds are good that, depending on the complexity of your install, you're going to get it wrong. Installers know how to call into the setup api correctly to register the application for uninstall. They know how to correctly install a windows service, create start menu items, set up shortcuts, etc, ....

I heartily recommend WiX, personally. It gives you all of the flexibility of an MSI-based install, with the flexibility and easy of an xml-based script.

It's very easy to write a batch script to xcopy an app into place and create some registry entries. It's not trivial to make sure that the installer rolls back the transaction if any part of the install fails. This is inherent to an MSI install, and is the preferred way to deliver an application.

If you don't want to learn WiX, and don't care about using an MSI (database-based, transactional) install, at least take a look at NSIS. It's incredibly easy to do a basic installer in only a couple lines of script, and it'll at least call the setup APIs correctly. Plus, you get a nice GUI. See http://nsis.sourceforge.net

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜