Cannot open .sql files in Visual Studio: Object reference not set - visual-studio-2010

In Visual Studio 2010, I have a database project (dbproj) which loads without any problems. But when I double click one of the .sql files it contains I get the popup "Object Reference Not Set to an instance of an object". I tried reinstalling SQL Data Tools for VS2010. I do not have the option to convert to the newer sqlproj files.
What could be the problem?

Related

VS2013 create new class from template

Hi is this possible to create some template for Visual studio, that when I create new class it will contains some description in header ?
On Visual Studio 2012 you could do something like this:
Find the files
C:\\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
The file you want is in an appropriately named folder. If you open the Class folder you will find the following 2 files:
Class.cs
Class.vstemplate
Backup the original files
Change the Class.cs template file
Save your changes
Tell Visual Studio about the changes
Your new changes will not be loaded unless you explicitly tell Visual Studio to reload all templates.
Close Visual Studio (or the change swill not show until next time you run it)
Open a command prompt (you should run this as Administrator if you are not an admin of the machine).
Change to the IDE folder a few levels above the template folder (e.g. to C:\\Microsoft Visual Studio 10.0\Common7\IDE)
Run the following command:
devenv.exe /installvstemplates

How to enable open XML Package Editor power tool for Visual Studio

I want to create customized ribbon on my excel sheet. I saw some of the tutorial (e.g, http://www.youtube.com/watch?v=hn3Qkp4Jw34) where they used Open XML package editor power tool for visual studio 2010 and worked on some xml configuration file to add ribbon. Hence I downloaded the tool and installed it. But when I drag and drop the excel file to the VS-2010, the file instead of opening in the VS editor it is opening in its new excel window. I tried to do same thing for a word file but still it is opening in new word window instead of opening in VS editor. Anybody could you please help me regarding this. I was using Visual Studio 2012 but then I came to know that Open XML package editor power tool for visual studio 2010 won't work for VS-2012 hence Installed VS-2010 but still getting same problem.
Thank you
Anup, Have you tried going to File->Open from Visual Studio?
If that opens it from an Office client application as well, then the Visual Studio Package Editor is not the default option for opening documents of that file extension.
If the document is a part of a solution (you can just create a new blank solution and add it in) you can right click on the file from Solution Explorer and choose "Open With", from there you can choose to open that file as a "Package File", and you can also select this as the default way to "open" files of that extension in Visual Studio.
I work for Microsoft and have just updated this plugin to work with VS2012 and 2013. Drag and drop should work in all the VS versions (I just tested it) but perhaps it's worth trying downloading the updated extension from the Gallery and seeing if it works for you in the newer VS version.

vsix opens visual studio

I seem to have got my system into a bit of a pickle with respect to Visual Studio extensions.
Normally I would use Nuget.
When an extension is not on Nuget, I'd download the vsix file and double-click on it to start the installation process. But now, when I double-click on the vsix file, it opens it in the Visual Studio text editor, treating it as a file to be edited, rather than executing it as a file to be executed.
Anyone know how I can restore the correct, intended behaviour?
Thanks
First way: if you open regedit and see keys under HKEY_CURRENT_USER\Software\Classes.vsix, just delete that entire key. That should allow the global registrations in HKLM to take effect again.
Otherwise, right click on the file, Open With, and choose "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe".

Assign .vcproj files to Visual Studio 2008, when Visual Studio 2010 installed

I have encountered a strange error. I use Windows 7 x64. Visual Studio 2010 (VS10) and Visual Studio 2008 (VS08) are both installed. Now i want to make sure that when i doubleclick open a .vcproj file it is being opened by VS8 and not VS10. Now this seems like a trivial problem, but:
"righclick -> open with -> choose default program -> select devenv.exe of VS08 -> always open with" doesnt work. In fact after browsing for devenv.exe of VS08 it does not show up in the list/menue where it is supposed to be displayed.
This is very strange and annoying, maybe someone already encountered this error and know a solution.
I GOT IT! For the Express versions at least. I strongly suspect these instructions can be modified to apply to the full version. The names will change of course.
I spent a lot more time on this than I will ever save by being able to click through to the correct IDE, but darn it, I just hate to give up.
Here's the deal. Strangely, the associations seem to be keyed to the program file names. (Say, what?? That sure is the way it looks to me.) Both VC++ Express 2008 and 2010 are named VCExpress.exe. We'll give the 2008 version an alias. We'll also use a doppelganger to pull off something of a ruse.
Navigate to "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE". Make a copy of VCExpress.exe, (not a shortcut), and re-name it VCExpress-2008.exe. (It would probably do just to re-name the original and use the new name in step 3.)
Open regedit.exe. Create a new key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\VSExpress-2008.exe
Edit the (default) value in that key, to hold the string "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" [sic]
Go through the drill with the file-association dialog again. Right-click, open with, choose default program, yada, yada, yada. Browse your way down to C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE and click on VSExpress-2008.exe.
VCExpress-2008 now shows up as a program in good standing, with its icon proudly displayed on the front page above the fold. (Don't tell the dialog, but you and I know it really points to VCExpress.exe, not the copy we made.) Click it.
Celebrate.
Ok i finally found a way. You can use the application "default programs editor" to mess with the standard file associations.

Reassociate .SQL files with VS T-SQL Editor

I seem to have lost the association from .sql files to the default VS T-SQL editor. I'm using Visual Studio 2008. When i open a .sql file it opens using a text editor with no syntax highlighting. How do I reassociate all .sql files with the default T-SQL editor while inside Visual Studio?
Edit Registry, copy GUID from key
HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\Language Services\T-SQL\Default
Create new key .sql in
HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\File Extensions
and default value set to GUID from first step.
Restart VS
in file explorer, right click on the .sql file, chose "open with" then "choose program...", select VS and check "always use..."
If you are not in a "SQL Server Project" you don't have the T-SQL Editor (Default Project Editor), just the default one. You can always use the default text editor which is not much different.
Thanks Pavel, works like a charm.
In my case I copied the guid from
HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\Language
Services\T-SQL90\Default
and created a new .sql key in
HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\File Extensions
You need to install or re-install some SQL Files from the ISO and it only took me 2 minutes. Namely:
Explore the ISO and go into the WCU folder then into the DAC folder and install the following files:
DACFramework_enu
DACProjectSystemSetup_enu
TSqlLanguageService_enu
That worked for me. I'm using VS 2010 and SQL Server 2008 R2

Resources