home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / customaction.aspx < prev    next >
Encoding:
Text File  |  2000-06-08  |  2.5 KB  |  63 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Execute Custom Code During Installation?</h4>
  5.  
  6. <div class="indent" style="width:660">
  7.  
  8. <font face="Tahoma" size="1">An application may consist not only of the
  9. traditional program files, but also of associated resources, such as message
  10. queues, event logs, and performance counters, that must be created on the
  11. deployment destination. You can configure your application to create these
  12. resources when you application is installed and to remove them if your
  13. application is uninstalled, using what are called <span class="Italic">installation
  14. components</span>. Sometimes you may wish to run custom code during the
  15. installation and uninstallation process.</font>
  16.  
  17. <p><font face="Tahoma" size="1">This sample illustrates how to build an
  18. application which will run custom code when installed or uninstalled.</font></p>
  19.  
  20. <p><font face="Tahoma" size="1">Run the following command line to install
  21. the system resources:</font></p>
  22.  
  23. <blockquote>
  24.   <p><font face="Courier New" size="2" color="#0000FF">> InstallUtil.exe
  25.   CustomAction.exe</font></p>
  26. </blockquote>
  27.  
  28. <p><font face="Tahoma" size="1">Note that the message "Installing: Any code could be executed here!"
  29. message is printed to the console. You can substitute the line which
  30. prints the message (see CustomInstaller.cs file) for any custom code you want to
  31. be executed during installation process.</font></p>
  32.  
  33. <p><font face="Tahoma" size="1">You can execute different custom code while
  34. uninstalling:</font></p>
  35.  
  36. <blockquote>
  37.   <p><font face="Courier New" size="2" color="#0000FF">>InstallUtil.exe /u
  38.   CustomAction.exe</font></p>
  39. </blockquote>
  40.  
  41. </div>
  42.  
  43. <h4>Example</h4>
  44.  
  45. <p>
  46. <div class="indent">
  47. <a target="_blank" href="/quickstart/howto/samples/Services/Installers/CustomAction">
  48. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  49. </a>
  50. <div class="caption">CustomAction.exe</div><br>
  51. [<a target="_blank" href="/quickstart/howto/samples/Services/Installers/CustomAction">View Sample</a>] | 
  52. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/Installers/CustomAction/CustomAction.src">View Source</a>]<p>
  53. </div>
  54.  
  55. <h4>Source Code</h4>
  56.  
  57. <div class="code">
  58. <xmp>
  59. <!-- #include virtual="/quickstart/howto/samples/Services/Installers/CustomAction/CustomAction.cs" -->
  60. </xmp>
  61. </div>
  62.  
  63. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->