Having upgraded to Visual Studio 2013, I have found that an old SQL project fails to load when I attempt to open a solution. The error displayed is:
The imported project "C:\Program Files (x86)\MSBuild\12.0\bin\SqlServer.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Some\Path\To\Project\Database.sqlproj
In my .sqlproj
file I have the line
<Import Project="$(MSBuildToolsPath)\SqlServer.targets" />
which in Visual Studio 2012 resolves to C:\Windows\Microsoft.NET\Framework\v4.0.30319\SqlServer.targets
but in Visual Studio 2013 this resolves to C:\Program Files (x86)\MSBuild\12.0\bin\SqlServer.targets
. However, the SqlServer.targets
file is in neither of these locations.
Presumably this is due to MSBuild becoming part of Visual Studio, rather than it being part of the .Net Framework.
Does anyone know how to fix this issue and to migrate this project to Visual Studio 2013?
Just copied SqlServer.targets
from C:\Windows\Microsoft.NET\Framework\v3.5
to C:\Program Files (x86)\MSBuild\12.0\Bin
and it helps. VS2013 is now able to open the old project.
I had a similar problem when upgrading from Visual Studio 2008 to 2013. It took awhile but I had to install the SSDT for VS 2013 (again), then I created a new database project to find out the relative path to the new sqlserver.targets file. It should be as follows:
<Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
<Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
The biggest hindrance that I found to fixing this error was trying to understand the error message provided (BC2014: the value 'database' is invalid for option 'target')
Hope this helps!
I had the same problem and I solved this way: Just create a file named 'SQLServer.targets' on 'C:\Windows\Microsoft.NET\Framework\v4.0.30319' with the following content:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SqlClrTargetsFullPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets</SqlClrTargetsFullPath>
</PropertyGroup>
<Import Project="$(SqlClrTargetsFullPath)" Condition="Exists('$(SqlClrTargetsFullPath)')"/>
</Project>
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With