Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load database project in VS2010 and VS2012?

I recently switched to VS2012 from VS2010, when opening a database project I get below error

C:\Trunk\Database\Database.dbproj : error  : Internal Error. The database platform service with type Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service.

I'm guessing it might be the following line in the project file which it is choking on

    <DSP>Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider</DSP>

or possibly this

  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />

Any idea how to get past this error so I can load my project in VS2012?

like image 419
aggaton Avatar asked Dec 19 '12 13:12

aggaton


3 Answers

Apparently Microsoft has a new Sql1110 DSP in VS2012. VS2010 has version Sql1100.

To fix this, inside your .dbproj file, change the following lines:

<ProjectVersion>4.0</ProjectVersion>
<ProjectGuid>{a233d7e8-b460-4b72-a345-aaeee4fb3aca}</ProjectGuid>
<DSP>Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider</DSP>
...
<!--Import the settings-->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />
<ItemGroup>

to this:

<ProjectVersion>4.1</ProjectVersion>
<ProjectGuid>{6cd7e290-f844-4410-97f6-e8fd6e63c5b5}</ProjectGuid>
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql110DatabaseSchemaProvider</DSP>
...
<!--Import the settings-->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
<ItemGroup>

I created a new blank database project file in VS2012, compare the .sqlproj file to my old .dbproj, and the lines above are the main differences. Yes, microsoft changed the proj file extension, but you dont have to change your old dbproj extension. It works on me.

like image 184
Jeson Martajaya Avatar answered Sep 19 '22 14:09

Jeson Martajaya


Since we don't have a full set of code to check on, it's hard to understand the exact problem, but for your import - you should change it to this:

 <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Schema.SqlTasks.targets" />

If this doesn't solve the problem, please also update if you have Resharper installed by any chance, and try deleting its cache.

like image 33
Blachshma Avatar answered Sep 20 '22 14:09

Blachshma


Just so other people may also encounter this same issue on VS2013, open your database project file .dbproj or .sqlproj in text editor:

Change:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />

To:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

And from

<ProjectVersion>4.0</ProjectVersion>

To:

<ProjectVersion>4.1</ProjectVersion>

And from

<DSP>Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider</DSP>

To:

<DSP>Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider</DSP>
like image 41
MagicGuru Avatar answered Sep 20 '22 14:09

MagicGuru