I think perhaps you're overestimating what Installer classes do. MSI
setups existed before .NET came along. The vast majorty of install work
(copying files, registering COM classes, type libraries, installing
Services, starting/stopping Services, file extension handlers, putting
things in the registry etc) can all done with built-in MSI capability.
There's no code that users need to write because MSI does all that.
Custom actions are the way you add your own code to this process for
whatever reason (hopefully not to do what the built-in stuff can already
do). VS made a design decision that its custom actions would be called
at the end of the install, probably because by then your files and
registry entries are actually installed and also so that you aren't
exposed to the complications of MSI internals. 

Phil Wilson 
and yes, this is a shameless plug:
http://apress.com/book/bookDisplay.html?bID=280

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Ritchie
Sent: Friday, December 02, 2005 12:28 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Reading registry key and writing it into
propety during installation

As far as I can tell, there is at least one Installer-derived class
whose Install override peforms the file copy.  If you could get your
Installer- derived object to be the first item in the Installers
collection you should be able to do something before the file copy.

It that's correct, you should also be able to do pre-copy logic in the
c'tor for a Installer-derived object.

I haven't confirmed this; so, I could be completely off base.  It
doesn't seem logical (to me) that Installer classes are instantiated
after the file copy to cause the install to fail and rollback.  (But,
there's lots of things that have been done that haven't seemd logical to
me :-)

Can anyone confirm or deny inferences?

On Fri, 2 Dec 2005 12:10:01 -0800, Wilson, Phil D
<[EMAIL PROTECTED]>
wrote:

> It *is* pretty basic to want to do something before files are copied, 
>and people do it all the time, but VS setup projects have never exposed

>all the functionality of Windows Installer and MSI files.  There are a 
>whole bunch of tools to create MSI files these days, some expensive, 
>some free (like Wix) but VS setup projects are pretty much at the low 
>end of the capability spectrum.
>
>There all kinds of custom actions: programs, scripts, C++ Dll function 
>calls. The VS folks decided to invent managed custom actions to let 
>people call Installer classes as custom actions, and that's done by 
>having the MSI call a standard C++ Dll custom action in a shim Dll, 
>InstallUtilLib.dll, that then locates your assembly and uses reflection

>to locate and instantiate your Installer class and its methods. If you 
>can code a straight C++ Dll function, that's much more straightforward 
>and more functional than an Installer class custom action (but you 
>still can't sequence it at the start of the installation in a VS setup 
>project).
>
>Phil Wilson
>
>-----Original Message-----
>From: Discussion of advanced .NET topics.
>[mailto:[EMAIL PROTECTED] On Behalf Of Peter Ritchie
>Sent: Friday, December 02, 2005 11:10 AM
>To: [email protected]
>Subject: Re: [ADVANCED-DOTNET] Reading registry key and writing it into

>propety during installation
>
>I haven't used them personally; but, does anyone know if an "installer 
>class" has the same limitation as a "custom action".  Or, is a "custom 
>action" implemented as an "installer class"?
>
>Seems pretty basic to be able to do something before files are copied 
>during deployment.
>
>
>On Fri, 2 Dec 2005 17:59:45 +0100, =?ISO-8859-2?Q?Stanislav_Pe=BBko?=
><[EMAIL PROTECTED]> wrote:
>
>>This does not solve my problem, because custom actions can be run 
>>after
>
>>the installation. I need this before the real installation. When the 
>>setup wizard runs, the second or third form is about the directory, 
>>where program will be installed. I need to read value from registry 
>>and
>
>>set the property before this form is displayed, to have directory 
>>predefined.
>>
>>It really seems, this can't be done using VS2003, but I need to use 
>>some 3rd party installer tool.
>>
>>
>>Ok, thanks for the ideas anyway,
>>
>>Stano.
>>
>>
>>
>>Peter Ritchie wrote:
>>
>>>See "Walkthrough: Creating a Custom Action" in the "Deploying with 
>>>Visual Studio.NET" help. (online at
>http://msdn.microsoft.com/library/default.asp?
>>>url=/library/en-us/vsintro7/html/vxwlkwalkthroughcreatingcustomaction
.
>>>asp or tinyurl-ized: http://tinyurl.com/eyvbs)  It's an example in 
>>>Visual Basic; but using C# instead would be trivial.
>>>
>>>http://www.peterRitchie.com/
>>>
>>>On Fri, 2 Dec 2005 15:25:56 +0100, =?ISO-8859-2?Q?Stanislav_Pe=BBko?=
>>><[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>>>Do you have link to some resources about this?
>>>>
>>>>Stano
>>>>
>>>>
>>>>Baris Acar wrote:
>>>>
>>>>
>>>>
>>>>>Well,
>>>>>As far as I remember you can plug some of your routines in your 
>>>>>setup project, thus reach any framework class including Registry.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to