<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.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>SSIS Junkie : Visual Studio 2010, sqlserver, wix</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/tags/Visual+Studio+2010/sqlserver/wix/default.aspx</link><description>Tags: Visual Studio 2010, sqlserver, wix</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Building a database installer with WiX, datadude and Visual Studio 2010</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2011/02/10/building-a-database-installer-with-wix-datadude-and-visual-studio-2010.aspx</link><pubDate>Thu, 10 Feb 2011 21:45:17 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33387</guid><dc:creator>jamiet</dc:creator><slash:comments>20</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/33387.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=33387</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=33387</wfw:comment><description>&lt;p&gt;&lt;font size="3"&gt;Today I have been using Windows Installer XML (WiX) to build an installer (.msi file) that would install a SQL Server database on a server of my choosing; the source code for that database lives in datadude (a tool &lt;/font&gt;&lt;a href="http://www.sqlservercentral.com/questions/visual+studio/72236/" target="_blank"&gt;&lt;font size="3"&gt;which you may know by one of quite a few other names&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;). The basis for this work was a most excellent blog post by Duke Kamstra entitled &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/dukek/archive/2009/10/19/implementing-a-wix-installer-that-calls-the-gdr-version-of-vsdbcmd-exe.aspx" target="_blank"&gt;&lt;font size="3"&gt;Implementing a WIX installer that calls the GDR version of VSDBCMD.EXE&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; which coves the delicate intricacies of doing this – particularly how to call &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd193283.aspx" target="_blank"&gt;&lt;font size="3"&gt;Vsdbcmd.exe&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; in a &lt;/font&gt;&lt;a href="http://wix.sourceforge.net/manual-wix3/wix_xsd_customaction.htm" target="_blank"&gt;&lt;font size="3"&gt;CustomAction&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;. Unfortunately there are a couple of things wrong with Duke’s post:&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="3"&gt;Searching for “datadude wix” didn’t turn it up in the first page of search results and hence it took me a long time to find it. And I knew that it existed. If someone else were after a post on using WiX with datadude its likely that they would never have come across Duke’s post and that would be a great shame because its the definitive post on the matter.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3"&gt;It was written in October 2009 and had not been updated for Visual Studio 2010.&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="3"&gt;Well, this blog post is an attempt to solve those problems. Hopefully I’ve solved the first one just by following a few of &lt;/font&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2010/12/21/blogging-tips-for-sql-server-professionals.aspx" target="_blank"&gt;&lt;font size="3"&gt;my blogging SEO tips&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; while writing this blog post, in the rest of it I will explain how I took Duke’s code and updated it to work in Visual Studio 2010.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;If you need to build a database installer using WiX, datadude and Visual Studio 2010 then you still need to follow Duke’s blog post so go and do that now. Below are the amendments that I made that enabled the project to get built in Visual Studio 2010:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;In VS2010 datadude’s output files have changed from being called Database.&amp;lt;suffix&amp;gt; to &amp;lt;ProjectName&amp;gt;_Database.&amp;lt;suffix&amp;gt;. Duke’s code was referencing the old file name formats.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;Duke used $(var.SolutionDir) and relative paths to point to datadude artefacts I have replaced these with Votive Project References &lt;/font&gt;&lt;a href="http://wix.sourceforge.net/manual-wix3/votive_project_references.htm"&gt;&lt;font size="3"&gt;http://wix.sourceforge.net/manual-wix3/votive_project_references.htm&lt;/font&gt;&lt;/a&gt;&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;I commented out all references to MicrosoftSqlTypesDbschema in DatabaseArtifacts.wxi. I don't think this is produced in VS2010 (I may be wrong about that but it wasn't in the output from my project)&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Similarly I commented out component MicrosoftSqlTypesDbschema in VsdbcmdArtifacts.wxi. It wasn't where Duke's code said it should have been so am assuming/hoping it isn't needed.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Duke's &lt;font face="Consolas"&gt;?define&lt;/font&gt; block to work out appropriate SrcArchPath actually wasn't working for me (i.e. &lt;font face="Consolas"&gt;&amp;lt;?if $(var.Platform)=x64 ?&lt;/font&gt;&amp;gt; was evaluating to false)&amp;#160; so I just took out the conditional stuff and declared the path explicitly to the “Program Files (x86)” path. The old code is still there though if you need to put it back.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;None of the &lt;font face="Consolas"&gt;&amp;lt;RegistrySearch&amp;gt;&lt;/font&gt; stuff is needed for VS2010 - so I commented it all out!&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Changed to use &lt;font face="Consolas"&gt;/manifest &lt;/font&gt;option rather than &lt;font face="Consolas"&gt;/model&lt;/font&gt; option on vsdbcmd.exe command-line. Personal preference is all!&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Added a new component in order to bundle along the vsdbcmd.exe.config file&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Made the install of the Custom Action dependent on the relevant feature being selected for install. This one is actually really important – deselecting the database feature for installation does not, by default, stop the CustomAction from executing and so would cause an error - so that scenario needs to be catered for&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="3"&gt;I have made my amended solution available for download at: &lt;/font&gt;&lt;a title="http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.zip" href="http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.zip"&gt;&lt;font size="3"&gt;http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.zip&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; It contains two projects: the WiX project and the datadude project that is the source to be deployed (for demo purposes it only contains one table).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_640907F6.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_4817D2FE.png" width="407" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;I have also made the .msi available although in order that it gets through file blockers I changed the name from InstallMyDatabase.msi to InstallMyDatabase.ms_ – simply rename the file back once you have downloaded it from: &lt;/font&gt;&lt;a title="http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.ms%5E_" href="http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.ms%5E_"&gt;&lt;font size="3"&gt;http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.ms%5E_&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; .You can try it out for yourself – the only thing it does is dump the files into %Program Files%\MyDatabase and uses them to install a database onto a server of your choosing with a name of your choosing - no damaging side-affects. I will caveat this by saying “it works on my machine” and, not having access to a plethora of different machines, I haven’t tested it anywhere else. One potential issue that I know of is that Vsdbcmd.exe has a &lt;a href="http://msdn.microsoft.com/en-us/library/dd193258.aspx" target="_blank"&gt;dependency on SQL Server CE&lt;/a&gt; although if you have SQL Server tools or Visual Studio installed you should be fine. Unfortunately its not possible to bundle along the SQL Server CE installer in the .msi because Windows will not allow you to call one installer from inside another – the recommended way to get around this problem is to build a bootstrapper to bundle the whole lot together but doing that is outside the scope of this blog post. If you discover any other issues then please let me know.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Here are the screenshots from the installer:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_1879B472.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_7DCD1858.png" width="522" height="408" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_14ABE9D5.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_2BF6EE46.png" width="522" height="408" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_029FA648.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_15E05CE7.png" width="524" height="409" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_74148455.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_322D9F07.png" width="524" height="410" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_7765F630.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_0F1D2D97.png" width="524" height="409" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_141F6B46.png"&gt;&lt;font size="3"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_64814CB9.png" width="526" height="411" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;And once installed….&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_7CEF886A.png"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_109C71FF.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_2808D80F.png" width="322" height="191" /&gt;&lt;/a&gt;&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Hope this is useful!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet"&gt;&lt;font size="3"&gt;@jamiet&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=33387" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Datadude/default.aspx">Datadude</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/msi/default.aspx">msi</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sqlserver/default.aspx">sqlserver</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/vsdbcmd.exe/default.aspx">vsdbcmd.exe</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/VSTS+Database+Edition/default.aspx">VSTS Database Edition</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/wix/default.aspx">wix</category></item></channel></rss>