Visual Studio 2012. SQL Server Database Project.
Four build configurations were created in the solution: Debug, DevDb, TestDb, LocalDb.
Three publishing projects were created in the project: DevDb.publish.xml, TestDb.publish.xml, LocalDb.publish.xml
Pressing the F5 button (!) I want:
- Deploy the project with the connection string from the project properties if
the assembly configuration is Debug .
- publish the project with a connection string from the corresponding publication profiles if the assembly configuration is
DevDb , TestDb, or LocalDb .
To do this, I edit the project file (.sqlproj) xml, trying to catch the call to the Deploy target and replacing the standard deployment version with the target behavior:
<Target Name="Deploy">
<MSBuild Condition=" '$(Configuration)' == 'Debug' "
Targets="Deploy"
Projects="$(MSBuildProjectFile)"
Properties="Configuration=$(Configuration);"
/>
<MSBuild Condition=" '$(Configuration)' != 'Debug' "
Targets="SqlPublish"
Projects="$(MSBuildProjectFile)"
Properties="SqlPublishProfilePath=$(Configuration).publish.xml;
Configuration=$(Configuration);"
/>
</Target>
The second statement works fine, and I get the deployment in the right place.
The problem is the first statement - it causes a cyclical dependence.
error MSB4006: there is a circular dependency in the dependency dependency graph that includes the target "deployment".
My question is: how to cross (catch and replace) the standard target, and if you want to call the standard target again?
Or am I trying to invent a wheel, and is there another way to do what I want? (What I want is described above under the words "Pushing F5 button" :)