The problem I want to solve is to create different scripts depending on the build configuration.
Say we have two instances of SQL Server:
- Enterprise version with connected servers connected
- LocalDb version for standalone development and unit tests
The enterprise version has views for linked servers when LocalDB replaces these views with local tables.
Linked Server views and local tables have the same name and multiple fields. Therefore, they are not included in the default assembly (Build Action = None). Instead, they are included in the assembly in the BeforeBuild Target of the project file.
<Target Name="BeforeBuild">
<ItemGroup Condition=" '$(Configuration)' == 'LocalDb'">
<Build Include="Local_Tables\*.sql" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'LocalDb' ">
<Build Include="Linked_Server_Views\*.sql" />
</ItemGroup>
</Target>
, Visual Studio DB, LocalDb, Enterprise - Visual Studio :
: SQL71508:
, Visual Studio dbmdl, Enterprise .
, : dbmdl, .
SQL Server Visual Studio 2012, dbmdl, db, ..
dbmdl Visual Studio :
Deserializing the project state for project 'MyProject.sqlproj'...
Detecting file changes for project 'MyProject.sqlproj'...
Deserialization has been completed for project 'MyProject.sqlproj'.
Visual Studio dbmdl xml?
dbmdl, BeforeBuild AfterBuild xml?
?