How to invoke built-in commands from Visual Studio macro? - visual-studio

From a Visual Studio macro, how do I (programmatically) invoke one of the built-in commands (say, File.OpenFile)?
Thanks.

Found out by recording a macro and then editing it, instead of creating it from scratch. For the benefit of others, the way to do it is (for example):
DTE.ExecuteCommand("File.OpenFile")

Related

How to inspect variables in a FAKE script?

I have a bug in my FAKE script in obscure code were I interface with legacy build infrastructure. I have a bug there and I wanted to debug my script in Visual Studio. I used --break flag to attach Visual Studio 2013 debugger and I could set up a break point. But I cannot inspect any of variables of a FAKE script.
Is there a way to use Visual Studio 2013 debugger to inspect state of FAKE script? There seems to no problems with regular F# programs.
Have you tried using the REPL to invoke your build script a bit at a time?
An example of using VS Code + the ionide plugin to use the FSI interactive Repl
You should be able to highlight and run parts of your script in the REPL.

How to use the C# editor in a Visual Studio Isolated Shell application?

I wanted to take a look to the Visual Studio extensibility SDK, specifically developing over the Isolated Shell. I would like to be able to use the C# code editor with syntax highlighting, intellisense, etc...
I've already read a bit about how to define your own content to support these features but I understand that for a language already supported like C# the needed package exists in the VSSDK and can be loaded into the isolated shell.
So, when creating an Isolated Shell application from the standard VS template and running the generated project, I can create a new C# file containing a class definition, but it is missing the syntax highlighting and the intellisense. I've found some very basic documentation on extending the Isolated Shell, but I cannot find how to enable the standard editors.
Is it possible to load/enable the standard VS editor extensions? If so, can you point me to any documentation or code example that can guide me a bit?
Thanks!
You can't do that. It's more a licensing issue. If you could put/enable everything in the isolated shell, then nobody would buy Visual Studio anymore.
Here is a more official answer from here: How to connect C# VSPackage to Visual Studio Shell Isolated Mode to have syntax highlighting
VS languages like C#, VB, and C++ cannot be loaded in the isolated
shell. Hence the reason we call it isolated :-)
Additionally it should be noted, the integrated shell does not include
these packages, nor are they licensed for redistribution; as they are
distributed with the Visual Studio product.
The integrated shell is basically the core VS IDE, wherease the
isolated shell is essentially the same IDE, but runs using a different
stub application (so you can customize it to suite your needs). But
the isolated shell does not ship with, or will it load any of the
mainstream language/project services that ship with VS Pro.

Visual studio autoexp.dat alternative?

Custom debug visualization in visual studio:
Is there any way to do it per project instead of editing the "global" autoexp.dat?
Would be nice if it tagged along when changing workstation..
No: per-project (or per-user) visualizers in Visual Studio 2010 (C++ native) are not possible. Visual Studio 2012 added this feature; it is based on "natvis" XML files.
Rather old question, but lets give my cent:
For VS2008 SP1 and VS2010 you have the alternative to use your custom file, instead of invasively edit the native autoexp.dat file using the _vcee_autoexp environment variable.
Credit to: https://vtk.org/Wiki/ITK/Debug_Visualizers_for_Visual_Studio
Note: I have not tried, but maybe using a relative path VS loads it based on the solution folder. Alternatively I would also try using multiple path separated with semicolons. Just give it a try.

Can I use different brace styles in different projects/solutions in VS2008?

I'm working with a couple of open-source projects that use different C# brace styles, and I'd like to configure VS text formatting to use different styles for each project so I can use Ctrl-K-D to reformat source code.
Is there any way I can configure Visual Studio 2008 to load a particular set of text formatting preferences along with a particular solution file?
As far as i know, there is no way to do this natively in VS 2008 (or even 2010 for that matter)
There is a resetsettings command line switch in Visual Studio which you can use to indicate what settings it should start up with. This works in 2005 and i presume it would with 2008 as well though i have personally not tried it with 2008. If you just make a bat file using this method as indicated here, that might be one workaround to your problem.
Also, there is an option to do a macro based solutions that might help you that i remember looking at in the past.You can probably check out this site which indicates how to do something very similar to what you are looking for

Where can I find visual studio macro examples?

When I look up anything about macros for Visual studio 2005, everyone is referencing the samples that ship with it. However, Visual studio was installed for me (IT department) and I do not have these sample macros.
Is there another place I can find(or download) them?
Note that you can also create your own using the macro recorder (Ctrl+Shift+R). After you record some actions, stop recording (ctrl+shift+R again), you can view the macro source using the Macros IDE (Tools | Macros | Macros IDE).
In VC 6 they used to be in a normal file from what I remember, but I'm not sure where they are kept in VS2005 and VS2008. I can't imagine that there is an install option to not include them.
Did you look in the Macro IDE or the Macro Explorer?
http://msdn.microsoft.com/en-us/library/s2shw615(VS.80).aspx
The Macros IDE includes some sample macros for your study and use. They are located in a node called Samples and are available in either the Macro Explorer or the Macros IDE. The following is a list of the macro samples and a description of what they do.
Try here for examples and tutorials
Code Project
Line Counter Add-in

Resources