This project is read-only.

Target Not found in .DbProj file

Mar 16, 2011 at 7:48 PM


I am using MSBuildExtension pack 4.0 on VSTS 2008. I have a Database project with one .DBPROJ file. Currently, the MSBuild is generating one script that will create the database and its objects. I am working on a requirement to split the script using MSBUILD into one part that will only create the database, and the other will create the database objects. I am trying to use MS BUild extension pack to achieve this. So far, I have edited the .DBPROJ file and added Targets for Creating the database. But when I try to run MSBuild, it gives an error saying Target does not exist. Belwo is the postion of the .dbproj file that adds the Target to it.

<Project DefaultTargets="Build" xmlns="" ToolsVersion="3.5">
    <TPath>C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
  <Import Project="$(TPath)"/>
<Target Name="CreateDb">
    <Database Include="CommonDB">
<!-- Create a database -->
    <MSBuild.ExtensionPack.Sql2005.Database TaskAction="Create" DatabaseItem="CommonDB"/>

Also, what task can I use to generate scripts of the Database object ?


Mar 17, 2011 at 9:50 PM

I think your build problem is you have DefaultTargets="Build" in the first line of you , but you don't have a target named "Build". The target you have defined is named "CreateDB". Either change the DefaultTargets to be "CreateDB", change the name of your defined target to be "Build", or on the command line specify the target you want to build like "msbuild /t:CreateDB".