Search results matching tags 'Datadude' and 'msi'http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&tag=Datadude,msi&orTags=0Search results matching tags 'Datadude' and 'msi'en-USCommunityServer 2.1 SP2 (Build: 61129.1)Building a database installer with WiX, datadude and Visual Studio 2010http://sqlblog.com/blogs/jamie_thomson/archive/2011/02/10/building-a-database-installer-with-wix-datadude-and-visual-studio-2010.aspxThu, 10 Feb 2011 21:45:17 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:33387jamiet<p><font size="3">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 </font><a href="http://www.sqlservercentral.com/questions/visual+studio/72236/" target="_blank"><font size="3">which you may know by one of quite a few other names</font></a><font size="3">). The basis for this work was a most excellent blog post by Duke Kamstra entitled </font><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"><font size="3">Implementing a WIX installer that calls the GDR version of VSDBCMD.EXE</font></a><font size="3"> which coves the delicate intricacies of doing this – particularly how to call </font><a href="http://msdn.microsoft.com/en-us/library/dd193283.aspx" target="_blank"><font size="3">Vsdbcmd.exe</font></a><font size="3"> in a </font><a href="http://wix.sourceforge.net/manual-wix3/wix_xsd_customaction.htm" target="_blank"><font size="3">CustomAction</font></a><font size="3">. Unfortunately there are a couple of things wrong with Duke’s post:</font></p> <ol> <li><font size="3">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.</font> </li> <li><font size="3">It was written in October 2009 and had not been updated for Visual Studio 2010.</font> </li> </ol> <p><font size="3">Well, this blog post is an attempt to solve those problems. Hopefully I’ve solved the first one just by following a few of </font><a href="http://sqlblog.com/blogs/jamie_thomson/archive/2010/12/21/blogging-tips-for-sql-server-professionals.aspx" target="_blank"><font size="3">my blogging SEO tips</font></a><font size="3"> 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.</font></p> <p><font size="3"></font></p> <p><font size="3">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:</font></p> <p><font size="3"></font></p> <ol> <li><font size="3" face="Calibri">In VS2010 datadude’s output files have changed from being called Database.&lt;suffix&gt; to &lt;ProjectName&gt;_Database.&lt;suffix&gt;. Duke’s code was referencing the old file name formats.</font> </li> <li><font face="Calibri"><font size="3">Duke used $(var.SolutionDir) and relative paths to point to datadude artefacts I have replaced these with Votive Project References </font><a href="http://wix.sourceforge.net/manual-wix3/votive_project_references.htm"><font size="3">http://wix.sourceforge.net/manual-wix3/votive_project_references.htm</font></a></font> </li> <li><font size="3" face="Calibri">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)</font> </li> <li><font size="3" face="Calibri">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.</font> </li> <li><font size="3" face="Calibri">Duke's <font face="Consolas">?define</font> block to work out appropriate SrcArchPath actually wasn't working for me (i.e. <font face="Consolas">&lt;?if $(var.Platform)=x64 ?</font>&gt; was evaluating to false)&#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.</font> </li> <li><font size="3" face="Calibri">None of the <font face="Consolas">&lt;RegistrySearch&gt;</font> stuff is needed for VS2010 - so I commented it all out!</font> </li> <li><font size="3" face="Calibri">Changed to use <font face="Consolas">/manifest </font>option rather than <font face="Consolas">/model</font> option on vsdbcmd.exe command-line. Personal preference is all!</font> </li> <li><font size="3" face="Calibri">Added a new component in order to bundle along the vsdbcmd.exe.config file</font> </li> <li><font size="3" face="Calibri">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</font> </li> </ol> <p><font size="3">I have made my amended solution available for download at: </font><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"><font size="3">http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.zip</font></a><font size="3"> 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).</font></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_640907F6.png"><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" /></a></p> <p><font size="3">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: </font><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_"><font size="3">http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20110210/InstallMyDatabase.ms%5E_</font></a><font size="3"> .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 <a href="http://msdn.microsoft.com/en-us/library/dd193258.aspx" target="_blank">dependency on SQL Server CE</a> 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.</font></p> <p><font size="3">Here are the screenshots from the installer:</font></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_1879B472.png"><font size="3"><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" /></font></a></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_14ABE9D5.png"><font size="3"><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" /></font></a></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_029FA648.png"><font size="3"><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" /></font></a></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_74148455.png"><font size="3"><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" /></font></a></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_7765F630.png"><font size="3"><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" /></font></a></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_141F6B46.png"><font size="3"><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" /></font></a></p> <p><font size="3"></font></p> <p><font size="3">And once installed….</font></p> <p><a href="http://sqlblog.com/blogs/jamie_thomson/image_7CEF886A.png"><font size="3"></font><a href="http://sqlblog.com/blogs/jamie_thomson/image_109C71FF.png"><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" /></a></a></a></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3">Hope this is useful!</font></p> <p><a href="http://twitter.com/jamiet"><font size="3">@jamiet</font></a><font size="3">&#160;</font></p>