<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="www.w3.org/2005/Atom" xmlns:sy="purl.org/rss/1.0/modules/syndication/" xmlns:dc="purl.org/dc/elements/1.1/" xmlns:content="purl.org/rss/1.0/modules/content/" xmlns:wfw="wellformedweb.org/CommentAPI/" xmlns:slash="purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Visual Studio Database Development Tools</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dukek/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dukek/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 05:03:39 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Implementing a database design using multiple database projects</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/implementing-a-database-design-using-multiple-database-projects</link>
      <pubDate>Mon, 04 Jan 2010 17:47:25 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2010/01/04/implementing-a-database-design-using-multiple-database-projects/</guid>
      <description><![CDATA[This blog post assumes you are using Visual Studio 2010. However, most of the information is...]]></description>
      <content:encoded><![CDATA[<p>This blog post assumes you are using Visual Studio 2010. However, most of the information is relevant to <a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed">Visual Studio Team System 2008 Database Edition GDR</a>.</p> <p>We get a lot of questions from customers for which we answer; use multiple projects (database and/or server). The following canonical examples represent the majority of what customers ask about <table border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="294"> <p>Define SQL instance level objects</p></td> <td valign="top" width="297"> <p>For example, define Logins or Linked Servers.</p></td></tr> <tr> <td valign="top" width="294"> <p>Organize my code by SQL schema</p></td> <td valign="top" width="297"> <p>For example, one project contains the objects bound to the HumanResources schema and another project contains the objects bound to the Sales schema.</p></td></tr> <tr> <td valign="top" width="294"> <p>Organize my code by SQL object type</p></td> <td valign="top" width="297"> <p>For example, one project has all you tables and another project has all of your stored procedures.</p></td></tr> <tr> <td valign="top" width="294"> <p>Re-use the code implemented in one project in multiple database designs</p></td> <td valign="top" width="297"> <p>For example you have some diagnostics functionality that you re-use in each of your database designs.</p></td></tr></tbody></table> <p>An important point is that in each of these cases the developer needs to use two part names when referring to objects declared in another project. A similar sounding but very different question is how to use multiple database projects when the developer wants to use three part names or four part names. That is the topic of another blog post. :) <p>The good news is that Data Dude makes it easy to implement the T-SQL code for the examples I’ve described above. If you implement C# or VB.NET code in Visual Studio you will find that the mechanics of setting up your solution are analogous to referencing assemblies. Customers seem to get confused with two areas <ol> <li>Creating the initial projects with the objects they want and then defining the references between the various projects</li> <li>Deploying multiple projects to a single database.</li></ol> <p>Before continuing I recommend that you first read this blog post: <a href="https://blogs.msdn.com/dukek/archive/2009/12/31/the-pros-and-cons-of-partial-projects-and-database-project-references.aspx">The pros and cons of Partial Projects and Database Project References</a> for some important background information. <h3>Organize my code by SQL schema</h3> <p>In this walk through I am going to break the AdventureWorks2008 database into projects representing each schema: HumanResources, Person, Production, etc. While it may seem pedantic to do a detailed walk through I find that many developers get stuck at one point or another. So it should be nice to have a relatively complex example that actually works in the end. If you would a walk through of putting together a new, simple database design I suggest you read this White Paper: <a title="Collaborative Development with Team System 2008 Database Edition" href="https://msdn.microsoft.com/en-us/library/dd452417.aspx">Collaborative Development with Team System 2008 Database Edition</a>. <p>These are the steps to the process we’re going to go through <ol> <li>Create the Visual Studio solution</li> <li>Import the database definition into the solution</li> <li>Move the schema specific code into each of the projects while leaving any code that refers to multiple schemas in the main project</li> <li>Configure the deployment settings in each project and Deploy</li></ol> <h3>Create the Visual Studio solution</h3> <ol> <li>Create the Visual Studio solution by creating a new SQL Server 2008 Database Project. Name the project and the solution MyAdventureWorks2008.</li> <li>Next add the projects to the solution for each of the schema in AdventureWorks2008: HumanResources, Person, Production, Purchasing and Sales</li> <ol> <li>From the Solution Explorer context menu choose <b>Add \ New Project…</b></li> <li>Provide the project name and click OK</li></ol></ol> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p1_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p1_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p1" border="0" alt="p1" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p1_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p1_thumb.png" width="628" height="363"></a> </p></blockquote> <h3>Import the database definition into the solution</h3> <p>There are several ways to do this <ul> <li>Import the entire database design into one project then move the source files around using Import Script</li> <li>Import the entire database design into one project then move the source files around using <b>Add Existing Item…</b></li> <li>Import only the objects we want into the individual projects using Schema Compare</li></ul> <p>I think the first option is quicker than using Schema Compare so that’s what I’ll use. In future blog posts I’ll use the alternative methods so you can see how the different approaches compare. Throughout this process I’m going to make changes, resolve any errors in the solution, then make the next change. It’s an incremental “get clean, stay clean” sort of approach. <h4>Move source files into the appropriate projects</h4> <p>The key point to understand here is that we are only moving objects that do not refer to other schema into the individual projects. If an object depends on the HumanResources and Person schemas then we leave that object definition in the MyAdventureWorks2008 project. Foreign keys are the most common example of this sort of object definition. <ol> <li>Import the entire database design into the MyAdventureWorks2008 project</li> <ol> <li>From Solution Explorer select the MyAdventureWorks2008 project</li> <li>From the context menu choose <b>Import Database Objects and Settings…</b> to import the AdventureWorks2008 database into the project</li> <li><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p2_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p2_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p2" border="0" alt="p2" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p2_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p2_thumb.png" width="490" height="374"></a> </li></ol></ol> <blockquote> <p>As you can see from the following screenshot the import database process persists the .sql scripts into folders and files with the name of the schema. We want to move the objects in each of the schema that have no relationships with other schema into their respective project.</p></blockquote> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p3_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p3_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p3" border="0" alt="p3" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p3_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p3_thumb.png" width="547" height="723"></a> </p></blockquote> <blockquote> <p>2. Move the objects bound to the HumanResources schema from the MyAdventureWorks2008 project into the HumanResources project </p></blockquote> <ol> <ol> <li>Right-click the HumanResources project in Solution Explorer and choose <b>Import Script…</b></li> <li>Choose <b>Multiple Files</b> and navigate to the Schema Objects folder of the MyAdventureWorks2008 project.</li> <li>Choose the file …\Schema Objects\Database Level Objects\Security\Schemas\HumanResources.schema.sql and everything under …\Schema Objects\Schemas\HumanResources. Click Finish.</li></ol></ol> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p4_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p4_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p4" border="0" alt="p4" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p4_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p4_thumb.png" width="589" height="457"></a> </p></blockquote> <blockquote> <p>Now take a look at the long list of errors in the error list. Yikes, what have we done?</p></blockquote> <blockquote> <p>3. Let’s fix the unresolved references to Sql Types first.</p></blockquote> <ol> <ol> <li>Add another project to your solution named SqlTypes</li> <li>Using Import Script import the contents of …\Schema Objects\Schemas\dbo\Programmability\Types from your MyAdventureWorks2008 project into your SqlTypes project</li> <li>Build the SqlTypes project. It should build successfully.</li> <li>In your HumanResources project add a Database Reference to the SqlTypes project</li> <ol> <li>From the project’s context menu select Add Database Reference…</li> <li>Select the SqlTypes project</li> <li>Click OK</li></ol></ol></ol> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p5_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p5_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p5" border="0" alt="p5" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p5_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p5_thumb.png" width="628" height="499"></a> </p></blockquote> <blockquote> <p>4. Now let’s fix the errors caused by references to objects in other schema. We need to delete these scripts from the HumanResources project. Remove the following files</p></blockquote> <ol> <ol> <li>FK_Employee_Person_BusinessEntityID.fkey.sql</li> <li>JobCandidate.fulltextindex.sql</li> <li>vEmployee.view.sql</li> <li>vEmployeeDepartment.view.sql</li> <li>vEmployeeDepartmentHistory.view.sql</li></ol></ol> <blockquote> <p>At this point all of the errors in the HumanResources project are resolved. We still have a few warnings, however.</p></blockquote> <blockquote> <p>5. Add another project to the solution named Diagnostics <p>6. Using Import Script import the following files from the MyAdventureWorks2008 project into the Diagnostics project. Then build the Diagnostics project. It should build successfully.</p></blockquote> <ul> <ul> <li>uspLogError.proc.sql</li> <li>uspPrintError.proc.sql</li> <li>DatabaseLog.table.sql</li> <li>ErrorLog.table.sql</li> <li>DF_ErrorLog_ErrorTime.defconst.sql</li> <li>PK_DatabaseLog_DatabaseLogID.pkey.sql</li> <li>PK_ErrorLog_ErrorLogID.pkey.sql</li></ul></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p6_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p6_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p6" border="0" alt="p6" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p6_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p6_thumb.png" width="628" height="487"></a> </p></blockquote> <blockquote> <p>7. Now add a Database Reference from the HumanResources project to the Diagnostics project. At this point you should not have any errors or warnings. Sweet!</p></blockquote> <blockquote> <p>8. Now add a Database References from the MyAdventureWorks2008 project to the HumanResources, SqlTypes and Diagnostics projects. You should see a bunch of errors. All of these are because all the objects that we moved to the other project are still defined in the MyAdventureWorks2008 project. Fixing this is basically a search and destroy effort. Look at the errors in the error list and remove each file from the MyAdventureWorks2008 project. When you have no errors you are done. :)</p></blockquote> <blockquote> <p>9. Repeat the previous steps for the remainder of the schemas.</p></blockquote> <blockquote> <p>When you move the objects bound to the [Sales] schema into the Sales project you will find that the function [dbo].[ufnLeadingZeros] is only used in one place – [Sales].[Customer]. Since it is only used in here I chose to move the function into the [Sales] schema. Arguably it belongs in a utility project with the rest of the functions defined in [dbo] so I can reuse the code in other database designs.</p></blockquote> <ol> <ol> <li>In Schema View navigate to <b>the MyAdventureWorks2008 \ Schemas \ dbo \ Programmability \ Functions \ ufnLeadingZeros</b> node</li> <li>Select <b>Refactor \ Move to Schema…</b> from the context menu</li> <li>Select the [Sales] schema</li></ol></ol> <blockquote> <p>10. At this point I checked the solution into Source Code Control. That was a lot of work!</p></blockquote> <h3>Configure the deployment settings in each project</h3> <p>In order to actually deploy our database we need to configure a few settings in each project. <p>From Solution Explorer <ol> <li>In the MyAdventureWorks2008 project, open the Database.sqldeployment property file and clear the checkboxes for the DropConstraintsNotInSource and DropIndexesNotInSource settings. We don’t want the constraints and indexes defined in the other projects to be removed when the MyAdventureWorks project is deployed.</li> <li><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p7_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p7_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p7" border="0" alt="p7" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p7_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p7_thumb.png" width="628" height="107"></a> </li> <li>In each project, with the exception of the MyAdventureWorks2008 project, open the Database.sqldeployment file located under the Properties node for the project and clear the <b>Deploy database properties</b> checkbox. There is no reason for each project to cause the database settings to be changed.</li> <li>In each project double-click on the <b>Properties</b> node to open the project properties. In the Deploy tab</li> <ol> <li>Set the <b>Deploy action</b> setting to <b>Create a deployment script (.sql) and deploy to the database</b>.</li> <li>Set the <b>Target connection</b> setting to the SQL server instance you will deploy the database to</li> <li>Set the <b>Target database name</b> setting to MyAdventureWorks2008.</li></ol></ol> <h3>Deploy</h3> <p>Now attempt to deploy the solution – select Deploy Solution from the solution’s context menu in Solution Explorer. Notice that the Production project fails to deploy and displays the following error in the output window <p>c:\Projects\MyAdventureWorks\Production\sql\debug\Production.sql(328,0): Error SQL01268: .Net SqlClient Data Provider: Msg 1969, Level 16, State 1, Line 1 Default FILESTREAM filegroup is not available in database 'MyAdventureWorks2008'. <p>Unfortunately the Data Dude validation engine doesn’t catch this problem at design time. If it had we would have seen an error in the error list. To fix this we have some more code refactoring to do. We’re going to move the definition of the FILESTREAM filegroup and associated file from the MyAdventureWorks project to the Production project. <ol> <li>Using the same Import Script technique we used previously, import the following files from MyAdventureWorks2008 into the Production project</li> <ol> <li>…\Schema Objects\Database Level Objects\ Storage\Filegroups\DocumentFileStreamGroup.filegroup.sql</li> <li>…\Schema Objects\Database Level Objects\Storage\Files\FileStreamDocuments.sqlfile.sql</li></ol> <li>Remove the files from the MyAdventureWorks2008 project. You will get an error because the <b>Default filestream filegroup</b> is set in the Database.sqlsettings file. Fix the error</li> <ol> <li>Open the Database.sqlsettings file for the MyAdventureWorks2008 project</li> <li>For the <b>Default filestream filegroup</b> choose the empty value from the dropdown.</li></ol> <li>Now we have to set the <b>Default filestream filegroup</b> for the Production project.</li> <ol> <li>Open the Database.sqlsettings file for the Production project</li> <li>For the <b>Default filestream filegroup</b> choose the value <b>DocumentFilestreamGroup</b> from the dropdown.</li></ol></ol> <p>Now try to deploy again. It should succeed. <h3>Conclusion</h3> <p>The diagram below describes the solution we have created. The primary purpose of the MyAdventureWorks2008 project is to define referential integrity between tables in the various schema and any application level views that do joins across tables in the various schema. In theory each of the projects other than the MyAdventureWorks project could be re-used in other database designs. <p></p> <p></p> <p></p> <p></p> <p></p> <p></p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p8_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p8_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="p8" border="0" alt="p8" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p8_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/Splittingadatabasedesignintomultipledata_CB61/p8_thumb.png" width="583" height="323"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>The pros and cons of Partial Projects and Database Project References</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/the-pros-and-cons-of-partial-projects-and-database-project-references</link>
      <pubDate>Thu, 31 Dec 2009 14:11:38 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/12/31/the-pros-and-cons-of-partial-projects-and-database-project-references/</guid>
      <description><![CDATA[This blog post assumes you are using Visual Studio 2010. However, most of the information is...]]></description>
      <content:encoded><![CDATA[<p>This blog post assumes you are using Visual Studio 2010. However, most of the information is relevant to <a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed">Visual Studio Team System 2008 Database Edition GDR</a>.  <p>We get a lot of questions on the forum for which the answer is to use partial projects and/or database project references. Before you choose one or the other method to implement your database design it is helpful to understand the pros and cons of each feature. This blog post attempts to give you some insight into these pros and cons.  <h3>Inside Data Dude</h3> <p>Before we discuss Partial Projects and Database Project References it is important to understand how the project system behaves. Specifically, it is important to understand how it represents your design internally. The following figure describes how a database or server project named “Foo” is represented. In other words, the figure describes what Data Dude consumes to create the in-memory model of your database design. We refer to the in-memory model as the “Schema Model.” The Schema Model represents four things  <ol> <li>Your Project Properties \ Project Settings; <b>Project version</b> – SQL 2005, SQL 2008 or DAC and <b>Collation for database model</b> – The model is actually persisted in a SQL Compact database. Since there is not a 1 to 1 mapping between SQL Server collations and SQL Compact collations you have to tell Data Dude which one to use.  <li>The database settings you define in the .sqlsettings file  <li>The permissions you define in the .sqlpermissions file  <li>The objects you declare in your .sql files <li>The XML schema collections you reference in .xsd files</li></ol> <p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p4_6.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p4_6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="p4" border="0" alt="p4" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p4_thumb_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p4_thumb_2.png" width="250" height="151"></a> </p> <p>The reason it is important to understand this is because it profoundly affects what happens when you deploy your project. If an object or setting is not in the Schema Model it will not be compared to the target database and added, modified or deleted when you deploy the project.  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p5_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p5_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="p5" border="0" alt="p5" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p5_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p5_thumb.png" width="625" height="293"></a>  <h3>Partial Projects</h3> <p>Partial projects allow you to share source code files between projects without creating multiple copies of the actual source code. In other words, the same physical file is incorporated directly into the Schema Model for two (or more) projects. See the following figure. In this diagram some files have been exported from project “Foo” and imported into project “Bar.” It’s important to understand that <u>the same physical .sql file(s) is being consumed by each project</u>. The Schema Model for “Bar” does not understand that the source files are being maintained in another project (“Bar”).  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p6_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p6_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="p6" border="0" alt="p6" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p6_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p6_thumb.png" width="538" height="154"></a>  <p>This brings us to the Pros and Cons of partial projects  <h4>Pros</h4> <ul> <li>When you include code by importing a partial project the T-SQL code is included in the project’s Schema Model.  <li>When you edit the .sql file the changes are reflected in the Schema Model for the project that owns the .sql file as well as the project(s) importing the file. Deployment is simple because all your objects are defined in one Schema Model.</li></ul> <h4>Cons</h4> <ul> <li>If you add a new file that you want to export you have to  <ul> <li>Re-create the partial project export  <li>Delete the partial project from the project doing the import  <li>Re-import the partial project</li></ul></li></ul> <blockquote> <p>This is obviously a big pain and is the number one reason people don’t like partial projects. The work around is to define all the objects that you plan to export from a particular project in one .sql file.</p></blockquote> <ul> <li>The export/import definition is persisted in a .files file. This file contains links to the original .sql files being exported. These links are file paths so if the file paths change all the links are broken. This can easily happen as projects are checked into source control and then the projects are built using a build system like TFS Build. <li>If you perform a refactoring operation on an object that has been imported/exported, the refactoring log is only persisted in the project in which you performed the refactoring operation. The refactoring log is what the deployment component uses to figure out that an object, for example, should be renamed instead of dropped and recreated. For example, if you perform the refactoring operation in the project that does the import, the preservation of intent information is not persisted to the project from which the object is exported. However, the object is renamed in both projects (assuming the Rename refactor operation). The work arounds are a) always perform refactor operations from the project that you will deploy or b) manually copy the specific refactoring element from the refactoring log file into the refactoring log file of the other project.</li></ul> <h3>Database Project References</h3> <p>Database project references allow you to reference T-SQL objects defined in another database or server project. The objects defined in the <u>referenced</u> project are included as [External] objects in the Schema Model of the <u>referencing</u> project. See the following figure.  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p7_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p7_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="p7" border="0" alt="p7" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p7_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p7_thumb.png" width="547" height="191"></a>  <p>As the figure indicates, the objects defined in the referenced project are not truly included in the Schema Model for “Foo.” If an object is referenced that is not defined in the Schema Model the validation component tries to find the object’s definition in the [External] set of objects. <h4>Two, Three and Four Part Naming</h4> <p>When you create your database project reference you have to decide if you will be referencing the objects from the referenced project using two part, three part or four part names. You control this behavior by defining Database Reference Variables, as explained in the section below titled Configuring the Database Reference.</p> <table border="1" cellspacing="0" cellpadding="2" width="800"> <tbody> <tr> <td valign="top" width="200"> <p>Two part names</p></td> <td valign="top" width="598"> <p>The Data Dude product team refers to project references that use two part names as “Composite Projects.” The reason being you are implementing a single database that is “composed” of two or more projects. The term “Composite Project” is a euphemism for a project reference that is configured for two part name references.</p> <p>There are two common ways that developers organize their code</p> <ul> <li>By object type – Tables in one project, Views in another and Sprocs in a third project</li> <li>By Schema – Sales in one project, Employees in another, etc.</li></ul> <p>It is important to understand that each project must be deployed independently and they must be deployed in the correct order. If you use Visual Studio to deploy your project or solution it will automatically deploy everything in the correct order. If you use a command line tool like msbuild or vsdbcmd you have to make sure you do the deployment in the proper order.</p></td></tr> <tr> <td valign="top" width="200"> <p>Three part names</p></td> <td valign="top" width="598"> <p>By defining a database name using a literal value or SQLCMD variable you are configuring the database reference such that references to SQL objects must be defined using three part names. See the configuration information below for details.</p> <p>If you need to refer to objects that are defined in SQL Server’s master database this is the configuration you will use. You will define a <strong>Database Reference</strong> to the appropriate master.dbschema file that we ship and you will set the <strong>database variable name</strong> to master after enabling the <strong>Literal</strong> checkbox.</p></td></tr> <tr> <td valign="top" width="200"> <p>Four part names</p></td> <td valign="top" width="598"> <p>By defining a server variable you are configuring the database reference such that references to SQL objects must be defined using four part names.</p></td></tr></tbody></table> <p>&nbsp; <h4>Configuring the Database Reference</h4> <p>There are several configuration settings available when defining a database project reference. It’s helpful to understand what each setting actually affects. I’ve included a screenshot of the dialog below.  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p8_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p8_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="p8" border="0" alt="p8" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p8_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/TheprosandconsofPartialProjectsandDataba_C359/p8_thumb.png" width="628" height="499"></a>  <p><b>Database Reference</b>  <p>This is the setting that allows you to point to what you are actually referencing. You have two choices  <ol> <li>Another project in the current solution  <li>A .dbschema file</li></ol> <p>When you build a database or server project the artifact created is a .dbschema file. It’s important to understand that both choices actually end up pointing to a .dbschema file. Choosing the first option simply looks at the current build output folder setting and automatically figures out the path and filename. In other words, you don’t have to browse for the file. This also means that if you don’t actually build the project you are referencing the database reference is effectively broken. You’ll see a warning icon in Solution Explorer.  <p><b>Database Reference Variables</b>  <p>Use these settings when you need to use three or four part names. In other words, you are defining a database reference to a project that will be deployed to a different physical database.  <ol> <li><b>Define server variable</b> – You are defining a SQLCMD variable and the associated value. You can then use the variable instead of hard coding a server name in your T-SQL code. When you deploy your project you can optionally override the value of the variable.  <li><b>Define database variable</b> – This setting gives you the option of defining a SQLCMD variable representing the database name or choosing the <b>Literal</b> option to indicate that your T-SQL code will be hard coding the name of the database. The most common use of the <b>Literal</b> setting is when referencing the database “master.”</li></ol> <p><b>Updating Schema Objects and Scripts</b>  <p>By selecting this option Data Dude will do a search and replace of any server or database names throughout your code with the variables you defined.  <p><b>Resolution of External Objects</b>  <p>The option <b>Suppress errors caused by unresolved references in the referenced project</b> is the most relevant to topic of this blog post. This option affects how the validation component behaves. Imagine you are defining a reference to a project which in turn references another project (we’ll call it “Third”). Think about the previous explanation of how the Schema Model is populated. When the validation component is validating the [External] objects it will not be able to find objects that are defined in the project “Third.” If you leave this option off you will get errors for the objects defined in “Third.” By setting this option you cause the validation component to not attempt to resolve objects that are referenced from the project being referenced.  <p>Now let’s look at the pros and cons of Database Project References.  <h4>Pros</h4> <ul> <li>If an object is added, modified or deleted the Schema Model of the referencing project (“Foo”) will be updated as soon as the referenced project (“Bar”) is built. Remember that the .dbschema file is what is actually referenced.  <li>Since each project creates its own Schema Model you can improve the overall performance of Visual Studio by breaking your database design up into multiple projects. Note that there is a point of diminishing returns with this technique. All the Schema Models share the same process so memory limitations can become an issue.  <li>You can provide .dbschema files without providing the associated source code. Thereby preventing someone from making changes to the code of the referenced project.  <li>You can define references to other projects that define objects within the same database (two part names), a different database (three part names) or even a different server (four part names).  <li>Code reuse is very easy. Imagine you have one project that implements tables, views, sprocs, etc. for diagnostic or auditing functionality. You can re-use the functionality by referencing it from <i>n</i> other database projects representing various database designs. You have the flexibility to use two, three or four part names.</li></ul> <h4>Cons</h4> <ul> <li>Each project has to be deployed individually and the projects must be deployed in the proper dependency chain order. This is because the objects are only represented in the model for the owning project.  <li>Since each project must be deployed individually you have to make sure the deployment setting <b>Generate DROP statements for objects that are in the target database but that are not in the database project</b> is not enabled. Otherwise each time you deploy a project all the objects defined in the referenced projects will get dropped from the target database. This setting is defined in the .sqldeployment properties file and it is cleared by default. The implication of this behavior is that if you actually want to remove an object definition from the target database you will have to either recreate the database during deployment or explicitly drop the object using a tool like SSMS. <li>Using Schema Compare to compare a database to a project that is part of a composite project (references using two part names) is very difficult. The problem is the model for the database represents the entire database design while the model for the project only contains the objects defined in that particular project. So Schema Compare reports a bunch of update actions for the objects defined in the other projects. If you need to use Schema Compare you have to set the update action for the objects that exist in other projects to Skip so they don’t get dropped from the target database when you do a Write Updates. That can be a lot of work! In order to avoid that I create a Visual Studio configuration (i.e. Release and Debug) named DontDeploy and set the <strong>Project Properties \ Deploy \ Deploy action</strong> to <strong>Create a deployment script (.sql)</strong>. Then I can easily switch my Visual Studio configuration, do a build that doesn’t actually deploy to the target database and look at each deployment script. Remember that one is created for each project.</li></ul> <p></p> <h3>Conclusion</h3> <p>Hopefully this is helpful. Let me know if you still have questions on this subject that I haven’t addressed.</p>]]></content:encoded>
    </item>
    <item>
      <title>T-SQL IntelliSense in Visual Studio 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/t-sql-intellisense-in-visual-studio-2010</link>
      <pubDate>Fri, 11 Dec 2009 13:41:13 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/12/11/t-sql-intellisense-in-visual-studio-2010/</guid>
      <description><![CDATA[One of the cool new features in Visual Studio 2010 is T-SQL IntelliSense. Yes, I know you’re...]]></description>
      <content:encoded><![CDATA[<p>One of the cool new features in Visual Studio 2010 is T-SQL IntelliSense. Yes, I know you’re thinking, “it’s about time.” Well, when we were implementing this functionality we had to made some difficult decisions about what we would support. So I thought it would be helpful to describe what T-SQL IntelliSense will/will not do in Visual Studio 2010.</p> <p>The first thing to point out is this functionality is only available in Visual Studio 2010 Professional, Premium and Ultimate SKUs. The second thing to point out is there are actually two implementations of T-SQL IntelliSense in Visual Studio: “Connected” and “Offline.”</p> <h3>Connected IntelliSense</h3> <p>Connected IntelliSense is active whenever you are in a T-SQL editor and are connected to a SQL 2008 instance. Note that SQL 2005 is not supported. The identifiers that are listed in the completion list are enumerated by querying the database that is currently selected in the editor’s toolbar. All SQL Server 2008 types are supported by Connected IntelliSense.</p> <h3>Offline IntelliSense</h3> <p>Offline IntelliSense is active whenever you are in a T-SQL editor and are editing a .sql file that is part of a SQL Database, SQL Server or Data-tier Application Component project. The identifiers that are listed in the completion list are enumerated by querying the in-memory model representing the contents of your project. This in-memory model contains all the objects in your project that are defined and saved to disk. A subset of the SQL Server 2005/2008 types are supported by Offline IntelliSense</p> <ul> <li><font size="2">Inline table function </font> <li><font size="2">Login</font>  <li><font size="2">Multi Statement Table function</font>  <li><font size="2">Scalar Valued function</font>  <li><font size="2">Schema</font>  <li><font size="2">Stored Procedure</font>  <li><font size="2">Table</font>  <li><font size="2">User</font>  <li><font size="2">User Defined Data Type</font>  <li><font size="2">User Defined Table Type</font>  <li><font size="2">View</font></li></ul> <p><font size="2">Unlike C# or Visual Basic IntelliSense, T-SQL Offline IntelliSense does not support syntax auto-completion. For example, after type CREATE TABLE Foo, IntelliSense will not auto-complete the remainder of the syntax for defining a table.</font></p> <p></p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:217ec308-8b87-4ca8-9c02-5a809173a7fa" class="wlWriterEditableSmartContent">Technorati Tags: <a href="technorati.com/tags/IntelliSense" rel="tag">IntelliSense</a>,<a href="technorati.com/tags/T-SQL" rel="tag">T-SQL</a>,<a href="technorati.com/tags/Data+Dude" rel="tag">Data Dude</a>,<a href="technorati.com/tags/Visual+Studio+2010" rel="tag">Visual Studio 2010</a></div>]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio 2010 SQL Database and DAC Projects (DBPROJ) – Project Properties</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/visual-studio-2010-sql-database-and-dac-projects-dbproj-project-properties</link>
      <pubDate>Tue, 01 Dec 2009 09:24:48 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/12/01/visual-studio-2010-sql-database-and-dac-projects-dbproj-project-properties/</guid>
      <description><![CDATA[This post describes all the properties that may be configured in SQL Server, SQL Database and...]]></description>
      <content:encoded><![CDATA[<p>This post describes all the properties that may be configured in SQL Server, SQL Database and Data-tier Application Component (DAC) projects and how to go about setting them. Specifically, the properties that are defined and persisted in the DBPROJ file and the msbuild target files it references as well as the DBPROJ.USER file. People that need to manually modify the DBPROJ files or use msbuild to execute the targets will find this information useful.</p> <p>The properties defined by database projects can be categorized as</p> <ul> <li>Project level properties – These properties apply to all Visual Studio configurations (i.e. Release, Debug, etc)  <li>Configuration level properties – These properties may be configured differently for each Visual Studio configuration (i.e. Release, Debug, etc)  <li>Isolated development environment properties – These properties are developer specific and are stored in the DBPROJ.USER file. These property settings override the Visual Studio configuration settings when the developer has chosen <strong>Isolated development environment</strong> from the <strong>Project Settings \ Deploy \ Configure deployment settings for</strong> configuration option. This allows the developer, for example, to specify a different SQL Server instance for their personal development environment than the one that will be used when the Debug configuration is built and deployed.</li></ul> <p>&nbsp;</p> <h3>Project level properties</h3> <p>The following table describes the properties that apply to all defined project configurations (i.e. Release and Debug).</p> <table border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="200"> <p><b>Property</b></p></td> <td valign="top" width="705"> <p><b>Description</b></p></td></tr> <tr> <td valign="top" width="200"> <p>AllowDatabaseObjects </p></td> <td valign="top" width="705"> <p>This property determines whether or not SQL database level objects are allowed in the project. For example, tables and views. This property is True for database and server projects. Do not change this value.</p></td></tr> <tr> <td valign="top" width="200"> <p>AllowServerObjects </p></td> <td valign="top" width="705"> <p>This property determines whether or not SQL instance level objects are allowed in the project. LOGINs are an example. This property is True for Server projects. Do not change this value.</p></td></tr> <tr> <td valign="top" width="200"> <p>DAC</p></td> <td valign="top" width="705"> <p>This property indicates that the project is a DAC project. Change the setting by selecting Data-tier Application from the <strong>Project Properties \ Project Settings \ Database version</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>DacApplicationName</p></td> <td valign="top" width="705"> <p>This property is DAC specific. It defines the name of the Data-tier Application Component. You may change the setting using the <strong>Project Properties \ Project Settings \ Data-tier Application properties \ Name</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>DacVersionString</p></td> <td valign="top" width="705"> <p>This property is DAC specific. It defines the version number of the Data-tier Application Component. You may change the setting using the <strong>Project Properties \ Project Settings \ Data-tier Application properties \ Version</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>DacDescription</p></td> <td valign="top" width="705"> <p>This property is DAC specific. It defines the description of the Data-tier Application Component. You may change the setting using the <strong>Project Properties \ Project Settings \ Data-tier Application properties \ Description</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>DefaultFileStructure</p></td> <td valign="top" width="705"> <p>This property is set by the new project wizard. It indicates if the folders created for the project will be organized by SQL Type (Table, View, etc.) or by SQL Schema (dbo, HumanResources, etc.). This property can only be set by running the new database project wizard. For example, <strong>File \ New Project \ Database \ SQL Server \ SQL Server 2008 Wizard</strong>.</p></td></tr> <tr> <td valign="top" width="200"> <p>DeployToDatabaseAddToServerExplorer </p></td> <td valign="top" width="705"> <p>This is a Boolean flag that determines whether or not a connection is persisted when the database project is deployed from Visual Studio. Specifically, the connection defined in the <strong>Project Properties \ Deploy \ Target connection</strong> setting. Persisting the connection will make it appear in Server Explorer, Data Generation, Schema Compare, etc.. Change this setting by manually editing the DBPROJ file.</p></td></tr> <tr> <td valign="top" width="200"> <p>DSP</p></td> <td valign="top" width="705"> <p>This is the property in the project file identifying the Database Service Provider (DSP) (aka the version of SQL server) that the project is targeted for. You may change this value using the <strong>Project Properties \ Project Settings \ Database version</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>IncludeSchemaNameInFileName</p></td> <td valign="top" width="705"> <p>This properties controls whether or not the name of the SQL schema to which the object is bound will be included in the filename for the .sql script file. You may change this value using the Project Settings <b>Include Schema name in file name</b> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>LoadSqlClrTypes</p></td> <td valign="top" width="705"> <p>This property is specific to SQL 2008 database and DAC projects. When set to True it causes the SQL Server 2008 geodetic types to be automatically included in the model for the project. Change this setting by manually editing the DBPROJ file.</p></td></tr> <tr> <td valign="top" width="200"> <p>ModelCollation</p></td> <td valign="top" width="705"> <p>This is the collation used when creating the project model. You may change this value using the <strong>Project Properties \ Project Settings \ Collation for database model</strong> setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>Name</p></td> <td valign="top" width="705"> <p>This is the name of the project. You may change it by right-clicking on the project node in Solution Explorer and selected Rename.</p></td></tr> <tr> <td valign="top" width="200"> <p>PostUpgradeAddToSCC</p></td> <td valign="top" width="705"> <p>This is a list of files that need to be added to SCC after upgrading a project created in an earlier version of Visual Studio. It is only used during the project upgrade process. Don’t change this value.</p></td></tr> <tr> <td valign="top" width="200"> <p>PreviousProjectVersion</p></td> <td valign="top" width="705"> <p>This is the project version we upgraded from, assuming the project was created in an earlier version of Visual Studio. It is used so that features like Data Generation know the data generation plans should be upgraded when they are opened in Visual Studio 2010. Don’t change this value.</p></td></tr> <tr> <td valign="top" width="200"> <p>ProjectGuid</p></td> <td valign="top" width="705"> <p>This is a value used to uniquely identify each project. Don’t change this value.</p></td></tr> <tr> <td valign="top" width="200"> <p>ProjectVersion</p></td> <td valign="top" width="705"> <p>The version of the template used to create the .dbproj file. This property is used to determine whether or not the project file needs to be upgraded. Don’t change this setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>SchemaVersion</p></td> <td valign="top" width="705"> <p>This property represents the version of the schema for the project file. Don’t change this setting.</p></td></tr> <tr> <td valign="top" width="200"> <p>ShowWizard</p></td> <td valign="top" width="705"> <p>This property determines whether or not the new project wizard will be launched. If you want to execute the new project wizard you should create a new project using the wizard template.</p></td></tr></tbody></table> <p>&nbsp;</p> <h3>Configuration level properties</h3> <p>The following table describes the properties that may be assigned unique values for each defined project configurations (i.e. Release or Debug).</p> <table border="1" cellspacing="0" cellpadding="0" width="961"> <tbody> <tr> <td valign="top" width="251"> <p><b>Property</b></p></td> <td valign="top" width="708"> <p><b>Description</b></p></td></tr> <tr> <td valign="top" width="251"> <p>BuildScriptName</p></td> <td valign="top" width="708"> <p>This property defines the name of the .sql file that will be created when the user deploys the project. You may change this value using the <strong>Project Properties \ Deploy \ Deployment script name</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>CatalogPropertiesFile</p></td> <td valign="top" width="708"> <p>This property defines the name of the file containing the SQL database (aka Catalog) settings. You may change this value using the <strong>Project Properties \ Project Settings\ Catalog properties file</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>CopyToOutputDirectory</p></td> <td valign="top" width="708"> <p>This property defines whether or not the file will be copied to the output folder when the project is built. Change this setting by selecting the specific file in Solution Explorer, opening the Property Viewer (F4) and modifying the property setting <strong>Copy to output directory</strong>.</p></td></tr> <tr> <td valign="top" width="251"> <p>DefaultSchema </p></td> <td valign="top" width="708"> <p>This property controls which SQL schema new objects are bound to by default. You may change this value using the <strong>Project Properties \ Project Settings\ Default schema</strong> setting. </p></td></tr> <tr> <td valign="top" width="251"> <p>DeploymentConfigFile </p></td> <td valign="top" width="708"> <p>This property defines the name of the file containing configuration settings for the deployment engine. You may change this value using the <strong>Project Properties \ Deploy \ Deployment configuration file</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>DeployToDatabase </p></td> <td valign="top" width="708"> <p>This property controls whether or not the deployment .sql script that is created when the user Deploys the project from within Visual Studio is actually executed against the target database. You may change this value using the <strong>Project Properties \ Deploy \ Deploy action</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>DeployToScript </p></td> <td valign="top" width="708"> <p>This property controls whether or not the deployment .sql script is saved to disk when the user Deploys the project from within Visual Studio. The project system always sets this property to True when you choose a value using the <strong>Project Properties \ Deploy \ Deploy action</strong> setting. If you want to set the property to False you must manually edit the project file.</p></td></tr> <tr> <td valign="top" width="251"> <p>OutputPath </p></td> <td valign="top" width="708"> <p>This is the location where build generated artifacts will be saved. You may change this value using the <strong>Project Properties \ Build \ Build output path</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>ServerPropertiesFile </p></td> <td valign="top" width="708"> <p>This property defines the name of the file containing the SQL instance settings. This property is only valid for server projects. You may change this value using the <strong>Project Properties \ Project Settings\ Server properties file</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>SqlCommandVariablesFile </p></td> <td valign="top" width="708"> <p>This property defines the name of the file containing definitions for any SQLCMD variables the user has defined. You may change this value using the <strong>Project Properties \ Deploy \ Sql command variables file</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>SuppressWarnings </p></td> <td valign="top" width="708"> <p>This is the list of T-SQL Static Code Analysis rules that have been suppressed for the entire project. You may change this value using the <strong>Project Properties \ Build \ Suppress warnings</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>TargetConnectionString </p></td> <td valign="top" width="708"> <p>This property stores the SQL connection string that will be used when deploying the project. You may change this value using the <strong>Project Properties \ Deploy \</strong> <b>Target connection</b> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>TargetDatabase </p></td> <td valign="top" width="708"> <p>This property stores the database name that will be used when deploying the project. You may change this value using the <strong>Project Properties \ Deploy \</strong> <b>Target database name</b> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>TreatWarningsAsErrors </p></td> <td valign="top" width="708"> <p>You may change this value using the <strong>Project Properties \ Build \</strong> <b>Treat warnings as errors</b> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>DacDatabaseCollation</p></td> <td valign="top" width="708"> <p>This property is specific to DAC projects. The setting defines the SQL collation of the target database. You may change the value using the <strong>Project Properties \ Build \ Database collation</strong> setting.</p></td></tr> <tr> <td valign="top" width="251"> <p>ValidatePolicy</p></td> <td valign="top" width="708"> <p>This property is specific to DAC projects. The setting determines whether or not the DAC deployment engine will validate that the target SQL instance meets the policy settings defined in the .sqlpolicy file. You may change the value using the <strong>Project Properties \ Deploy \ Validate server selection policy on destination instance</strong> setting.</p></td></tr></tbody></table> <p></p> <p></p> <h3> <p> <h3> <p> <p><font size="2"><font face="Trebuchet MS"><font color="#000000">&nbsp;</p> <p></p></h3> <p></p></h3></font></font></font> <h3>Isolated development environment</h3> <p>The purpose of the isolated development environment settings is to individual developers to control database deployment behavior without affecting other team members. These settings are not persisted in the DBPROJ file so they will not be checked into source code control. The following table describes the properties that may be set for the developer’s Isolated development environment. These properties are persisted in the project’s .user file as opposed to the project file itself. When the developer sets <strong>Project Settings \ Deploy \ Configure deployment settings for</strong> to <strong>My isolated development environment</strong> the following properties are used for the associated setting instead of the Visual Studio configuration’s properties.</p> <table border="1" cellspacing="0" cellpadding="0" width="907"> <tbody> <tr> <td valign="top" width="219"> <p><b>Property</b></p></td> <td valign="top" width="686"> <p><b>Description</b></p></td></tr> <tr> <td valign="top" width="219"> <p>UseSandboxSettings</p></td> <td valign="top" width="686"> <p>This property determines whether or not the settings defined for the user’s Isolated development environment will be used. Set this value by changing the <strong>Project Settings \ Deploy \ Configure deployment settings for</strong> setting to <strong>My isolated development environment</strong>.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxDeployToDatabase</p></td> <td valign="top" width="686"> <p>This property controls whether or not the deployment .sql script that is created when the user Deploys the project from within Visual Studio is actually executed against the target database. You may change this value using the <strong>Project Properties \ Deploy \ Deploy action</strong> setting.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxDeployScriptFileName</p></td> <td valign="top" width="686"> <p>This property defines the name of the .sql file that will be created when the user deploys the project. You may change this value using the <strong>Project Properties \ Deploy \ Deployment script name</strong> setting.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxTargetConnectionString</p></td> <td valign="top" width="686"> <p>This property stores the SQL connection string that will be used when deploying the project. You may change this value using the <strong>Project Properties \ Deploy \ Target connection</strong> setting.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxTargetDatabase</p></td> <td valign="top" width="686"> <p>This property stores the database name that will be used when deploying the project. You may change this value using the <strong>Project Properties \ Deploy \ Target database name</strong> setting.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxDeploymentConfigFile</p></td> <td valign="top" width="686"> <p>This property defines the name of the file containing configuration settings for the deployment engine. You may change this value using the <strong>Project Properties \ Deploy \ Deployment configuration file</strong> setting.</p></td></tr> <tr> <td valign="top" width="219"> <p>SandboxSqlCommandVariablesFile</p></td> <td valign="top" width="686"> <p>This property defines the name of the file containing definitions for any SQLCMD variables the user has defined. You may change this value using the <strong>Project Properties \ Deploy \ Sql command variables file</strong> setting.</p></td></tr></tbody></table>]]></content:encoded>
    </item>
    <item>
      <title>What happened to DBP (aka database) projects in Visual Studio 2010?</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/what-happened-to-dbp-aka-database-projects-in-visual-studio-2010</link>
      <pubDate>Tue, 20 Oct 2009 13:22:26 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/10/20/what-happened-to-dbp-aka-database-projects-in-visual-studio-2010/</guid>
      <description><![CDATA[Technorati Tags: DBP,database,project,visual studio 2010 In Visual Studio 2010 DBP projects (also...]]></description>
      <content:encoded><![CDATA[<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e8957487-7b28-441c-9b22-e0c8e6e7a23a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="technorati.com/tags/DBP" rel="tag">DBP</a>,<a href="technorati.com/tags/database" rel="tag">database</a>,<a href="technorati.com/tags/project" rel="tag">project</a>,<a href="technorati.com/tags/visual+studio+2010" rel="tag">visual studio 2010</a></div> <p>In Visual Studio 2010 DBP projects (also known as database projects) have been replaced by DBPROJ projects (aka SQL Server 2005 or 2008 Database Projects). DBPROJ projects have only been available in Visual Studio Team System 2005 and 2008. Now these project types are available in Visual Studio 2010 Professional, Premium and Ultimate editions.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/WhathappenedtoDBPakadatabaseprojectsinVi_BAB8/image_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/WhathappenedtoDBPakadatabaseprojectsinVi_BAB8/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/WhathappenedtoDBPakadatabaseprojectsinVi_BAB8/image_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/WhathappenedtoDBPakadatabaseprojectsinVi_BAB8/image_thumb.png" width="785" height="544"></a> </p> <p>&nbsp;</p> <h3>How do I migrate my DBP projects to Visual Studio 2010?</h3> <p>Refer to this blog post for a tool that will automatically convert your project into a DBPROJ project: <a title="Converting .dbp files to .dbproj files" href="https://blogs.msdn.com/psirr/archive/2009/11/16/converting-dbp-files-to-dbproj-files.aspx">Converting .dbp files to .dbproj files</a></p> <p>Refer to this MSDN documentation for detailed instructions on doing the conversion by hand: <a title="msdn.microsoft.com/en-us/library/ee517378(VS.100).aspx" href="https://msdn.microsoft.com/en-us/library/ee517378(VS.100).aspx">msdn.microsoft.com/en-us/library/ee517378(VS.100).aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>What is a Visual Studio 2010 Data-tier Application project?</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/what-is-a-visual-studio-2010-data-tier-application-project</link>
      <pubDate>Mon, 19 Oct 2009 10:47:11 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/10/19/what-is-a-visual-studio-2010-data-tier-application-project/</guid>
      <description><![CDATA[Technorati Tags: Visual Studio 2010,Data Dude,DBPro,Database Project,DAC,Data-tier Application In...]]></description>
      <content:encoded><![CDATA[<p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1c5733cf-d88f-4742-a6d9-f305c90ca1f6" class="wlWriterEditableSmartContent">Technorati Tags: <a href="technorati.com/tags/Visual+Studio+2010" rel="tag">Visual Studio 2010</a>,<a href="technorati.com/tags/Data+Dude" rel="tag">Data Dude</a>,<a href="technorati.com/tags/DBPro" rel="tag">DBPro</a>,<a href="technorati.com/tags/Database+Project" rel="tag">Database Project</a>,<a href="technorati.com/tags/DAC" rel="tag">DAC</a>,<a href="technorati.com/tags/Data-tier+Application" rel="tag">Data-tier Application</a></div></p> <p>In Visual Studio 2010 Beta 2 we have introduced a new database project type to support SQL Server Data-tier Applications (DAC). For detailed information on what DACs are please search for information available on SQL’s Books On Line (BOL). I suggest using the search string “SQL Server 2008 R2 SQL Data-tier Application.” As new releases of SQL Server 2008 R2 are made available additional information will be published by the SQL Server team.</p> <p><strong>IMPORTANT:</strong> This is brand new technology from the Visual Studio and SQL teams. In order to deploy a DAC project you will need to target the forthcoming SQL Server 2008 R2 November Customer Technology Preview.</p>]]></content:encoded>
    </item>
    <item>
      <title>Implementing a WIX installer that calls the GDR version of VSDBCMD.EXE</title>
      <link>https://docs.microsoft.com/archive/blogs/dukek/implementing-a-wix-installer-that-calls-the-gdr-version-of-vsdbcmd-exe</link>
      <pubDate>Mon, 19 Oct 2009 08:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Duke Kamstra]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dukek/2009/10/19/implementing-a-wix-installer-that-calls-the-gdr-version-of-vsdbcmd-exe/</guid>
      <description><![CDATA[Technorati Tags: Data Dude,DBPro,Database Edition,VSDBCMD,WiX,Setup,MSI One of the cool things that...]]></description>
      <content:encoded><![CDATA[<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e888b00b-58f0-4c3e-8f7f-b72aa4b5c580" class="wlWriterEditableSmartContent">Technorati Tags: <a href="technorati.com/tags/Data+Dude" rel="tag">Data Dude</a>,<a href="technorati.com/tags/DBPro" rel="tag">DBPro</a>,<a href="technorati.com/tags/Database+Edition" rel="tag">Database Edition</a>,<a href="technorati.com/tags/VSDBCMD" rel="tag">VSDBCMD</a>,<a href="technorati.com/tags/WiX" rel="tag">WiX</a>,<a href="technorati.com/tags/Setup" rel="tag">Setup</a>,<a href="technorati.com/tags/MSI" rel="tag">MSI</a></div> <p>One of the cool things that shipped with the <u><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&amp;displaylang=en">Visual Studio Team System 2008 Database Edition GDR</a></u> (aka the GDR) is the command line utility <a href="https://msdn.microsoft.com/en-us/library/dd193283.aspx">VSDBCMD.EXE</a>. By using this utility, you can take the artifacts created by building a Database Project and deploy them to a database instance. If the database doesn’t exist on the instance of SQL Server, it will be created. If the database does exist, it will be altered to look like the source code in your project.</p> <p>We regularly get questions from developers that are implementing multi-tier applications asking to incorporate database deployment into their WiX based MSI. This blog post describes how you can do that.</p> <p>An important thing to point out before we get started is that the VSDBCMD.EXE utility has several <a href="https://msdn.microsoft.com/en-us/library/dd193258.aspx">prerequisites</a> that must be met before the utility will execute successfully. The prerequisites are</p> <ul> <li><a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7">Microsoft .NET Framework 3.5 SP1</a>  <li><a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=dc614aee-7e1c-4881-9c32-3a6ce53384d9">SQL Compact 3.5</a> – Note that SQL Compact allows you to redistribute the files that VSDBCMD.EXE requires. So you may optionally include these files in your MSI. The specific files required by VSDBCMD.EXE are described in the <a href="https://msdn.microsoft.com/en-us/library/dd193258.aspx">MSDN documentation for VSDBCMD.EXE</a>.  <li><a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=c6c3e9ef-ba29-4a43-8d69-a2bed18fe73c">SQL 2008 Management Objects</a></li></ul> <p>Ensure that these prerequisites are installed on the computers on which you plan to run your MSI.</p> <h3>Development Environment Prerequisites</h3> <ul> <li><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&amp;displaylang=en">Visual Studio Team System 2008 Database Edition GDR R2</a>  <li><a href="wix.sourceforge.net/">Windows Installer XML (WiX) Toolset</a> (I recommend you download both the tools and the source code)</li></ul> <h3>Overview</h3> <p>I have written this blog post assuming the reader knows very little about WiX authoring. For the experts out there you can skim the information you are already familiar with. Here’s what we’re going to do in the remainder of this blog post.</p> <ul> <li>Create the Visual Studio Solution  <li>Implement the WiX Installer  <ul> <li>Create the source code files in the project  <li>Define the directory structure that will be created when the installer runs  <li>Define the artifacts from the database project that will get installed  <li>Define the artifacts related to VSDBCMD.EXE that will get installed  <li>Implement a dialog that will collect the SQL Server instance name and the database name that will be used when the database is installed  <li>Implement the overall user interface for the installer  <li>Implement the WiX code that executes VSDBCMD.EXE</li></ul></li></ul> <p><font color="#000000"><strong>Note:</strong> On operating systems such as Windows Vista or Windows 7, the installer will need to be run using Administrator privileges (aka run with elevated privileges).</font></p> <h3>Create the Visual Studio Solution</h3> <p>For the purposes of this blog post we will create a new Database project. If you already have a database project you can simply add it to the solution instead of creating a new one.</p> <ol> <li>Create a new solution containing a database project: File\New\Project\Database Projects\SQL Server 2008\SQL Server 2008 Database Project  <ol> <li>Set the project’s Name to <strong>MyDatabase</strong>  <li>Set the Solution Name to <strong>DatabaseInstaller</strong>  <li>Click the <strong>OK</strong> button  <li>Add a Table to the database project so that something interesting will actually happen when we run our final MSI.</li></ol> <li>Add a WiX project to the <strong>DatabaseInstaller</strong> Solution: File\Add\New Project\Wix\Wix Project  <ol> <li>Set the project’s Name to <strong>InstallMyDatabase</strong></li></ol> <li>Add References to the <strong>InstallMyDatabase</strong> project. These are the DLL’s that contain the actual code for executing the setup user interface.  <ol> <li>Right-click on the <strong>InstallMyDatabase</strong> project’s References node in Solution Explorer and select <strong>Add Reference…</strong>  <li>Click the Browse tab and specify the DLLs that are named WixUIExtension.dll and WixUtilExtension.dll.  <li>Click the <strong>Add</strong> button.  <li>Click the <strong>OK</strong> button.</li></ol></li></ol> <h3>Implement the WiX installer</h3> <p>Our installer is pretty simple. It will do the following</p> <ol> <li>Present the user with a License Agreement dialog  <li>Prompt the user for the name of the SQL Server instance he or she wants to install the database on as well as the name of the database. See the screenshot below.  <li>Copy the artifacts created by building our database project to the computer  <li>Copy&nbsp; VSDBCMD.EXE utility and its assemblies to the computer  <li>Execute VSDBCMD.EXE  <li>Exit</li></ol> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/CallingVSDBCMD.EXEfromaWIXinstaller_D8AC/image_2.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/CallingVSDBCMD.EXEfromaWIXinstaller_D8AC/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/dukek/WindowsLiveWriter/CallingVSDBCMD.EXEfromaWIXinstaller_D8AC/image_thumb.png" original-url="blogs.msdn.com/blogfiles/dukek/WindowsLiveWriter/CallingVSDBCMD.EXEfromaWIXinstaller_D8AC/image_thumb.png" width="411" height="323"></a></p> <p>&nbsp;</p> <p>Implement the WiX code by doing the following</p> <ol> <li>By default the WiX project has a Product.wxs source file. Let’s add two include files so we can keep things organized  <ol> <li>Right click on project InstallMyDatabase in Solution Explorer, Select Add\New Item…\WiX Include File  <li>Set the <strong>Name</strong> for the file to DatabaseArtifacts.wxi. This file will contain the setup authoring for the artifacts created when we build our database project.  <li>Add a second file and Name it VsdbcmdArtifacts.wxi. This file will contain the setup authoring for the VSDBCMD.EXE utility and the files it requires.</li></ol> <li>Define the folder structure that we need to create by adding the following code to the Product.wxs file immediately after the <span style="color: #a31515">Media<font color="#000000"> element. This code will result in the path “Program Files\MyDatabase\Extensions\SqlServer\2008\DbSchemas” being created on the user’s system.</font></span><pre class="code"><span style="color: #a31515"></span>    <span style="color: blue">&lt;!-- </span><span style="color: green">Setup the folder structure for the install </span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">TARGETDIR</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">SourceDir</span>"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ProgramFilesFolder</span>"<span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">INSTALLLOCATION</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">MyDatabase</span>"<span style="color: blue">&gt;
          &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Extensions</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">Extensions</span>"<span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">SqlServer</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">SqlServer</span>"<span style="color: blue">&gt;
              &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">__2008</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">2008</span>"<span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">Directory </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DbSchemas</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">DbSchemas</span>"<span style="color: blue">&gt;
                &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
              &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
          &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
      &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">Directory</span><span style="color: blue">&gt;</span></pre>
<p><span style="color: blue"><font color="#000000" face="Trebuchet MS">A couple interesting things to note about the values in the <font color="#ff0000">Id</font> attributes for the <span style="color: blue">&lt;</span><span style="color: #a31515">Directory<span style="color: blue">&gt;</span></span> elements; 1) As you will see, WiX turns these values into properties that we can use in our authoring and 2) properties that are UPPERCASED can be overridden from the command line when the MSI is run. I’ll demonstrate this in the section that covers running the MSI we’re building.</font></span></p><a href="11011.net/software/vspaste"></a>
<li>Now include the two wxi files we created earlier<pre class="code">    <span style="color: blue">&lt;?</span><span style="color: #a31515">include </span><span style="color: gray">$(var.SolutionDir)InstallMyDatabase\DatabaseArtifacts.wxi </span><span style="color: blue">?&gt;
    &lt;?</span><span style="color: #a31515">include </span><span style="color: gray">$(var.SolutionDir)InstallMyDatabase\VsdbcmdArtifacts.wxi</span><span style="color: blue">?&gt;</span></pre>
<p></p><a href="11011.net/software/vspaste"></a>
<li>Open the file DatabaseArtifacts.wxi and replace <span style="color: blue">&lt;!-- </span><span style="color: green">TODO: Put your code here. –</span><span style="color: blue">&gt; </span>with the following code<pre class="code">  <span style="color: blue">&lt;</span><span style="color: #a31515">DirectoryRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">INSTALLLOCATION</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqlcmd</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Database.sqlcmdvars</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Database.sqlcmdvars</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqldeployment</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Database.sqldeployment</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Database.sqldeployment</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqlsettings</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Database.sqlsettings</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Database.sqlsettings</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DATABASEDBSCHEMA</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Database1.dbschema</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\MyDatabase.dbschema</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseDeploymanifest</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Database1.deploymanifest</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\MyDatabase.deploymanifest</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftSqlTypesDbschema</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.SqlTypes.dbschema</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Microsoft.SqlTypes.dbschema</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">PostDeploymentScript</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Script.PostDeployment.sql</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Script.PostDeployment.sql</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">PreDeploymentScript</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Script.PreDeployment.sql</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)MyDatabase\sql\debug\Script.PreDeployment.sql</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">DirectoryRef</span><span style="color: blue">&gt;</span></pre>
<p><span style="color: blue"><font color="#000000" face="Trebuchet MS">Complete the code by replacing each instance of PUT-GUID-HERE with your own unique GUIDs. You can launch a GUID generation tool from the Visual Studio Tools menu: Tools\Create GUID. Choose the <strong>Registry Format</strong> and delete the open and close curly braces “{ }” after you paste the GUIDs into the code.</font></span></p>
<p><span style="color: blue"><font color="#000000" face="Trebuchet MS">Those of you familiar with WiX syntax will understand all the details of this code. For you rookies that don’t feel like reading the WiX documentation, here’s what’s going on:</font></span></p>
<table border="0" cellspacing="0" cellpadding="2" width="780">
<tbody>
<tr>
<td valign="top" width="200"><span style="color: blue">&lt;</span><span style="color: #a31515">DirectoryRef<font color="#0000ff">&gt;</font></span></td>
<td valign="top" width="578">This element “references” the <span style="color: blue">&lt;</span><span style="color: #a31515">Directory<font color="#0000ff">&gt;</font><font color="#000000"> element with the matching Id. It tells WiX that the components contained inside will get installed to the folder <font color="#0000ff">INSTALLLOCATION</font>.</font></span></td></tr>
<tr>
<td valign="top" width="200"><span style="color: blue">&lt;</span><span style="color: #a31515">Component<font color="#0000ff">&gt;</font></span></td>
<td valign="top" width="578">A component is a group of things that need to be installed as one atomic unit. All or nothing, so to speak. Each <span style="color: blue">&lt;</span><span style="color: #a31515">Component<font color="#0000ff">&gt;</font></span> must have it’s own <font color="#ff0000">Guid</font>. Guids are how the Windows Installer keeps track of components. It is strongly recommended that each component contain a single <span style="color: blue">&lt;</span><span style="color: #a31515">File<font color="#0000ff">&gt;</font></span>. The reason for this recommendation has to do with servicing. If you ever need to create a patch you will reference the component(s) that needs to be serviced.</td></tr>
<tr>
<td valign="top" width="200"><font color="#0000ff">$</font><span style="color: blue">(var.SolutionDir)</span></td>
<td valign="top" width="578">A useful variable that is implemented by the WiX compiler’s pre-processor. Saves you from worrying about relative/changing paths.</td></tr>
<tr>
<td valign="top" width="200"><span style="color: red">KeyPath</span></td>
<td valign="top" width="578">This attribute tells the Windows Installer (aka msiexec) to use this file to determine whether or not the component is installed on the system.</td></tr></tbody></table><a href="11011.net/software/vspaste"></a>
<p></p>
<li>Open the file VsdbcmdArtifacts.wxi and replace <span style="color: blue">&lt;!-- </span><span style="color: green">TODO: Put your code here. –</span><span style="color: blue">&gt; </span>with the following code<pre class="code">  <span style="color: blue">&lt;!--</span><span style="color: green">Make sure we have the correct path to the Data Dude redistributables regardless
  of the OS architecture.</span><span style="color: blue">--&gt;
  &lt;?</span><span style="color: #a31515">if </span><span style="color: gray">$(var.Platform)=x64 </span><span style="color: blue">?&gt;
    &lt;?</span><span style="color: #a31515">define </span><span style="color: gray">SrcArchPath = "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VSTSDB\Deploy\"</span><span style="color: blue">?&gt;
  &lt;?</span><span style="color: #a31515">else</span><span style="color: blue">?&gt;
    &lt;?</span><span style="color: #a31515">define </span><span style="color: gray">SrcArchPath = "C:\Program Files\Microsoft Visual Studio 9.0\VSTSDB\Deploy\"</span><span style="color: blue">?&gt;
  &lt;?</span><span style="color: #a31515">endif</span><span style="color: blue">?&gt;

  &lt;</span><span style="color: #a31515">DirectoryRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">INSTALLLOCATION</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchema</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.Data.Schema.dll</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Microsoft.Data.Schema.dll</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Checksum</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaScriptDom</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.Data.Schema.ScriptDom.dll</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Microsoft.Data.Schema.ScriptDom.dll</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Checksum</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaScriptDomSql</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.Data.Schema.ScriptDom.Sql.dll</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Microsoft.Data.Schema.ScriptDom.Sql.dll</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Checksum</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaSql</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.Data.Schema.Sql.dll</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Microsoft.Data.Schema.Sql.dll</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Checksum</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Vsdbcmd</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">vsdbcmd.exe</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)vsdbcmd.exe</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Checksum</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">DirectoryRef</span><span style="color: blue">&gt;

  &lt;</span><span style="color: #a31515">DirectoryRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">SqlServer</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSchemaProvidersExtensionsXml</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSchemaProviders.Extensions.Xml</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Extensions\SqlServer\DatabaseSchemaProviders.Extensions.xml</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">DirectoryRef</span><span style="color: blue">&gt;

  &lt;</span><span style="color: #a31515">DirectoryRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DbSchemas</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftSqlTypes</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">File </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftSqlTypesDbschema</span>" <span style="color: red">Source</span><span style="color: blue">=</span>"<span style="color: blue">$(var.SrcArchPath)Extensions\SqlServer\2008\DBSchemas\Microsoft.SqlTypes.dbschema</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">DirectoryRef</span><span style="color: blue">&gt;
</span></pre><a href="11011.net/software/vspaste"></a><pre class="code"><span style="color: blue">  &lt;!--</span><span style="color: green">Install the Visual Studio 9.0 registry key if it doesn't exist. </span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">Feature </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">RegistryPreReqs</span>" <span style="color: red">Title</span><span style="color: blue">=</span>"<span style="color: blue">Registry Prerequisites</span>" <span style="color: red">Level</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">RegistryEntries</span>"<span style="color: blue">/&gt;
    &lt;</span><span style="color: #a31515">Condition </span><span style="color: red">Level</span><span style="color: blue">=</span>"<span style="color: blue">0</span>"<span style="color: blue">&gt;</span>NOT VISUALSTUDIOREGISTRY<span style="color: blue">&lt;/</span><span style="color: #a31515">Condition</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;

  &lt;!--</span><span style="color: green">VSDBCMD requires this REGKEY to be installed. Note that this will NOT be true for the Visual Studio 2010 version</span><span style="color: blue">--&gt;
  &lt;!--</span><span style="color: green">HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0</span><span style="color: blue">--&gt;

  &lt;!-- </span><span style="color: green">Define the search for the Visual Studio 9.0 registry key </span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">Property </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">VISUALSTUDIOREGISTRY</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">RegistrySearch </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">VisualStudio90Registry</span>"
                    <span style="color: red">Root</span><span style="color: blue">=</span>"<span style="color: blue">HKCU</span>"
                    <span style="color: red">Key</span><span style="color: blue">=</span>"<span style="color: blue">Software\Microsoft\VisualStudio\9.0</span>"
                    <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">(Default)</span>"
                    <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">raw</span>" <span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;

  &lt;!-- </span><span style="color: green">Define the Visual Studio 9.0 Registry entry</span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">DirectoryRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">TARGETDIR</span>"<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Component </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">RegistryEntries</span>" <span style="color: red">Guid</span><span style="color: blue">=</span>"PUT-GUID-HERE"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">RegistryKey </span><span style="color: red">Root</span><span style="color: blue">=</span>"<span style="color: blue">HKCU</span>"
                   <span style="color: red">Key</span><span style="color: blue">=</span>"<span style="color: blue">Software\Microsoft\VisualStudio\9.0</span>"
                   <span style="color: red">Action</span><span style="color: blue">=</span>"<span style="color: blue">create</span>"
                     <span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">RegistryValue </span><span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">string</span>" <span style="color: red">Name</span><span style="color: blue">=</span>"<span style="color: blue">(Default)</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">Default Value</span>" <span style="color: red">KeyPath</span><span style="color: blue">=</span>"<span style="color: blue">no</span>"<span style="color: blue">/&gt;
      &lt;/</span><span style="color: #a31515">RegistryKey</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">Component</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">DirectoryRef</span><span style="color: blue">&gt;</span></pre>
<p><span style="color: blue"></span></p>
<p><span style="color: blue"><font color="#000000"></font></span>&nbsp;</p>
<p><span style="color: blue"><font color="#000000">Just like you did previously, replace each instance of PUT-GUID-HERE with your own GUIDs. <span style="color: blue"><font color="#000000" face="Trebuchet MS">There are a few new things to point out in this code</font></span></p>
<table border="0" cellspacing="0" cellpadding="2" width="780">
<tbody>
<tr>
<td valign="top" width="200"><span style="color: blue">&lt;?</span><span style="color: #a31515">if</span>…</td>
<td valign="top" width="578">While I was implementing this code I was working on the project on a couple different computers. One was running a 32-bit OS and the other was running a 64-bit OS. Well vsdbcmd.exe and it’s dependencies are installed in under “Program Files“ or “Program Files (x86) depending on the architecture of the OS. So, I took advantage of the WiX’s pre-processor’s conditional logic and predefined variable <span style="color: gray">$(var.Platform)</span> to define my own variable representing the path to the files I needed.</td></tr>
<tr>
<td valign="top" width="200"><span style="color: red">Checksum</span></td>
<td valign="top" width="578">This attribute tells the Windows Installer that the file has a checksum that may be used to validate that the file hasn’t been tampered with. You should always set it to "<span style="color: blue">yes</span>" for executables (dll’s and exe’s).</td></tr>
<tr>
<td valign="top" width="200"><span style="color: blue">&lt;</span><span style="color: #a31515">Feature<span style="color: blue">&gt;</span></span></td>
<td valign="top" width="578">In the Windows Installer world a Product is composed of one or more Features. I am using this feature to define a component that I want installed if it does not already exist on the target system. The<span style="color: blue">&lt;</span><span style="color: #a31515">ComponentRef<font color="#0000ff">&gt;</font><font color="#000000"> element defines the component I want installed. Specifically, the <span style="color: blue">RegistryEntries</span> component. The feature’s <span style="color: blue">&lt;</span><span style="color: #a31515">Condition<span style="color: #a31515"><font color="#0000ff">&gt;</font></span><font color="#000000"> element indicates that I want to feature installed the expression (NOT VISUALSTUDIOREGISTRY) evaluates to true.</font></span></font></span></td></tr>
<tr>
<td valign="top" width="200"><span style="color: blue">VISUALSTUDIOREGISTRY</span></td>
<td valign="top" width="578">This is a property that represents the results of the <span style="color: blue">&lt;</span><span style="color: #a31515">RegistrySearch<span style="color: blue">&gt;<font color="#000000">. The attributes of the element define the particular registry key to search for.</font></span></span></td></tr>
<tr>
<td valign="top" width="200"><span style="color: blue">RegistryEntries</span></td>
<td valign="top" width="578">This <span style="color: blue">&lt;</span><span style="color: #a31515">Component<font color="#0000ff">&gt;</font><font color="#000000"> defines the registry key that will be created assuming the <span style="color: blue">&lt;</span><span style="color: #a31515">RegistrySearch<span style="color: blue">&gt;</span></span> came back empty.</font></span></td></tr></tbody></table>
<p>&nbsp;</p></font></span><a href="11011.net/software/vspaste"></a>
<li>Now that we have all of our components defined, we need to tell WiX to actually install them. Open the Product.wxs file again and add the following code immediately after the <span style="color: blue">&lt;?</span><span style="color: #a31515">include<span style="color: blue">?&gt;</span></span> elements<pre class="code">    <span style="color: blue">&lt;!-- </span><span style="color: green">Define which files to install </span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">Feature </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ProductFeature</span>" <span style="color: red">Title</span><span style="color: blue">=</span>"<font color="#0000ff">InstallMyDatabase</font>" <span style="color: red">Level</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"<span style="color: blue">&gt;
</span><span style="color: blue">      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqlcmd</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqldeployment</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSqlsettings</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DATABASEDBSCHEMA</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseDeploymanifest</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftSqlTypesDbschema</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">PostDeploymentScript</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">PreDeploymentScript</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchema</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaScriptDom</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaScriptDomSql</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftDataSchemaSql</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Vsdbcmd</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseSchemaProvidersExtensionsXml</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MicrosoftSqlTypes</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">ComponentRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">RegistryEntries</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p><span style="color: blue"><font color="#000000">Similar to the registry stuff that I described previously, this code defines a <span style="color: blue">&lt;</span><span style="color: #a31515">Feature<span style="color: blue">&gt;</span> </span>which contains <span style="color: blue">&lt;</span><span style="color: #a31515">ComponentRef<span style="color: blue">&gt;</span> </span>elements, one for each component that we want to install on the user’s system. </font></span></p><a href="11011.net/software/vspaste"></a>
<li>At this point you can build your WiX project and run the MSI that is created. Go ahead and build your solution. Open a command shell with elevated privileges (aka Administrator) and change directories to the location of the new MSI. The MSI is placed in &lt;Project Folder&gt;\bin\debug. Execute the MSI using the command line: msiexec /i InstallMyDatabase.msi /l*vx log.txt<br><br>The installation will install each of the components onto your system. An entry will also be added to the Add Remove Programs (ARP) list. To uninstall run the command line: msiexec /x InstallMyDatabase.msi /l*vx log.txt<br>
<li>Our MSI currently doesn’t have an user interface other than a progress bar. What we really want is the typical dialog sequence that shows the user an End User License Agreement (EULA), collects information needed for the install, shows progress then finishes. WiX provides everything we need with the exception of the dialog to capture information about the SQL server and the database name we need to use when we deploy our database. Insert the following code in the Product.wxs file immediately after the <span style="color: blue">&lt;</span><span style="color: #a31515">Feature<span style="color: blue">&gt;</span> </span>element we defined previously.<pre class="code">    <span style="color: blue">&lt;!--</span><span style="color: green">Define the dialog to get the Server and Database name information from the user</span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">UI</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Dialog </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseInformationDialog</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">370</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">270</span>" <span style="color: red">Title</span><span style="color: blue">=</span>"<span style="color: blue">[ProductName] [Setup]</span>" <span style="color: red">NoMinimize</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ServerNameLabel</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Text</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">45</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">73</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">100</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">15</span>" <span style="color: red">TabSkip</span><span style="color: blue">=</span>"<span style="color: blue">no</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">SQL Instance Name:</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ServerNameEdit</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Edit</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">45</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">85</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">220</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">18</span>" <span style="color: red">Property</span><span style="color: blue">=</span>"<span style="color: blue">SERVERNAME</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">{80}</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseNameLabel</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Text</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">45</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">110</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">100</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">15</span>" <span style="color: red">TabSkip</span><span style="color: blue">=</span>"<span style="color: blue">no</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">Database Name:</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseNameEdit</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Edit</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">45</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">122</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">220</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">18</span>" <span style="color: red">Property</span><span style="color: blue">=</span>"<span style="color: blue">DATABASENAME</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">{80}</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">PushButton</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">180</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">243</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">56</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">17</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: red">&amp;amp;</span><span style="color: blue">Back</span>"<span style="color: blue">/</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">PushButton</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">236</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">243</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">56</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">17</span>" <span style="color: red">Default</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: red">&amp;amp;</span><span style="color: blue">Next</span>"<span style="color: blue">/</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Cancel</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">PushButton</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">304</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">243</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">56</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">17</span>" <span style="color: red">Cancel</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">Cancel</span>"<span style="color: blue">&gt;
          &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">SpawnDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">CancelDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">Control</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">BannerBitmap</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Bitmap</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">370</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">44</span>" <span style="color: red">TabSkip</span><span style="color: blue">=</span>"<span style="color: blue">no</span>" <span style="color: red">Text</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Bmp_Banner</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Description</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Text</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">25</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">23</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">280</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">15</span>" <span style="color: red">Transparent</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">NoPrefix</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">&gt;
          &lt;</span><span style="color: #a31515">Text</span><span style="color: blue">&gt;</span>”Please enter a SQL instance and database name.”<span style="color: blue">&lt;/</span><span style="color: #a31515">Text</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">Control</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">BottomLine</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Line</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">234</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">370</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">Title</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Text</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">15</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">6</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">200</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">15</span>" <span style="color: red">Transparent</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: red">NoPrefix</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">&gt;
          &lt;</span><span style="color: #a31515">Text</span><span style="color: blue">&gt;</span>{\WixUI_Font_Title}”SQL instance and database information.”<span style="color: blue">&lt;/</span><span style="color: #a31515">Text</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">Control</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Control </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">BannerLine</span>" <span style="color: red">Type</span><span style="color: blue">=</span>"<span style="color: blue">Line</span>" <span style="color: red">X</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: red">Y</span><span style="color: blue">=</span>"<span style="color: blue">44</span>" <span style="color: red">Width</span><span style="color: blue">=</span>"<span style="color: blue">370</span>" <span style="color: red">Height</span><span style="color: blue">=</span>"<span style="color: blue">0</span>" <span style="color: blue">/&gt;
      &lt;/</span><span style="color: #a31515">Dialog</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">UI</span><span style="color: blue">&gt;
</span></pre><a href="11011.net/software/vspaste"></a>
<p><span style="color: blue"><font color="#000000">This code defines a dialog that contains two labels and associated text input controls. When the user enters text into the <span style="color: blue">ServerNameEdit</span> and <span style="color: blue">DatabaseNameEdit</span> text controls it is persisted in the properties <span style="color: blue">SERVERNAME<font color="#000000"> and </font><span style="color: blue">DATABASENAME</span><font color="#000000">, respectively</font></span>.</font></span></p><a href="11011.net/software/vspaste"></a>
<li>Now we will define the overall user interface for our installer. I did this by copying the source code from the WixUI_Mondo dialog definition, renaming the Id and customizing it to include my <span style="color: blue">DatabaseInformationDialog</span> dialog. Insert the following code immediately following the <span style="color: blue">&lt;</span><span style="color: #a31515">UI</span><span style="color: blue">&gt;</span> element we just added.<pre class="code">    <span style="color: blue">&lt;!--</span><span style="color: green">Define the overall user interface - this is based on the WixUI_Mondo dialog set</span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">UI </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MyWixUI</span>"<span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">TextStyle </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Font_Normal</span>" <span style="color: red">FaceName</span><span style="color: blue">=</span>"<span style="color: blue">Tahoma</span>" <span style="color: red">Size</span><span style="color: blue">=</span>"<span style="color: blue">8</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">TextStyle </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Font_Bigger</span>" <span style="color: red">FaceName</span><span style="color: blue">=</span>"<span style="color: blue">Tahoma</span>" <span style="color: red">Size</span><span style="color: blue">=</span>"<span style="color: blue">12</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">TextStyle </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Font_Title</span>" <span style="color: red">FaceName</span><span style="color: blue">=</span>"<span style="color: blue">Tahoma</span>" <span style="color: red">Size</span><span style="color: blue">=</span>"<span style="color: blue">9</span>" <span style="color: red">Bold</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>" <span style="color: blue">/&gt;

      &lt;</span><span style="color: #a31515">Property </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">DefaultUIFont</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Font_Normal</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">Property </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Mode</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">Mondo</span>" <span style="color: blue">/&gt;

      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ErrorDlg</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">FatalError</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">FilesInUse</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">MsiRMFilesInUse</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">PrepareDlg</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ProgressDlg</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">ResumeDlg</span>" <span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">DialogRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">UserExit</span>" <span style="color: blue">/&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">ExitDialog</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Finish</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">EndDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">Return</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">999</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">WelcomeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">LicenseAgreementDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">LicenseAgreementDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">WelcomeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">LicenseAgreementDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseInformationDialog</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">2</span>"<span style="color: blue">&gt;</span>LicenseAccepted = "1"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseInformationDialog</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseInformationDialog</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">LicenseAgreementDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">DatabaseInformationDialog</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">LicenseAgreementDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">TypicalButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">CustomButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">CompleteButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "Change"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">2</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "InstallCustom"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "InstallCustom"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">SetupTypeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">2</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">3</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "Change"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Order</span><span style="color: blue">=</span>"<span style="color: blue">4</span>"<span style="color: blue">&gt;</span>WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceWelcomeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Next</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;

      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">ChangeButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">CustomizeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">RepairButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">RemoveButton</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">VerifyReadyDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Publish </span><span style="color: red">Dialog</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceTypeDlg</span>" <span style="color: red">Control</span><span style="color: blue">=</span>"<span style="color: blue">Back</span>" <span style="color: red">Event</span><span style="color: blue">=</span>"<span style="color: blue">NewDialog</span>" <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: blue">MaintenanceWelcomeDlg</span>"<span style="color: blue">&gt;</span>1<span style="color: blue">&lt;/</span><span style="color: #a31515">Publish</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">UI</span><span style="color: blue">&gt;
</span></pre><a href="11011.net/software/vspaste"></a><pre class="code"><span style="color: blue">
    &lt;</span><span style="color: #a31515">UIRef </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">WixUI_Common</span>" <span style="color: blue">/&gt;</span></pre>
<p><span style="color: blue"><font color="#000000">I injected my new dialog in the overall sequence changing the <span style="color: blue">LicenseAgreementDlg </span>dialog’s <span style="color: blue">Next </span>button event to open my <span style="color: blue">DatabaseInformationDialog<font color="#000000"> and the </font>Next button<font color="#000000"> in my dialog subsequently launches the </font>SetupTypeDlg.<font color="#000000"> Similarly for the Back button events.</font></span></font></span></p><a href="11011.net/software/vspaste"></a>
<li>Once again you can build and run the MSI at this point. You will see the new dialog we have defined. There is one significant piece still missing, however. That is actually running VSDBCMD.EXE to install our database. To implement this add the following code.<pre class="code">    <span style="color: blue">&lt;!--</span><span style="color: green">Define the custom action to build the vsdbcmd.exe command line string</span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">CustomAction </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">LaunchVsdbcmdCommandLine</span>"
                  <span style="color: red">Property</span><span style="color: blue">=</span>"<span style="color: blue">LaunchVsdbcmd</span>"
                  <span style="color: red">Value</span><span style="color: blue">=</span>"<span style="color: red">&amp;quot;</span><span style="color: blue">[#vsdbcmd.exe]</span><span style="color: red">&amp;quot; </span><span style="color: blue">/a:Deploy /cs:</span><span style="color: red">&amp;quot;</span><span style="color: blue">Server=[SERVERNAME];Integrated Security=true;</span><span style="color: red">&amp;quot; </span><span style="color: blue">/dsp:Sql /dd+ /model:</span><span style="color: red">&amp;quot;</span><span style="color: blue">[INSTALLLOCATION]Database1.dbschema</span><span style="color: red">&amp;quot; </span><span style="color: blue">/p:TargetDatabase=</span><span style="color: red">&amp;quot;</span><span style="color: blue">[DATABASENAME]</span><span style="color: red">&amp;quot; </span><span style="color: blue">/DeploymentScriptFile:<span style="color: red">&amp;quot;</span>[INSTALLLOCATION][DATABASENAME].sql<span style="color: red">&amp;quot;</span></span>"
                  <span style="color: red">Execute</span><span style="color: blue">=</span>"<span style="color: blue">immediate</span>"<span style="color: blue">/&gt;
    &lt;!--</span><span style="color: green">Define the custom action to execute vsdbcmd.exe</span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">CustomAction </span><span style="color: red">Id</span><span style="color: blue">=</span>"<span style="color: blue">LaunchVsdbcmd</span>" <span style="color: red">BinaryKey</span><span style="color: blue">=</span>"<span style="color: blue">WixCA</span>" <span style="color: red">DllEntry</span><span style="color: blue">=</span>"<span style="color: blue">CAQuietExec</span>" <span style="color: red">Execute</span><span style="color: blue">=</span>"<span style="color: blue">deferred</span>" <span style="color: red">Return</span><span style="color: blue">=</span>"<span style="color: blue">check</span>" <span style="color: red">Impersonate</span><span style="color: blue">=</span>"<span style="color: blue">yes</span>"<span style="color: blue">/&gt;

    &lt;!--</span><span style="color: green">Define when the two custom actions will be executed</span><span style="color: blue">--&gt;
    &lt;</span><span style="color: #a31515">InstallExecuteSequence</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">Custom </span><span style="color: red">Action</span><span style="color: blue">=</span>"<span style="color: blue">LaunchVsdbcmdCommandLine</span>" <span style="color: red">Before</span><span style="color: blue">=</span>"<span style="color: blue">InstallFiles</span>"<span style="color: blue">/&gt;
      &lt;</span><span style="color: #a31515">Custom </span><span style="color: red">Action</span><span style="color: blue">=</span>"<span style="color: blue">LaunchVsdbcmd</span>" <span style="color: red">After</span><span style="color: blue">=</span>"<span style="color: blue">InstallFiles</span>"<span style="color: blue">/&gt;
    &lt;/</span><span style="color: #a31515">InstallExecuteSequence</span><span style="color: blue">&gt;</span></pre>
<p><span style="color: blue"></span>&nbsp;</p>
<p><span style="color: blue"><font color="#000000">I found this code to be the most difficult part of the whole project to get right. The first custom action’s (<span style="color: blue">LaunchVsdbcmdCommandLine</span>) purpose is to create the command line string that the second custom action (<span style="color: blue">LaunchVsdbcmd</span>) will actually execute. <span style="color: blue">LaunchVsdbcmdCommandLine</span> declares the property <span style="color: blue">LaunchVsdbcmd</span> and sets its <span style="color: red">Value</span>. The identifiers inside [] are properties that will get bound to their actual values when the custom action is executed. The “#” inside the property references gets expanded to the folder where the files are being installed to (aka INSTALLLOCATION). The second custom action <span style="color: blue">LaunchVsdbcmd</span> uses the property with the name that matches the custom action’s <font color="#ff0000">Id</font> as the command line when it invokes the entry point <span style="color: blue">CAQuietExec<font color="#000000">. The custom action </font><span style="color: blue">LaunchVsdbcmd</span><font color="#000000"> knows to do this because the </font><span style="color: red">Execute<font color="#000000"> attribute is set to </font></span><span style="color: blue">deferred<font color="#000000">. The <span style="color: blue">&lt;</span><span style="color: #a31515">InstallExecuteSequence</span><span style="color: blue">&gt;</span> element is pretty straightforward. It defines when the Windows Installer will actually execute each custom action. Windows Installer executes a series of “actions.” <span style="color: blue">InstallFiles</span> is one of those actions. I chose this action because I know the user has entered the values for <span style="color: blue">SERVERNAME<font color="#000000"> and </font><span style="color: blue">DATABASENAME<font color="#000000">. After this action is complete I know all the files I need are installed on the user’s system.</font></span></span></font></span></span> </font></span></p><a href="11011.net/software/vspaste"></a>
<li>So that’s it. We now have an MSI that will deploy our database when it is run. Use the msiexec command line described earlier to execute the installer. Analyze the log file if the MSI fails for some reason. Any error messages returned by VSDBCMD.EXE will be captured in the log file.</li></ol>
<h3>What’s Missing?</h3>
<p>There are numerous additional things that you will probably want to do in your MSI. For example, display your own EULA, make the project localizable or check that all of the VSDBCMD.EXE prerequisites exist on the system before attempting to run the utility. I leave the implementation of these additional features to you. If you would like to share your enhancements, implementation(s) or give me feedback on this blog post please attach a comment or send me a note: duke dot kamstra at microsoft dot com.</p>]]></content:encoded>
    </item>
  </channel>
</rss>