home *** CD-ROM | disk | FTP | other *** search
-
- <!-- #include virtual="/quickstart/howto/include/header.inc" -->
-
- <h4>How Do I...Execute Custom Code During Installation?</h4>
-
- <div class="indent" style="width:660">
-
- <font face="Tahoma" size="1">An application may consist not only of the
- traditional program files, but also of associated resources, such as message
- queues, event logs, and performance counters, that must be created on the
- deployment destination. You can configure your application to create these
- resources when you application is installed and to remove them if your
- application is uninstalled, using what are called <span class="Italic">installation
- components</span>. Sometimes you may wish to run custom code during the
- installation and uninstallation process.</font>
-
- <p><font face="Tahoma" size="1">This sample illustrates how to build an
- application which will run custom code when installed or uninstalled.</font></p>
-
- <p><font face="Tahoma" size="1">Run the following command line to install
- the system resources:</font></p>
-
- <blockquote>
- <p><font face="Courier New" size="2" color="#0000FF">> InstallUtil.exe
- CustomAction.exe</font></p>
- </blockquote>
-
- <p><font face="Tahoma" size="1">Note that the message "Installing: Any code could be executed here!"
- message is printed to the console. You can substitute the line which
- prints the message (see CustomInstaller.cs file) for any custom code you want to
- be executed during installation process.</font></p>
-
- <p><font face="Tahoma" size="1">You can execute different custom code while
- uninstalling:</font></p>
-
- <blockquote>
- <p><font face="Courier New" size="2" color="#0000FF">>InstallUtil.exe /u
- CustomAction.exe</font></p>
- </blockquote>
-
- </div>
-
- <h4>Example</h4>
-
- <p>
- <div class="indent">
- <a target="_blank" href="/quickstart/howto/samples/Services/Installers/CustomAction">
- <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
- </a>
- <div class="caption">CustomAction.exe</div><br>
- [<a target="_blank" href="/quickstart/howto/samples/Services/Installers/CustomAction">View Sample</a>] |
- [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/Installers/CustomAction/CustomAction.src">View Source</a>]<p>
- </div>
-
- <h4>Source Code</h4>
-
- <div class="code">
- <xmp>
- <!-- #include virtual="/quickstart/howto/samples/Services/Installers/CustomAction/CustomAction.cs" -->
- </xmp>
- </div>
-
- <!-- #include virtual="/quickstart/howto/include/footer.inc" -->