diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:36:37 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:36:37 -0700 |
| commit | 3f583916719eeef598d10a5d4e14ef14f008243b (patch) | |
| tree | 3d528e0ddb5c0550954217c97059d2f19cd6152a /src/samples/Dtf/Documents/Guide/Content/samplecas.htm | |
| parent | 2e5ab696b8b4666d551b2a0532b95fb7fe6dbe03 (diff) | |
| download | wix-3f583916719eeef598d10a5d4e14ef14f008243b.tar.gz wix-3f583916719eeef598d10a5d4e14ef14f008243b.tar.bz2 wix-3f583916719eeef598d10a5d4e14ef14f008243b.zip | |
Merge Dtf
Diffstat (limited to 'src/samples/Dtf/Documents/Guide/Content/samplecas.htm')
| -rw-r--r-- | src/samples/Dtf/Documents/Guide/Content/samplecas.htm | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/samples/Dtf/Documents/Guide/Content/samplecas.htm b/src/samples/Dtf/Documents/Guide/Content/samplecas.htm new file mode 100644 index 00000000..4dfed6f0 --- /dev/null +++ b/src/samples/Dtf/Documents/Guide/Content/samplecas.htm | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
| 2 | <head> | ||
| 3 | <title>Sample C# Custom Action</title> | ||
| 4 | <link rel="stylesheet" type="text/css" href="../styles/presentation.css" /> | ||
| 5 | <link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" /> | ||
| 6 | </head> | ||
| 7 | |||
| 8 | <body> | ||
| 9 | |||
| 10 | <div id="control"> | ||
| 11 | <span class="productTitle">Deployment Tools Foundation</span><br /> | ||
| 12 | <span class="topicTitle">Sample C# Custom Action</span><br /> | ||
| 13 | <div id="toolbar"> | ||
| 14 | <span id="chickenFeet"> | ||
| 15 | <a href="using.htm">Development Guide</a> > | ||
| 16 | <a href="managedcas.htm">Managed CAs</a> > | ||
| 17 | <a href="writingcas.htm">Writing CAs</a> > | ||
| 18 | <span class="nolink">C# Sample</span> | ||
| 19 | </span> | ||
| 20 | </div> | ||
| 21 | </div> | ||
| 22 | <div id="main"> | ||
| 23 | <div id="header"> | ||
| 24 | </div> | ||
| 25 | <div class="summary"> | ||
| 26 | |||
| 27 | <p>MSI custom actions are MUCH easier to write in C# than | ||
| 28 | in C++!</p><pre><font face="Consolas, Courier New"> [CustomAction] | ||
| 29 | <font color=blue>public</font> <font color=blue>static</font> ActionResult SampleCustomAction1(Session session) | ||
| 30 | { | ||
| 31 | session.Log(<font color="purple">"Hello from SampleCA1"</font>); | ||
| 32 | |||
| 33 | <font color=blue>string</font> testProp = session[<font color="purple">"SampleCATest"</font>]; | ||
| 34 | <font color=blue>string</font> testProp2; | ||
| 35 | testProp2 = (<font color="blue">string</font>) session.Database.ExecuteScalar( | ||
| 36 | <font color="purple">"SELECT `Value` FROM `Property` WHERE `Property` = 'SampleCATest'"</font>); | ||
| 37 | |||
| 38 | <font color=blue>if</font>(testProp == testProp2) | ||
| 39 | { | ||
| 40 | session.Log(<font color="purple">"Simple property test passed."</font>); | ||
| 41 | <font color=blue>return</font> ActionResult.Success; | ||
| 42 | } | ||
| 43 | <font color=blue>else</font> | ||
| 44 | <font color=blue>return</font> ActionResult.Failure; | ||
| 45 | } | ||
| 46 | </font></pre> | ||
| 47 | <p>A sample CA project with two CAs is included in the | ||
| 48 | Samples\ManagedCA directory. Running the CustomActionTest project will package the CA and insert | ||
| 49 | it into a test MSI. The MSI will invoke the custom actions, but it will not install anything | ||
| 50 | since the second sample CA returns ActionResult.UserExit. | ||
| 51 | </p> | ||
| 52 | |||
| 53 | <p><br/></p> | ||
| 54 | <p><b>See also:</b></p> | ||
| 55 | <ul> | ||
| 56 | <li><a href="writingcas.htm">Writing Managed Custom Actions</a></li> | ||
| 57 | <li><a href="caconfig.htm">Specifying the Runtime Version</a></li> | ||
| 58 | <li><a href="databases.htm">Working with MSI Databases</a></li> | ||
| 59 | <li><a href="buildingcas.htm">Building Managed Custom Actions</a></li> | ||
| 60 | <li><a href="debuggingcas.htm">Debugging Managed Custom Actions</a></li> | ||
| 61 | </ul> | ||
| 62 | <p><br/></p> | ||
| 63 | |||
| 64 | </div> | ||
| 65 | |||
| 66 | <div id="footer"> | ||
| 67 | <p /> | ||
| 68 | Send comments on this topic to <a id="HT_MailLink" href="mailto:wix-users%40lists.sourceforge.net?Subject=Deployment Tools Foundation Documentation"> | ||
| 69 | wix-users@lists.sourceforge.net</a> | ||
| 70 | |||
| 71 | <script type="text/javascript"> | ||
| 72 | var HT_mailLink = document.getElementById("HT_MailLink"); | ||
| 73 | var HT_mailLinkText = HT_mailLink.innerHTML; | ||
| 74 | HT_mailLink.href += ": " + document.title; | ||
| 75 | HT_mailLink.innerHTML = HT_mailLinkText; | ||
| 76 | </script> | ||
| 77 | |||
| 78 | <p /> | ||
| 79 | |||
| 80 | </div> | ||
| 81 | </div> | ||
| 82 | |||
| 83 | </body> | ||
| 84 | </html> | ||
