<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Anthony Brown : visual studio</title><link>http://sqlblogcasts.com/blogs/antxxxx/archive/tags/visual+studio/default.aspx</link><description>Tags: visual studio</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>SQLBits presentation - database projects in visual studio 2010</title><link>http://sqlblogcasts.com/blogs/antxxxx/archive/2010/10/04/sqlbits-presentation-database-projects-in-visual-studio-2010.aspx</link><pubDate>Mon, 04 Oct 2010 13:02:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:14878</guid><dc:creator>antxxxx</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/antxxxx/rsscomments.aspx?PostID=14878</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/antxxxx/archive/2010/10/04/sqlbits-presentation-database-projects-in-visual-studio-2010.aspx#comments</comments><description>&lt;p&gt;This weekend saw sqlbits 7 in York. This was a great conference and i learned a lot and met some really great people. A huge thanks to all the organisers and sponsors of the event&lt;/p&gt;

&lt;p&gt;You can find the slides from my presentation on database projects &lt;a href="http://sqlblogcasts.com/blogs/antxxxx/Database_projects.zip"&gt;here.&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=14878" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/database+projects/default.aspx">database projects</category><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/visual+studio/default.aspx">visual studio</category><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/sqlbits/default.aspx">sqlbits</category></item><item><title>formatting xml files in visual studio</title><link>http://sqlblogcasts.com/blogs/antxxxx/archive/2010/02/23/formatting-xml-files-in-visual-studio.aspx</link><pubDate>Tue, 23 Feb 2010 10:02:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:13126</guid><dc:creator>antxxxx</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/antxxxx/rsscomments.aspx?PostID=13126</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/antxxxx/archive/2010/02/23/formatting-xml-files-in-visual-studio.aspx#comments</comments><description>&lt;p&gt;This is not strictly a sql post, but it is to do with xml which is used in sql server.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;xml files do not need to have any formatting in them. That means that when viewing an xml file produced by an application, all the data can be one line. Although this is valid xml and can be processed by sql server or ssis, sometimes it is useful to view the data in a human readable format.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use an xml editor for this, or you can open the file in visual studio and use the shortcut ctrl+k, ctrl+d which formats it all nicely with indents to make it easier to read.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13126" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/visual+studio/default.aspx">visual studio</category><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/xml/default.aspx">xml</category></item><item><title>Upgrading database projects to GDR release</title><link>http://sqlblogcasts.com/blogs/antxxxx/archive/2009/07/15/upgrading-database-projects-to-gdr-release.aspx</link><pubDate>Wed, 15 Jul 2009 09:42:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11987</guid><dc:creator>antxxxx</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/antxxxx/rsscomments.aspx?PostID=11987</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/antxxxx/archive/2009/07/15/upgrading-database-projects-to-gdr-release.aspx#comments</comments><description>&lt;p&gt;
Database projects are available in visual studio database edition (which is covered under the same licence as visual studio developer edition). They allow you to store all the objects that make up a database in a project and easily deploy them to a server. The objects are stored as sql scripts that create the object. When you deploy it compares the object definitions to the target database and creates a difference sql script that makes the target server the same as the project.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
With th GDR release for visual studio 2008 version, there are many improvements, including support for sql 2008, and the seperation of build and deploy steps. Gert Drapers has an excellent article at &lt;a href="http://blogs.msdn.com/gertd/archive/2009/06/05/declarative-database-development.aspx"&gt; http://blogs.msdn.com/gertd/archive/2009/06/05/declarative-database-development.aspx &lt;/a&gt; explaining how database projects work in the GDR release
&lt;/p&gt;&lt;p&gt;
If you have an existing database project and you install the GDR release, you need to upgrade your projects to the new version.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
There are 3 methods I will discuss here on how to do this.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
The first method is to first deploy your old database project to a blank database, and then import it into the GDR version. This is probably the cleanest method. However, it does mean that the location of your scripts (ie object definitions) will change, which if you have your project under source control may cause problems. It is also very time consuming, so it may not be an option if you have many projects.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
The second method is to just open the database projects in the GDR version and go through the upgrade wizard. This just changes the dbproj file, and adds some extra files, but leaves all the scripts in the same location. If you have your project under source control, this is a better method for that reason. However, it is time consuming and if you have many projects, it can take a long time.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
There is a bug in the upgrade wizard. The database.sqlpermissions file gets added to the dbproj file like this
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
&amp;lt;PropertiesFile Include=&amp;quot;Properties\Database.sqlpermissions&amp;quot; /&amp;gt;
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
when it should get added as 
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
&amp;lt;Build Include=&amp;quot;Properties\Database.sqlpermissions&amp;quot;&amp;gt;
&lt;/p&gt;&lt;p&gt;
     &amp;lt;ModelBuilderType&amp;gt;Permissions&amp;lt;/ModelBuilderType&amp;gt;
&lt;/p&gt;&lt;p&gt;
   &amp;lt;/Build&amp;gt;
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
So you will manually need to edit the dbproj file after the upgrade.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
It also does not move the contents of the permissions.sql file into the database.sqlpermissions file, so this is something you need to do manually.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
The third method is to automate the 2nd method using powershell. I have recently used this to upgrade hundreds of projects in a few hours. The main script is called upgrade-projects.ps1
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
The script finds all dbproj file, and then callls 
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe $dbprojname /upgrade
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
on them which does the upgrade without the need for intervention.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
It also fixes the database.sqlpermissions file in the dbproj file automatically,  and changes the model collation to be uk case-insensitive (as all my database projects have this collation)
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
It also calls another script - upgrade_permissions.ps1 which tries to upgrade the permissions.sql file into database.sqlpermissions format. This script works for basic grant statements on tables and stored procedures (eg grant select, grant delete, grant execute etc) and for most grants on xml schema collections. There may be problems with it if you try to do it with other objects.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
It uses the get-tfs cmdlet to try and check out and add files to tfs. This is available from here - &lt;a href="http://blogs.msdn.com/jmanning/archive/2006/09/28/776141.aspx"&gt; http://blogs.msdn.com/jmanning/archive/2006/09/28/776141.aspx&lt;/a&gt;. If you use another source control provider you will need to change these parts.
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
Finally the script calls another script called build-all.ps1 which tries to build all the projects to check for any errors. 
&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
All 3 scripts are in the file &lt;a href="http://sqlblogcasts.com/blogs/antxxxx/upgrade_database_projects.zip"&gt;here&lt;/a&gt;. I hope this helps anybody that is upgrading database projects
&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11987" width="1" height="1"&gt;</description><enclosure url="http://sqlblogcasts.com/blogs/antxxxx/attachment/11987.ashx" length="4225" type="application/x-zip-compressed" /><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/GDR/default.aspx">GDR</category><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/database+projects/default.aspx">database projects</category><category domain="http://sqlblogcasts.com/blogs/antxxxx/archive/tags/visual+studio/default.aspx">visual studio</category></item></channel></rss>