SQL Server : DacPac drops everything when another SSDT project is referenced - sql

we have the following SSDT project structure:
DBCore project: includes all objects that are not sql server edition exclusive.
DBStandardEdition project: includes all standard edition specific objects.
The DBStandardedition project references the DBCore project with the "same database" option.
When I publish the DBStandardEdition project to my demo server via visual studio directly, everything works. All the standard edition related objects are created correctly.
When I compare the database on the demo server to my dacpac file with the schema comparison tool in visual studio, the tool wants to drop all objects I have defined within DBStandardEdition project. We also have a program that publishes the dacpac files with the DacServices - Class (DacServices.Deploy). This program actually drops everything defined in my DBStandardEdition.dacpac file.
Am I doing something wrong here or is it a bug?
Update
I figured out a problem in my project settings. I have set the "Build output file name" for all databaseprojects to the same value. After I changed this, Visual Studio generates two DacPac - Files in my DBStandardEdition\Bin\Release Folder. DBCore.dacpac And DBStandardEdition.dacpac. When I now use the compare tool of visual studio to compare the DBStandardEdition.dacpac to my Database (and enable the "Include composite objects (database target only)" - option), all looks good. Newly added objects to DBCore project are listed with "Add", all my objects in my DBStandardEdition projects are still there. When I activate the Deployoption "Include composite objects..." everything deploy fine.

You need to enable the "Include composite objects (database target only)" option in the Schema Compare Options. This is off by default and means that the referenced objects are being excluded from the comparison.

Related

Removing all templates from SQL Server Management Studio

So in SSMS, the template browser has all of these preloaded templates that i personally will never use. I'd rather just clear this out so i can start my own structure, however, everytime i delete them from:
C:\Users[user]\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\Templates
and reboot SSMS, they all magically reappear. The templates that are in there are more or less worthless to me, but i would like to get out of saving query projects or quick templates to a folder and just put them in here for organization and ease. There's no settings that i can find that causes the behavior so i was wondering if anyone had an idea how to disable this feature.
Any help would be appreciated!
If you want to remove the default templates completely, we need to delete the files and folders under both of the following folders:
64-bit SQL Server:
%ProgramFiles(x86)%\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql
C:\Users\<user>\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\Templates\Sql\
32-bit SQL Server:
%ProgramFiles%\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql
C:\Users\<user>\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\Templates\Sql\
In SSMS 2008 R2 the folders are:
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql
C:\Users\<user>\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\Templates\Sql
Instead of deleting the existing templates, I created a "z MS Shipped" folder and moved them into there, just in case.

CreateDeploymentUtility option into SSIS 2012 packages

I use SSIS 2012 and want to set the value True to CreateDeploymentUtility option. The package contain an Execute SQL Task that insert a value into a sql table.
I search for this Option in : Solution Explorer -> Properties -> Deployment Utilities but i don't found it. There I have only 'Server Name' and 'Server Project Path' options.
How can I set True for CreateDeploymentUtility option?
Please help me!!
Thanks!!!
There are two different deployment models available to you with the 2012 release of SSIS. The new model, called project deployment model, treats all of your SSIS packages as class files that get "compiled" into a .ispac file, much as .net files get turned into an assembly. This .ispac file then gets deployed into the database into a dedicated catalog, SSISDB. Very cool stuff and by default when you create a project in SSIS 2012, this is the model it will use.
The second deployment model, the classic one familiar to SSIS developers from 2005 on is called the package deployment model. Right click on the SSIS project and you will have an option for converting from project deployment to package deployment.
Note that there are incompatible features between the two. Project level Connection Managers are only available in the Project Deployment Model and the last time I tried to convert a project from package to project deployment model, it switched the configuration to package and project parameters.

How to avoid having (or delete) PDB files in TFS 2012 build result

When using DefaultTemplate from Visual Sturdio 2012 (and TFS 2012 server), the PDB files are included in build directory. I do not want them.
Is there a way not to generate those files during build process?
Or
How can I delete those files?
I found this thread about deletion but seems a bit strange (no delete activity?)
There also is this answer but does not involve XAML template.
Thanks in advance for your help.
PDB files hold debug information on your code and its not advised to disable them, they are valid output hence deployment shouldn't be messing with them.
You can disable their generation in Visual Studio project Properties> Build > Advanced > Debug Info = none.
If you absolutely want them gone then disable them for build specific configuration (relaese etc.)
The build server by default does whatever the Solution (sln) tells it to. That by default is to do a "Debug" build and that created the PDB's. You can tell the Build to do a "Release" build that will not by default create any PDB's...
Figure: Adding a Build Configuration
I would however recommend against it as the PDB's contain information that you need even in production systems. Consider for a moment that you have a DLL in production and the customer is encountering a problem. You get them to create an InteliTrace log so that you can debug it locally (or they let you debug on their environment) and suddenly you are trying to debug without Visual Studio understanding the relationship between the Executable and the Source Code. So no debug...
Since I was unable to find building option to disable PDB file generation, I delete them afterwards.
There is no easy way to delete files. I did:
use a FindMatchingFiles Activity with wildcard *.pdb, which returns
a full path to pdb files
use a Foreach loop
call a DotNet method in the loop for each file with the InvokeMethod Activity,
with target type System.IO.File and method being "Delete"
In the previous version (Visual Studio 2010)
When we build /release, it was not generating PDBs, the PDB files are created when we only build with /debug:full or /debug:pdbonly, we use /debug:pdbonly if we want to generate PDBs for a release build that we do not want to be debuggable.
This is not the case in Visual Studio 2012, I checked it and I found it generated PDBs in both, /debug and /release
There is no documentation for Visuals Studio 2012.

Making SSDT just generate a SQL script (and not deploy a database)

Having recently upgraded to SSDT 2012 I seem to be missing the option to just generate a T-SQL script instead of deploying the database to a server somewhere.
To be more accurate the predecessor to SSDT used to set the Deploy action to 'Generate script', but I cannot locate that option anywhere in the new version.
Is it possible?
To generate a script from an offline data project in SSDT rather than deploy to a target database, configure the project settings as shown below
You may want to look at the SQLPackage command line. You can set the options there to use an action of "script" and specify an outputfile name to generate scripts instead of publishing the database. You can also do that through a batch file so it will generate a script every time. You still need to provide a source project and target database, though. The reference for SQLPackage can be found here: http://msdn.microsoft.com/en-us/library/hh550080%28v=VS.103%29.aspx
Yes, it is possible.
Is you select Build > Publish ProjectName... from the menu bar, a dialog window pops-up with publishing options – there's a Generate Script button at the bottom of the dialog window.
I also had a problem where the SSDT project would attempt to deploy changes when the project was run.
In the project properties, choose the "Debug" tab. Change the Start Action to "None". That will prevent it from trying to deploy at that time.

TFS 2010 Build Publish via file system

I've got a fairly large MVC2 project in TFS which gets built automatically on checkin (Continuous Integration)
At present, the fully built version is dumped on a network share on our dev IIS server. \\Server\wwwrootLatest
TFS of course creates lots of sub-folders since it's just doing a build, it isn't even aware that it's drop directory is a wwwroot.
This means that to actually USE the build, we need to go and manually create an IIS App which points at the appropriate directory - which defeats the whole object of the exercise.
When we do a manual publish to that server, we use "File System" as the method and just overwrite the files in the UNC share \\Server\wwwroot
(When publishing to other environments, we use full-on MSDeploy.)
What I'd like to do is convince TFS to do a "File system" publish after the build completes and duplicate what we do on a manual publish eg:
Drop directory is \\Server\Build which would result in something like \\Server\Build\Project\Date.Rev\
After that is complete, we want it to publish to \\Server\wwwrootLatest - we can then set up the App once which will always contain the latest version but will still have a full history if required.
The only examples I've been able to find use MSBuild commands in the build definition (fine) but all use MSDeploy to do a full-on publish. I'm not sure how to automate what I want to do
Any help appreciated.
In your drop folder a folder named _PublishedWebsites is generated automatically. It contains files you need to put in wwwroot. You can use CopyDirectory build activity to copy them automatically.