<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx</link><description>I&amp;#39;d like to add my thoughts to the recent discussion about how bad custom actions are, and which types are better or worse than others. First of all, I believe there&amp;#39;s a general consent that custom actions shouldn&amp;#39;t be used for tasks that</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Internet Explorer Script Error  &amp;raquo; Blog Archive   &amp;raquo; The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx#1415504</link><pubDate>Mon, 24 Dec 2007 05:45:03 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1415504</guid><dc:creator>Internet Explorer Script Error  » Blog Archive   » The good, the bad, and the ugly - custom action types</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Internet Explorer Script Error &amp;nbsp;&amp;amp;raquo; Blog Archive &amp;nbsp; &amp;amp;raquo; The good, the bad, and the ugly - custom action types&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1415504" width="1" height="1"&gt;</description></item><item><title>re: The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx#1354046</link><pubDate>Sun, 25 Nov 2007 03:17:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1354046</guid><dc:creator>Christopher Painter</dc:creator><description>&lt;p&gt;I don&amp;#39;t condone using legacy InstallScript functions to intentionally reinvent the wheel instead of using native MSI patterns. &amp;nbsp;I also try to always leverage vendor provided quasi-standard action patterns ( for example InstallShield XML Search/Modify, SQL, IIS and so on).&lt;/p&gt;
&lt;p&gt;I also recognize that including an InstallScript CA takes about a 2mb hit on a package ( last time I checked ). &amp;nbsp;That may be an important consideration for very small packages. &amp;nbsp;However for the large packages that I tend to work on, the package bloat is nominal and will never be a real issue.&lt;/p&gt;
&lt;p&gt;The reason I like InstallScript is it does have a large repository of built-in functions for dealing with setup related tasks, the MSI API, Win32 API, COM and .NET Interop.&lt;/p&gt;
&lt;p&gt;I also believe in writing data driven transactional custom action patterns and all of this built in robustness really helps. &amp;nbsp; I sometimes read newsgroup snippets of equivilant C++ functionality and I really have to laugh at how much simpler InstallScript is. &amp;nbsp;Then again, I also agree with Stefan, that it&amp;#39;s probably just a matter of the posters being more comfortable in C++ and I&amp;#39;m more comfortable in InstallScript and C#.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1354046" width="1" height="1"&gt;</description></item><item><title>re: The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx#1345756</link><pubDate>Wed, 21 Nov 2007 23:42:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1345756</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Carl, the main problem I have with VBScript for scripted custom actions (besides what Stefan mentioned about AV software marking it as potentially malicious) is the error handling. &amp;nbsp;Unwinding all the way out of a nested call chain to be able to return the appropriate error code to Windows Installer is tedious (but doable) in VBScript. &amp;nbsp;It requires that you daisy-chain the return value out of every called function that you write. &amp;nbsp;JScript has an exception handling mechanism that allows this to function much cleaner.&lt;/p&gt;
&lt;p&gt;One thing that hasn&amp;#39;t been mentioned in any of the discussions of custom actions is unit testing. &amp;nbsp;I think unit testing is going to be the best way to test all the nooks and crannies of your custom action, particularly in exercising all the error paths. &amp;nbsp;I&amp;#39;m not sure how you would do that in VBScript; for instance, how do you create a &amp;quot;fake&amp;quot; or &amp;quot;mock&amp;quot; object for vbscript functions that immitates the global Session variable? &amp;nbsp;You could probably do it by passing an object as the first parameter to all of your vbscript code, but its too easy to access Session in the middle and destroy that carefully laid groundwork.&lt;/p&gt;
&lt;p&gt;There are mechanisms for doing this with C++ in such a manner that its transparent to you code -- your code never knows if you&amp;#39;re talking to the &amp;quot;real&amp;quot; MSI API as in a production environment or if you&amp;#39;re talking to a fake MSI API as in a testing environment. &amp;nbsp;I am working on an example in the context of updating the DirectX runtime and plan on publishing a white paper/blog entry on this in the next few months.&lt;/p&gt;
&lt;p&gt;With adequate unit testing, I think you can avoid the unexpected pitfalls of custom actions, but that doesn&amp;#39;t make them any easier to write properly. &amp;nbsp;It just gives you more chances to find your bugs before your product ships.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1345756" width="1" height="1"&gt;</description></item><item><title>re: The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx#1345104</link><pubDate>Wed, 21 Nov 2007 16:33:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1345104</guid><dc:creator>stefan</dc:creator><description>&lt;p&gt;carl - yes, the &amp;quot;InstallScript MSI&amp;quot; (or &amp;quot;Standard&amp;quot; as it was called originally) project type has been causing lots of trouble and should be avoided. However Christopher talks about &amp;quot;Basic MSI&amp;quot; projects that may include call custom actions written in InstallScript. This can be useful, if you keep in mind that you shouldn't use it to replace native functionality. But you have to consider the overhead (and potential for bugs in the engine) opposed to a DLL written in C for instance. As I said, it will also depend on your knowledge and experience in other programming languages.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1345104" width="1" height="1"&gt;</description></item><item><title>re: The good, the bad, and the ugly - custom action types</title><link>http://msmvps.com/blogs/installsite/archive/2007/11/21/the-good-the-bad-and-the-ugly-custom-action-types.aspx#1345051</link><pubDate>Wed, 21 Nov 2007 16:16:54 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1345051</guid><dc:creator>carl</dc:creator><description>&lt;p&gt;I completely agree with what you have said above.&lt;/p&gt;
&lt;p&gt;Christopher Painter is wrong. &amp;nbsp;InstallScript MSIs are never appropriate. &amp;nbsp;Leveraging the language into MSIs was dreamed up by InstallShield&amp;#39;s marketing team to con people into &amp;#39;upgrading&amp;#39; to InstallShield 7 saying that &amp;quot;you can upgrade to MSI and your old scripted package will still work&amp;quot;&lt;/p&gt;
&lt;p&gt;It had no place in an MSI then, and it has none now.&lt;/p&gt;
&lt;p&gt;Personally I like VBScript. &amp;nbsp;It has the advantages of being easy to read, open source and can be debugged from within the MSI using the MSOffice debugger.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1345051" width="1" height="1"&gt;</description></item></channel></rss>