"how to properly manage database deployment with ssdt and visual studio 2012 database projects?" Code Answer
Answers related to “how to properly manage database deployment with ssdt and visual studio 2012 database projects?”
- How to connect multiple database,servers in mysql and query from both tables of each other?
- Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing...
- Visual Studio 2012 __cplusplus and C++ 11
- Visual Studio 2012 - Intellisense sometimes disappearing / broken
- Using SSIS BIDS with Visual Studio 2012 / 2013
- Visual Studio 2012 Web Publish doesn't copy files
- How can I rename a project folder from within Visual Studio?
- Can I record/play macros in Visual Studio 2012/2013/2015/2017/2019?
- How to connect to a MySQL Data Source in Visual Studio
- Building Qt5 with Visual Studio 2012 / Visual Studio 2013, and integrating with the IDE
- Can Visual Studio 2012 be installed side-by-side w/ Visual Studio 2010?
- How to build boost Version 1.58.0 using Visual Studio 2015 (Enterprise)
- How to start a single project without debugging in Visual Studio?
- using statement FileStream and / or StreamReader - Visual Studio 2012 Warnings
- Use Visual Studio 2012 and compile with older platform toolset?
- How to turn off caching of build definitions in Visual studio
- C++11 std::mutex in Visual Studio 2012 deadlock when locked from DllMain()
- How do I open an old MVC project in Visual Studio 2012 or Visual Studio 2013?
- Best practices for Subversion and Visual Studio projects
- How to get relative path of a file in visual studio?
- How to Set Path Environment Variable using CMake and Visual Studio to Run Test
- Can ARM desktop programs be built using visual studio 2012?
- Visual Studio 2012 Web API project won't run - can't find Newtonsoft.Json
- How do I default Visual Studio to C# projects instead of VB.NET?
- Disable noise messages in debug output windows - visual studio 2012
- C# 6.0 Support in Visual Studio 2012
- Is it possible to use the VC++ 6 compiler in Visual Studio 2012?
- How to implement Tesseract to run with project in Visual Studio 2010
- Visual Studio 2012 doesn't convert vs2010 solution?
- How to generate assembly code from C++ source in Visual Studio 2010
- How to Connect Visual Studio 2012 with git (github)?
- How to hide files generated by custom tool in Visual Studio
- How to specify a user id and password for Visual Studio Code with an authenticating proxy?
- How to run application as administrator in debug with Visual Studio?
- Visual Studio (2012 and lower) deletes CSS properties
- Will Web Deployment Projects still be available in Visual Studio 2012?
- How can I switch themes in Visual Studio 2012?
- Using Visual Studio 2012's built-in merge tool with Git
- Mercurial .hgignore for Visual Studio 2012 projects
- Plain C# Editor in Visual Studio 2012 (No intellisense, no indentation, no code highlighting)
- How to use multilanguage database schema with ORM?
- How to ignore white space when comparing source in Visual Studio / TFS?
- Visual Studio 2012 error: Package 'Visual C++ package' failed to load
- Visual studio 2012 slow unit testing
- Unit Testing issue in Visual Studio 2012
- Missing ADO.NET entity data model template from visual studio 2012 professional
- Update target button is disabled after schema comparison
- Error starting Visual Studio 2012
- Installing PlatformToolset v110 without installing Visual Studio 2012
- Accessing Projects via DTE in C# T4 Template
- How to keep change history while renaming files in Visual Studio using Perforce
- Adding references to other projects in Visual Studio 2012
- why the release version memset is slower than debug version in visual studio 2012?
- How to remove code structure view or “breadcrumbs” in Visual Studio Code?
- How to use BindingSource.Filter for a Date in visual basic 2012?
- How do you reference a capture group with regex find and replace in Visual Studio 2012, 2013, 2015, and VS Code
- Entity Framework 5 and Visual Studio 2012 POCO Classes in Different Project
- ReSharper color identifiers screw up with Visual Studio 2012 dark theme
- Web Deploy from Visual Studio 2012 to a remote IIS 8 server
- How to write a custom native visualizer DLL for Visual Studio 2012 debugger?
- Visual Studio 2012 Install Fails: Program Compatibility Mode is on
- Is Visual Studio 2012 csproj backward compatible with 2010?
- Running mstest from command line against Visual Studio 2012 native C++ tests
- Multi Project / Solution Templates for Visual Studio 2012 with VSIX Installer and Nuget Packages
- Visual Studio 2012 64 bit?
- Visual Studio 2012 RTM has MSBuild.exe in memory after close
- How to redirect standard output to output window from Visual Studio
- Visual Studio 2012 install broke my 2010 WCF project
- How to unit test a Windows 10 app in Visual Studio?
- Can I use Visual Studio 2012 Express Edition for commercial use? [closed]
- OpenNI 2 and Visual Studio 2012
- Visual Studio 2012 change web browser
- Move obj folder in Visual Studio 2012
- VS2012: Property Pages isn't opening: Object reference not set to an instance of an object
- Where can I see the what() message from an unhandled std::exception in Visual Studio 2012?
- How to add SQL Server database file (.mdf) in Visual Studio without installing SQL Server Express Edition?
- Unable to start debugging - Visual Studio 2012
- How to port C++ code to C++/CLI in Visual Studio?
- MSBuild targets and Visual Studio 2012 issues
- Visual Studio 2012 Not Recognizing Xaml Files, Design View Broken
- ASP.NET Web API error after upgrading to Visual Studio 2012 RC: Method not found: 'Void...
- Compiling a GTK3 program in Visual Studio 2012
- Visual Studio 2012 csc.exe Error. Executable not valid for OS
- Visual Studio 2012 compatibility
- How to properly manage and access webdriver instances to avoid problems with parallel execution of tests?
- How to indent/format a selection of code in Visual Studio Code with Ctrl + Shift + F
- How to choose between UUIDs, autoincrement/sequence keys and sequence tables for database primary keys?
- How to configure or setup Log4Net with ASP.NET ( included MVC) C# on Visual Studio 2012 ~ ~
- How do you store static data in your SQL Server Database Project in VS 2012
- Debugging asp.net with firefox and visual studio.net - very slow compared to IE
- What about Sql Server Data Tools for VS2012 being incompatible with Sql Server 2012?
- Compile C app with Visual Studio 2012
- Curly braces autocomplete in Visual Studio 2012
- Multi-targeting .NET Framework 4 and Visual Studio 2012
- EnvDTE substitute in Visual Studio 2012
- GUI development with IronPython and Visual Studio 2010
- Visual Studio 2012 The project file “” has been renamed or is no longer in the solution
- Build error in tfsbuild with database project
- How to automatically publish a website on build in Visual Studio 2008?
- How to debug an Asp.Net Mvc Application in Visual Studio 2012 from a remote computer
- How to disable warnings in Visual Studio for a Visual Basic Web Deployment Project
- Getting site under construction message after azure webapp deployment
- Visual Studio 2012: Unable to attach the process. A debugger is already attached
- No padlock icon for some projects in a source controlled solution
- SQL Database Project: build different scripts depending on build configuration
- Visual Studio 2010 - Database Project with imported database fails to build
- Is there a way to suppress Intellisense errors when using C++11 features specific to November 2012 CTP?
- Visual Studio 2012 compared to Visual Studio 2010 (delta) [closed]
- Problems with references to TPL Dataflow and TPL in VS 2012 RC
- C++: How to add raw binary data into source with Visual Studio?
- Is there any way to mass organise usings in Visual Studio 2012?
- Give FullTrust to UNC share for Visual Studio 2012 and .Net 4.0
- Visual Studio 2012 asp net mvc 3 project razor view
- How to compile a cpp to a dll in visual studio 2010 express
- Has the Batch Build option been removed in Visual Studio 2012 Express?
- Does ReSharper 6.1 work with Visual Studio 2012?
- Visual Studio 2012 says website project's project file is edited outside of environment
- How to set the class path in Eclipse and Android Studio
- Visual Studio 2012: Compiler setup (possible to use Compiler from SDK eg. VC++2008-Compiler VC++ 2010-Compiler)
- Report error/warning if missing files in project/solution in Visual Studio 2012 / 2013
- SSDT in Visual Studio 2015 Oracle Connection Issue
- How to populate a database column with random numbers
- How to set syntax highlighting for Dart variable in Visual Studio Code
- Visual Studio 2012 Database Designer - Has the functionality changed?
- How Do You Solve the Invalid Pointer Issue in Visual Studio 2013
- Embedded database for windows 8 app [closed]
- TFS 2012 + Visual studio 2012: some settings options return “The user name or password is incorrect”
- “Object reference not set to an instance of an object” when creating a new Web API controller with EF Scaffolding...
- Getting Sql Server Data Tools to work with Visual Studio 2012 Express Release Candidate
- Trying to add reference to project in Visual Studio 2012, “no items found”
- Deploy Qt app on win7 32-bit - works (and compiles) on Win7 x64
- How to change background color of active line in Visual Studio Find Results Window?
- Visual C++ Runtime Distributable 2010 in Visual Studio 2012
- Where has Design View gone in Visual Studio 2012?
- How to create an app for Windows XP using Visual Studio Express 2012 for Windows 8
- How to enable Visual Style of the Form in Visual Studio Designer?
- How to enable breakpoints of current file only in Visual Studio?
- Is it possible to change icons in Visual Studio 2012?
- Path to SignTool.exe or “Windows Kits” directory when using Visual Studio 2012
- How to Move a Line Up or Down in Visual Studio Code for Mac
- Debug .NET Framework Source Code in Visual Studio 2012?
- How to compile C++ for Windows with clang in Visual Studio 2015
- Insert a new GUID to Visual Studio 2012
- InstallShield LE (with Visual Studio 2012) completely fails to detect dependencies
- Default to the T-SQL Pane view within Visual Studio 2012 Database Project
- Visual Studio 2012 ExtJS IntelliSense
- Visual Studio 2012 recent projects not updated in taskbar
- Hotkey to open TFS Source Control Explorer in Visual Studio 2012?
- How to change SVN authentication details in AnkhSVN in Visual Studio 2010?
- TypeScript in Visual Studio 2012 not compiling
- How do you manage database revisions on a medium sized project with branches? [closed]
- MSBuild error “CSC : error CS2001: Source File 'x' could not be found” with Linked Files after upgrading to Visual...
- How to get out of subversion source control in visual studio?
- Which local database is suitable for Windows 8 Store Apps?
- How to use functions from different C++ projects in Visual Studio 2010?
- .NET 4.5.1 Preview Support in Visual Studio 2012
- C++ program not compiling with Clang and visual Studio 2010 Express
- Best way to manage multiple Service References in .NET
- How to debug code compiled with Roslyn in a Visual Studio extension inside current Visual Studio host?
- Visual Studio 2012 crashes every time I try to debug with error CLR20r3
- Visual Studio 2012 Database Diagram?
- All files are marked as read only after check in to TFS from Visual Studio 2012
- Visual Studio 2012 Conditional Bundling
- Invoke a publish from msbuild for visual studio 2012
- “The breakpoint will not currently be hit” - and I cannot add the .pdb file
- Profiling with CMake, C++, and Visual Studio 2012
- Is there a way in Visual Studio 2012 to use F# REPL when debugging c#
- How to create a web service load test using Visual Studio 2010?
- How to populate production database (heroku) with development data? (Rails)
- Saving images to database with asp.net mvc 4 + Entity Framework
- PowerCommands for Visual Studio 2012?
- Microsoft.VisualStudio.Web.PasteJson.JsonPackage did not load properly
- How to generate odata v4 c# proxy client for Visual Studio 2017?
- Regular Expression to match folder name with Productivity Power Tools Color Coding
- Has Microsoft removed Visual Studio 2012 Express links for good? [closed]
- How can I get only projects from the solution?
- Using C#, how do I create a new Visual Studio 2012 Solution programmatically?
- Visual Studio 2012 adding a database and creating first table named users
- How can I change Visual Studio 2012 Express item templates?
- How can I generate a Visual Studio 2012 project targeting Windows XP with CMake?
- Visual Studio 2012 - How do I bind my solution to another Team Foundation server?
- Blend for Visual Studio 2012 - No design view
- What installer options are there for Visual Studio 2012 Express for Desktop
- Visual Studio 2012 RC breaks on exceptions from within the .NET Framework. How do I make it break on exceptions...
- Visual Studio 2012 XAML designer doesn't seem to update
- Visual Studio 2012 keeps showing upgrade report
- Visual Studio 2012-s custom project template not visible
- VS 2012 - EF 5.0 - Update Model from Database - Not picking up table changes
- How to use .Net Native in WinForm and C# (Visual Studio 2015)?
- Whats the proper way to link Boost with CMake and Visual Studio in Windows?
- How to view the Assembly code for C# in Visual Studio (not the MSIL)?
- No XAML binding debugging with breakpoints in Visual Studio 2012 (RTM, on Windows 8 RTM)?
- Removing ConnectionString when deploying with Visual Studio 2012
- Web Deploy to Server with MSBuild
- how to configure entity framework 6 for sqlite in visual studio 2013
- How to add pthread library to C++ project in Visual Studio Community Edition?
- Exception: Error HRESULT E_FAIL with Microsoft LightSwitch Visual Studio 2012 RC
- TFS Change server port and visual studio 2012, problems
- How to Convert the Current Time to milliseconds in Visual Studio?
- Visual Studio 2012 - Database Project - setting a default profile for publish
- User Check-In History in Visual Studio 2012 / 2013
- #include <mapix.h> missing Visual Studio 2012
- How do you prevent Visual Studio 2012 from automatically closing preview files?
- How do I exclude service references from code coverage using the runsettings file in Visual Studio 2012?
- How do I prevent Visual Studio 2012 from expanding an MSBuild 4 wildcard?
- How to invoke the “Organize imports” TypeScript feature in Visual Studio?
- Visual Studio 2012 debug tests keyboard shortcut
- MVC4 scaffolding of database-first Entity Framework model in Visual Studio 2012
- Build Boost 1.52 Libraries using Visual Studio 2012 to target Windows XP
- How to set PlatformToolset from custom property sheet in Visual Studio 2010
- How can i build project in visual studio 2012 on both way(dll and lib) together
- Turn off visiting behaviour when navigating to file in Visual Studio 2012
- Using _bin_deployableAssemblies with Visual Studio 2012
- How to create a unique index with conditional and subquery in PostgreSQL?
- Visual Studio 2012 and Intellisense
- How to include Resource files in dotnet build with Visual Studio Code
- Programmatically specify Private Extension Gallery in Visual Studio 2012
- Visual Studio 2012 Express Hangs with Message "Waiting for Background Operation to Complete" on Format Document...
- Add keyboard shortcut to open Builds view in Visual Studio 2012
- Difference between treatment of ambiguous generic interfaces by F# between VS 2012 and VS 2015 leading to compile...
- Visual Studio SSDT Database project (.sqlproj) build - generate .dacpac using CLI without MSBUILD (msbuild.exe)
- Visual Studio 2012 cannot connect to Team Foundation service unless the Fiddler is opened?
- Visual Studio 2012 Installer Project in VS 2015 "The application is not installed" after installing Visual Studio...
- Visual Studio 2012 and missing files
- Hover Tooltip stopped working in Visual Studio 2012 Express for Web?
- How can I connect to a SQL Server Compact 3.5 file as a data source in Visual Studio 2012?
- How to create global file for all projects in visual studio?
- How to use The highest Warning Level (Wall) for Visual Studio 2017 when it's incompatible for the std headers?
- Can one assign keyboard shortcuts to Visual Studio 2012 extensibility package commands that use DynamicItemStart?
- What is the state of Visual Studio 2012 RC integration with SourceSafe?
- Visual Studio 2012 - where has ASPX design and split view gone?
- Several projects in one solution with cmake and visual studio
- Windows Kit 8.0 and Visual Studio 2012 - are they shipped together? [closed]
- How to add Edge as my debug browser in Visual Studio 2012 on Windows 10?
- Adding Windows Phone 8 SDK to Visual Studio 2012
- How to get C (not C++) syntax highlighting in Visual Studio (2010)?
- How to programmatically run unit tests with Gallio and MBUnit?
- Custom policies in Visual Studio 2012 and TFS 2010
- Missing Diagram folder in Database Explorer at Visual Studio 2012
- In Visual Studio 2012, I get warnings and squiggly lines when trying to write JSX with React JS
- Is it possible to assign a shortcut to "Step Into Specific" in Visual Studio 2012 C++?
- VS 2013 Database Project: Post-Deployment scripts to run based off of build configuration
- NLog nlogger snippet not working Visual Studio 2012
- How to add custom icons to solution explorer in Visual Studio
- How to suppress initial post-build event error in Visual Studio 2017 (C#)?
- Visual Studio 2012 fails to load some projects and then hangs (is busy)
- Compile C in Visual Studio 2012 without MSVCRT runtime
- Install WinCE 5.0 Platform Builder SDK - build code with Visual Studio 2012 or higher
- How to pass access token for Azure KeyVault during Visual Studio Code debug
- Setting C++ debug environment in Visual Studio 2012 Express
Only authorized users can answer the Search term. Please sign in first, or register a free account.
i've been working on this myself, and i can tell you it's not easy.
first, to address the reply by jt - you cannot dismiss "versions", even with declarative updating mechanics that ssdt has. ssdt does a "pretty decent" job (provided you know all the switches and gotchas) of moving any source schema to any target schema, and it's true that this doesn't require verioning per se, but it has no idea how to manage "data motion" (at least not that i can see!). so, just like dbproj, you left to your own devices in pre/post scripts. because the data motion scripts depend on a known start and end schema state, you cannot avoid versioning the db. the "data motion" scripts, therefore, must be applied to a versioned snapshot of the schema, which means you cannot arbitrarily update a db from v1 to v8 and expect the data motion scripts v2 to v8 to work (presumably, you wouldn't need a v1 data motion script).
sadly, i can't see any mechanism in ssdt publishing that allows me to handle this scenario in an integrated way. that means you'll have to add your own scafolding.
the first trick is to track versions within the database (and ssdt project). i started using a trick in dbproj, and brought it over to ssdt, and after doing some research, it turns out that others are using this too. you can apply a db extended property to the database itself (call it "buildversion" or "appversion" or something like that), and apply the version value to it. you can then capture this extended property in the ssdt project itself, and ssdt will add it as a script (you can then check the publish option that includes extended properties). i then use sqlcmd variables to identify the source and target versions being applied in the current pass. once you identify the delta of versions between the source (project snapshot) and target (target db about to be updated), you can find all the snapshots that need to be applied. sadly, this is tricky to do from inside the ssdt deployment, and you'll probably have to move it to the build or deployment pipeline (we use tfs automated deployments and have custom actions to do this).
the next hurdle is to keep snapshots of the schema with their associated data motion scripts. in this case, it helps to make the scripts as idempotent as possible (meaning, you can rerun the scripts without any ill side-effects). it helps to split scripts that can safely be rerun from scripts that must be executed one time only. we're doing the same thing with static reference data (dictionary or lookup tables) - in other words, we have a library of merge scripts (one per table) that keep the reference data in sync, and these scripts are included in the post-deployment scripts (via the sqlcmd :r command). the important thing to note here is that you must execute them in the correct order in case any of these reference tables have fk references to each other. we include them in the main post-deploy script in order, and it helps that we created a tool that generates these scripts for us - it also resolves dependency order. we run this generation tool at the close of a "version" to capture the current state of the static reference data. all your other data motion scripts are basically going to be special-case and most likely will be single-use only. in that case, you can do one of two things: you can use an if statement against the db build/app version, or you can wipe out the 1 time scripts after creating each snapshot package.
it helps to remember that ssdt will disable fk check constraints and only re-enable them after the post-deployment scripts run. this gives you a chance to populate new non-null fields, for example (by the way, you have to enable the option to generate temporary "smart" defaults for non-null columns to make this work). however, fk check constraints are only disabled for tables that ssdt is recreating because of a schema change. for other cases, you are responsible for ensuring that data motion scripts run in the proper order to avoid check constraints complaints (or you manually have disable/re-enable them in your scripts).
dacpac can help you because dacpac is essentially a snapshot. it will contain several xml files describing the schema (similar to the build output of the project), but frozen in time at the moment you create it. you can then use sqlpackage.exe or the deploy provider to publish that package snapshot. i haven't quite figured out how to use the dacpac versioning, because it's more tied to "registered" data apps, so we're stuck with our own versioning scheme, but we do put our own version info into the dacpac filename.
i wish i had a more conclusive and exhasutive example to provide, but we're still working out the issues here too.
one thing that really sucks about ssdt is that unlike dbproj, it's currently not extensible. although it does a much better job than dbproj at a lot of different things, you can't override its default behavior unless you can find some method inside of pre/post scripts of getting around a problem. one of the issues we're trying to resolve right now is that the default method of recreating a table for updates (ccdr) really stinks when you have tens of millions of records.
-update: i haven't seen this post in some time, but apparently it's been active lately, so i thought i'd add a couple of important notes: if you are using vs2012, the june 2013 release of ssdt now has a data comparison tool built-in, and also provides extensibility points - that is to say, you can now include build contributors and deployment plan modifiers for the project.