Removing all templates from SQL Server Management Studio - sql-server-2012

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.

Related

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

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.

SQL Server Profiler - Could not load pfclnt.dll

First of all i am a novice .NET programmer and I stuck in trying to fix an issue with a custom SQL Profiler tracer like the one described here - http://www.codeproject.com/Articles/20173/MS-SQL-Server-Profiler-with-NET
So, I use the TraceServer(http://technet.microsoft.com/en-us/library/Microsoft.SqlServer.Management.Trace.TraceServer.aspx) class to InitializeAsReader and immediately it throws me a
"Failed to initialize object as reader."
with an InnerException -
"Could not load file or assembly 'file:///c:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\pfclnt.dll' or one of its dependencies. The system cannot find the file specified.""
Interestingly this happens only when i try connecting to a SQL Profiler 2012 and I don't face a problem with 2008R2. Also I noticed that the pfclnt.dll is present in "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn" and not inside the folder that is mentioned in the trace.
Is there a way I can ask it to load it from the right location? Why is it looking at the wrong location in the first place?
Alright, I realized that my project had references to SQL Server 2008 Assemblies especially this one - C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfoExtended.dll. I removed those references and added references to the 2012 libraries present in C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies and everything works now!
This question - SQL Server file names vs versions helped me understand the weird folder names that SQL server uses to separate versions.

How to unshelve another developer's changes that include dlls or other binaries?

Using Team Foundation Server 2010 I am trying to unshelve a series of changes made by another developer on my team. This shelve set includes some Nuget packages which include dlls. I am receiving multiple errors along the lines of:
The item $/file/path/some.dll is locked for check-out by USER in workspace MACHINENAME.
In 2008 Mac Noland asserted in his blog post Unshelving files that have File Merging disabled that this error is caused by having file merging being disabled. Which makes good sense to have file merges disabled for binaries. Based on the error I am assuming that TFS 2010 is still utilizing the merge utility when unshelving (makes sense as to why). That said I do not want to enable file merging for dll files.
Unfortunately, understanding what is going on and fixing it are two different things. In TFS is there a way to unshelve binary files which were shelved by a different user?
If the user created the shelveset, but left everything checked out locally, you will receive this error. Since TFS usually allows only a single checkout for binary files, a shelveset can't be unshelved if it contains a binary file which is locked by another user.
You can attempt to unlock the file with the following command -
tf lock itemspec /lock:none /workspace:OtherUsersWorkspace
You should be able to determine the workspace from the error message, and you'll also need to specify the user - /workspace:WORKSPACE;userid
In my case my source code is located at below location in my work station
D:\TFS\Source\Development\Cars.
I opened Visual Studio Command Prompt under Visual Studio Tools and ran it as Administrator.
I changed my command prompt to move to
D:\TFS\Source\Development\Cars
Executed below line
D:\TFS\Source\Development\Cars> tf lock HE/* /lock:none /workspace:zigglerworkspace /login:ziggler /collection:ziggler1pxtfs01\WebProjects
zigglerworkspace - my workspace name
ziggler - my user name
ziggler1pxtfs01\WebProjects - TFS server url
This released locks on all files and folders under HE folder which is located at
D:\TFS\Source\Development\Cars\HE
Install Microsoft Team Foundation Server 2010 Power Tools
Add C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools to your system path
cd c:[some location]\"destination workspace"
tfpt unshelve /migrate "shelveset name";otherUserName /source:"$/ProjectName/Main/Source" /target:"$/ProjectName/Main/Target"

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.