<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSDT &#8211; Cognim &#8211; Internet development</title>
	<atom:link href="https://www.cognim.co.uk/category/ssdt/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.cognim.co.uk</link>
	<description>Enterprise system implementation. Making the complex simple</description>
	<lastBuildDate>Wed, 29 Jul 2015 09:47:49 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">91553907</site>	<item>
		<title>Adding tables of static data to an SSDT project</title>
		<link>https://www.cognim.co.uk/adding-tables-of-static-data-to-an-ssdt-project/</link>
					<comments>https://www.cognim.co.uk/adding-tables-of-static-data-to-an-ssdt-project/#comments</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Mon, 15 Sep 2014 15:54:06 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[data warehouse]]></category>
		<guid isPermaLink="false">http://makesharp.wordpress.com/?p=71</guid>

					<description><![CDATA[Quite often when creating a database you will need tables of static data.  These range from simple lookups to date dimensions in a data warehouse.  You can easily create these in an SSDT project. Presuming you have already designed your tables and they are present in your project; Create a folder in your project called [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Quite often when creating a database you will need tables of static data.  These range from simple lookups to date dimensions in a data warehouse.  You can easily create these in an SSDT project.</p>
<p>Presuming you have already designed your tables and they are present in your project;</p>
<ul>
<li>Create a folder in your project called StaticData then add a sql script to generate the data you require, one for each table.  For instance I have a date dimension table called Dim_Date and have created a script called Populate_Dim_Date.sql.<br /> <a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/staticsqlscript.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-full wp-image-76" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/staticsqlscript.png?resize=244%2C258&#038;ssl=1" alt="StaticSQLScript" width="244" height="258" /></a></li>
<li>Next create a script called &#8216;Script.PostDeployment.sql&#8217; in the root of your project by right clicking your project and choosing &#8216;Add&#8217; then &#8216;Script&#8217;<br /> <a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/addscript.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-75" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/addscript.png?resize=300%2C146&#038;ssl=1" alt="AddScript" width="300" height="146" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/addscript.png?w=665&amp;ssl=1 665w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/addscript.png?resize=300%2C147&amp;ssl=1 300w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> and choosing &#8216;user scripts&#8217; in the SQL Server section, followed by &#8216;Post-Deployment Script&#8217;, then clicking the Add button.<br /> <a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdeploymentscript.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-74" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdeploymentscript.png?resize=300%2C207&#038;ssl=1" alt="PostDeploymentScript" width="300" height="207" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdeploymentscript.png?w=955&amp;ssl=1 955w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdeploymentscript.png?resize=300%2C207&amp;ssl=1 300w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></li>
</ul>
<p>This will create a script that runs following the full deployment of your project and you can direct it to step through each of your sql creation scripts in the StaticData folder we created earlier. To do this you simply add a SQLCMD read command to the post deployment script for each of the sql files you want to execute. Here I have added a command to read (include) the script I created for the date dimension.</p>
<p><a href="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdepscript.png?ssl=1"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-77" src="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdepscript.png?resize=300%2C135&#038;ssl=1" alt="PostDepScript" width="300" height="135" srcset="https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdepscript.png?w=776&amp;ssl=1 776w, https://i0.wp.com/www.cognim.co.uk/wp-content/uploads/2014/09/postdepscript.png?resize=300%2C135&amp;ssl=1 300w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Note that to prevent an infestation of the red squigglies you will need to select the icon that represents placing the editor in SQLCMD Mode, in my image above it is the icon with a blue border.</p>
<p>Now when you publish your project your tables will be populated according to your scripts &#8211; easy peasy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/adding-tables-of-static-data-to-an-ssdt-project/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">71</post-id>	</item>
		<item>
		<title>Adding database references to a sql server project</title>
		<link>https://www.cognim.co.uk/adding-database-references-to-a-sql-server-project/</link>
					<comments>https://www.cognim.co.uk/adding-database-references-to-a-sql-server-project/#comments</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Tue, 09 Sep 2014 11:24:33 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://makesharp.wordpress.com/?p=57</guid>

					<description><![CDATA[If you are creating a sql server project with SSDT (see here) and your sql refers to another database you will need to add a database reference to allow the project to build. You can do this by right clicking your references folder and selecting &#8216;Add Database Reference&#8217; If the database you are referring to is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you are creating a sql server project with SSDT (<a title="Creating a SQL Project from an existing database" href="https://www.cognim.co.uk/adding-database-references-to-a-sql-server-project/">see here</a>) and your sql refers to another database you will need to add a database reference to allow the project to build. You can do this by right clicking your references folder and selecting &#8216;Add Database Reference&#8217;</p>
<p><a href="http://makesharp.files.wordpress.com/2014/09/adddatabasereference.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-full wp-image-62" src="http://makesharp.files.wordpress.com/2014/09/adddatabasereference.png?resize=244%2C166" alt="AddDatabaseReference" width="244" height="166" /></a></p>
<p>If the database you are referring to is also a part of the solution &#8211; for instance if you are creating a data warehouse and you have a supporting staging database, it is very similar to the process of adding an external project reference to a c# project. you just need to select &#8216;Database projects in the current solution&#8217; and choose your database from the dropdown list.</p>
<p><a href="http://makesharp.files.wordpress.com/2014/09/database-project-in-the-current-solution.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-63" src="http://makesharp.files.wordpress.com/2014/09/database-project-in-the-current-solution.png?w=300&#038;resize=300%2C93" alt="Database project in the current solution" width="300" height="93" /></a></p>
<p>You can also reference a system database here. Occasionally however you will need to reference a database that is neither of the above.  If the database you need to reference is already a data tier application you can browse for the dacpac but if it is not (for instance it may be a legacy database) you will need to create a data tier application from it first.</p>
<p>To extract a dacpac from an existing database, open the sql server object explorer in Visual Studio, connect to the server, right click the database and choose &#8216;Extract Data-tier application&#8217;.</p>
<p><a href="http://makesharp.files.wordpress.com/2014/09/extract-data-tier-app.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-64" src="http://makesharp.files.wordpress.com/2014/09/extract-data-tier-app.png?w=262&#038;resize=262%2C300" alt="Extract Data Tier app" width="262" height="300" /></a></p>
<p>Choose where to save the dacpac, then select &#8216;Extract Schema Only&#8217; and decide whether you need the additional options such as user login mappings etc. Once you have created the dacpac you can go back to the add database reference dialog and select the dacpac you just created.</p>
<p><strong>Database Location</strong></p>
<p>In the Database Location section of the Add Database Reference dialog set the location of the referenced database e.g. &#8216;Different database, same server&#8217;, the name of the database (should be pre-filled) and whether you want to add a database variable to embed into your sql instead of a hardcoded path.  Finally (and often very importantly!) you may want to check the &#8216;Supress errors caused by unresolved references in the referenced project&#8217; option at the bottom of the dialog.  This is especially useful in legacy databases that themselves reference other databases.</p>
<p><a href="http://makesharp.files.wordpress.com/2014/09/add-database-reference.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-61" src="http://makesharp.files.wordpress.com/2014/09/add-database-reference.png?w=300&#038;resize=300%2C210" alt="Add Database Reference" width="300" height="210" /></a></p>
<p>After clicking ok you should be good to go. This reference is there just to allow the application to compile, it does not get included in the deployment, but is an excellent way of making sure that your external references are correct.</p>
<p>As a final note, you need to ensure that your references are kept up to date if you are working on a project.  Although you can create a NuGet feed for your created dacpacs, as of Sept 2014 NuGet does not yet support importing to an SSDT project. For now you will have to keep a manual check.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/adding-database-references-to-a-sql-server-project/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">57</post-id>	</item>
		<item>
		<title>Visual Studio SSDT and TeamCity &#8211; Using Publishing Profiles and TeamCity integration</title>
		<link>https://www.cognim.co.uk/ssdt-using-publishing-profiles-and-teamcity-integration/</link>
					<comments>https://www.cognim.co.uk/ssdt-using-publishing-profiles-and-teamcity-integration/#comments</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Fri, 01 Aug 2014 13:02:33 +0000</pubDate>
				<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Team City]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://makesharp.wordpress.com/?p=48</guid>

					<description><![CDATA[Database DevOps &#8211; SSDT and TeamCity Using Visual Studio and SSDT you can immediately publish a fresh database or update an existing one by simply right clicking the database project and choosing &#8216;Publish&#8217;. This will bring up a dialog that lets you edit the connection string to your database and set various options related to the publish. At [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>Database DevOps &#8211; SSDT and TeamCity</h3>
<p>Using Visual Studio and SSDT you can immediately publish a fresh database or update an existing one by simply right clicking the database project and choosing &#8216;Publish&#8217;. This will bring up a dialog that lets you edit the connection string to your database and set various options related to the publish.<a href="http://makesharp.files.wordpress.com/2014/08/publish.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-53" src="http://makesharp.files.wordpress.com/2014/08/publish.png?w=300&#038;resize=300%2C152" alt="Publish" width="300" height="152" /></a></p>
<p>At this point you have a choice &#8211; whether to register your published database as a Data Tier Application or not. Please do so.  There are two distinct advantages</p>
<ul>
<li>You can enable database drift detection.</li>
<li>You can query the server to see what version database is published there, when and by whom.</li>
</ul>
<p>Registering a database as a Data-Tier Application stores a copy of the current state of the database schema in system metadata tables as well as associated information relating to the publish itself.  To see quick info you can run</p>
<p style="padding-left: 30px;"><span style="font-family: Consolas;"><span style="color: #0000ff; font-family: Consolas; font-size: small;">select</span> <span style="color: #808080; font-size: small;">*</span> <span style="color: #0000ff; font-size: small;">from</span> <span style="color: #008080; font-family: Consolas; font-size: small;">sysdac_instances</span></span></p>
<p>against the msdb database on the server you published to.</p>
<p>Database drift is a very useful feature that allows you to check whether somebody has directly altered the database in some way since the last publish. I know this is a problem for many small teams &#8211; a query is a little slow so an index is added, a default was applied to a column because an app was throwing exceptions further down the pipeline and it had to be fixed quickly. This allows you to detect that, find the changes and if necessary bring them in to your project or else delete them. I always choose the option to block publish when database has drifted from registered version.</p>
<p>Now that you have selected your server, registered the database as a DTA and prevented drift, save the profile in the form .publish.xml. This isn&#8217;t just so that you can double click the profile to immediately publish (although you can of course) this is so that when TeamCity (you ARE using CI aren&#8217;t you?) builds your SSDT solution you can tell it which profile to use to automatically publish your database.  How good is that?</p>
<p>In the TeamCity build step that actually builds your solution you can select a target of &#8216;Build Publish&#8217; and then in your command line parameters add the following</p>
<p>/p:SqlPublishProfilePath=&lt;profilename&gt; /p:DeployOnBuild=true</p>
<p>Where &lt;profilename&gt; is the full name of your profile e.g. myserver.publish.xml.<a href="http://makesharp.files.wordpress.com/2014/08/build.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-54" src="http://makesharp.files.wordpress.com/2014/08/build.png?w=300&#038;resize=300%2C182" alt="Build" width="300" height="182" /></a></p>
<p>Done!  An easily updated, version controlled database that watches for people messing about with it on the server and lets you know.  What more could you ask for?</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/ssdt-using-publishing-profiles-and-teamcity-integration/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">48</post-id>	</item>
		<item>
		<title>Creating a Visual Studio SQL Project from an existing database</title>
		<link>https://www.cognim.co.uk/creating-a-sql-project-from-an-existing-database/</link>
					<comments>https://www.cognim.co.uk/creating-a-sql-project-from-an-existing-database/#comments</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Tue, 29 Jul 2014 15:24:30 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://makesharp.wordpress.com/?p=23</guid>

					<description><![CDATA[There are all sorts of reasons why this is a good idea.  Not least because you can version control, unit test and tie into your CI system any existing database. How many times have you found inconsistencies between a test and live database, not known which one is right and been unsure who to ask [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>There are all sorts of reasons why this is a good idea.  Not least because you can version control, unit test and tie into your CI system any existing database.</p>
<p>How many times have you found inconsistencies between a test and live database, not known which one is right and been unsure who to ask on your team?  In my experience, especially in smaller teams with no DBA, this happens a lot and people do bad things like edit the live database directly (&#8220;Hmmm, according to the query plan I need to add an index.  I&#8217;ll just do that now.&#8221;).</p>
<p>By creating a SQL Server project using SSDT</p>
<ul>
<li>You will know exactly who changed what and when.</li>
<li>You can fail a publish if database drift is detected (ie the database you are publishing to is different from the last time you published because someone changed something directly).</li>
<li>You can create unit tests with standardised data that run against a fresh database.</li>
<li>You can track database refactoring (ie changing a column name) so that tables are not dropped and rebuilt when published.</li>
<li>You can fail a publish if data loss will occur.</li>
<li>You can fully automate deployment to multiple servers and bring them all to a standard level regardless of their current version.</li>
</ul>
<p>So much good stuff!</p>
<h2>Here&#8217;s how you do it.</h2>
<p>First, make sure you have the <a href="http://msdn.microsoft.com/en-us/data/gg427686">latest version of SSDT</a>.</p>
<p><strong>Create the project</strong></p>
<ol>
<li>In Visual Studio, select File / New Project.</li>
<li>Under Templates. click &#8216;SQL Server&#8217; and choose &#8216;SQL Server Database Project&#8217;</li>
<li>Name your project according to the database you are importing and also name your solution, then click OK.<br />
<a href="http://makesharp.files.wordpress.com/2014/07/filenew.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-25" src="http://makesharp.files.wordpress.com/2014/07/filenew.png?w=300&#038;resize=300%2C188" alt="FileNew" width="300" height="188" /></a></li>
</ol>
<p><strong>Import your database</strong></p>
<ol>
<li>Right click the project you just created and select Import, then Database</li>
<li>Select your database from the Source Database Connection dropdown list, or use the New Connection button to add it.</li>
<li>In addition to the default Import Settings that are selected I usually also select &#8216;Import Database Settings&#8217; so that the correct database version is chosen in the project properties. Otherwise you can usually leave everything else as is.<a href="https://makesharp.files.wordpress.com/2014/07/import.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-medium wp-image-33" src="http://makesharp.files.wordpress.com/2014/07/import.png?w=300&#038;resize=300%2C257" alt="Import" width="300" height="257" /></a></li>
</ol>
<p><strong>Check your folders and files</strong></p>
<p>At this point you will have a folder structure based on the database schema &#8211; if you only use dbo then you will only see that, otherwise you will see a folder per schema and an additional security folder where sql for creating your schemas has been put. (This is also where you put sql for new schemas)<a href="https://makesharp.files.wordpress.com/2014/07/structure.png"><img data-recalc-dims="1" decoding="async" loading="lazy" class="aligncenter size-full wp-image-41" src="http://makesharp.files.wordpress.com/2014/07/structure.png?resize=289%2C252" alt="Structure" width="289" height="252" /></a> Here you can see that my database has two schemas &#8211; dbo and IntegrationTest. SSDT also separates out your functions, stored procs and tables. In the Security folder you can see the sql for creating the IntegrationTest schema.</p>
<p>If there is anything missing at this point you may want to check the import settings. You can always delete all the added files and folders and do the import again.</p>
<p><strong>Build and be happy!</strong></p>
<p>Right click your project and select Build.</p>
<ul>
<li>If there are no external references the project will build and create a dacpac. This will be saved in your bin directory in the appropriate configuration folder.</li>
<li>If there are external references required you will need to add them. <a title="Adding database references to a sql server project" href="https://www.cognim.co.uk/adding-database-references-to-a-sql-server-project/">I have blogged how to do this here</a>.</li>
</ul>
<p>You can also add static data such as lookup tables or date dimensions and again <a title="Adding tables of static data to an SSDT project" href="https://www.cognim.co.uk/adding-tables-of-static-data-to-an-ssdt-project/">I have blogged about this here</a>.</p>
<p>We are now at a stage where you can version control your database and to publish it to a particular server you just need to right click the project and select &#8216;Publish&#8217;. Note that there are several options when publishing and you can create profiles for different servers.  <a href="https://www.cognim.co.uk/ssdt-using-publishing-profiles-and-teamcity-integration/">I have blogged about how to do that here.</a></p>
<p>Good luck!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/creating-a-sql-project-from-an-existing-database/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23</post-id>	</item>
		<item>
		<title>Visual Studio SSDT and TeamCity &#8211; What you need to do.</title>
		<link>https://www.cognim.co.uk/ssdt-and-teamcity-what-you-need-to-do/</link>
					<comments>https://www.cognim.co.uk/ssdt-and-teamcity-what-you-need-to-do/#respond</comments>
		
		<dc:creator><![CDATA[Darren Hall]]></dc:creator>
		<pubDate>Mon, 28 Jul 2014 11:44:20 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Team City]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">http://makesharp.wordpress.com/2014/07/28/ssdt-and-teamcity-what-you-need-to-do/</guid>

					<description><![CDATA[I have just spent the last few days trying to get a SQL Project to build, deploy, run unit tests and create a dacpac on our build server which uses TeamCity. It wasn&#8217;t a simple process and I had to accept a few conditions that I wasn&#8217;t overly keen on but the upshot is that [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I have just spent the last few days trying to get a SQL Project to build, deploy, run unit tests and create a dacpac on our build server which uses TeamCity. It wasn&#8217;t a simple process and I had to accept a few conditions that I wasn&#8217;t overly keen on but the upshot is that it works now and it works well.</p>
<p>Here is the outline of how it all hangs together, I will do a few more detailed posts to follow up.</p>
<p>The solution itself consists of three projects. Two database projects and a unit test project.  They are checked into GIT (using <a href="https://bitbucket.org/">BitBucket</a>) and <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> watches the repository to trigger a build.  The build creates a dacpac for each database, publishes the changes to the appropriate server, runs the unit tests and saves the dacpacs into a nuget package that is <a href="http://confluence.jetbrains.com/display/TCD8/NuGet?_ga=1.7707770.999349697.1405089901">published by TeamCity itself</a>.</p>
<p>Out of the box, TeamCity can handle the build but you need MSTest and SSDT installed on the build server.  That is where your troubles begin.  You can download an MSTest agent as I wrote about <a href="https://www.cognim.co.uk/teamcity-and-msbuild-mstest/">here</a>.  You can even <a href="http://stackoverflow.com/questions/22241295/build-sql-server-data-tools-for-visual-studio-2013-project-on-build-server-wit">install the SSDT tools for VS2012</a> (though that was a bit hit and miss for me). The real problem is that with VS2013 the SSDT tools are integrated and no longer available as a separate download.  In the end I had to settle for installing VS2013 on the build server.  Microsoft allows your developer license to be used on the build server and at least I can easily update the SSDT version &#8211; I&#8217;m not particularly happy about having to do it though.</p>
<p>In order to publish your database to the correct server you just need to include appropriate <a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/05/09/publish-profile-files-in-sql-server-data-tools-ssdt.aspx">publish profile files </a>and Microsoft have provided the ability in database unit tests to switch config files according to the build server machine name. The publishing part worked fine for me but the config switching seems flaky and if you put a whitespace in the wrong place your config will be ignored.  My workaround here was to resort to <a href="https://www.nuget.org/packages/SlowCheetah/">Slow Cheetah</a> &#8211; a plugin from NuGet that allows config switching for app.config in the same way that you can achieve it with web.config. This works well but remember to restore your nuget packages as the first build step in TeamCity. It&#8217;s not so restrictive as a config that switches based on machine name (we only have a single build server so would be unable to test on multiple platforms).</p>
<p>The result is that on every check in, the dacpacs are built, deployed to a test environment, tested and if they pass, made available via a nuget feed for other projects.</p>
<p>It feels good when it all just starts working!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cognim.co.uk/ssdt-and-teamcity-what-you-need-to-do/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">20</post-id>	</item>
	</channel>
</rss>
