Is there a way to create an Interface from an existing class? - visual-studio

I know it was possible in older versions, but cannot find it in Visual Studio 2015 Community.
Any tips?

Select the class and go to menu Edit - Refactor - Extract Interface.

Related

VS 2017 Quick Actions and Refactoring Issue

I'm using Visual Studio 2017 Professional v. 15.0.0-RTW.
And when press ctrl + . to show Quick actions and refactoring menu on any unknown type it is no longer show using [Namespace] like before..
Is there any solution to this problem ?
I had the same problem. I fixed it with the latest update for Visual Studio 2017 Professional (v15.2).
One reason a class will need a full namespace is if the class name is also part of a namespace. So, in your case, if you have a directory called DbCommand in your project VS will need to use the namespace when referencing the DbCommand class - it is ambiguous as to whether the identifier DbCommand is referring to the class or the namespace.

Automatically run extension code in Visual Studio on startup

Can I create an extension for Visual Studio that runs in the background as soon as the user opens the Visual Studio IDE? For example, I am building an extension that gets the current active file address in Visual Studio (with C#), but I would like this extension to always run in the background without having to be activated by the user clicking a button or pressing some key combination.
Is this possible, and if so, what is the best way of doing it?
Any help would be greatly appreciated! Regards, Erfan
Since you tagged your question with visual-studio-2010 I assume you are working on an "Add-in" rather than a "VSPackage Extensions".
In this case, you can use the OnConnection event handler.
If you are working on a VSPackage Extensions, you can use the attribute ProvideAutoLoad.
Just search for these, you will find sufficient information. Both ways are also described shortly here under "How can I run my add-in code in a VSPackage?"
For Extension add following attribute to Package class, this will load the extension when a solution is not open in visual studio. I have tested this with VS 2015 and 2017.
[ProvideAutoLoad(UIContextGuids80.NoSolution)]
For VS 2010 and higher the recommended extensibility approach is a package (VS 2015 won't allow add-ins).
To get the package loaded when Visual Studio is loaded see HOWTO: Autoload a Visual Studio package.
Once loaded, your package may be interested in two different kind of selection change events:
To get notified when the selection in the Solution Explorer changes, get the IVsMonitorSelection interface and call the AdviseSelectionEvents/UnadviseSelectionEvents and provide a class that implements the IVsSelectionEvents interface.
To get notified when the active window changes (which can be a document window or a toolwindow), implement the IVsWindowFrameNotify interface.

Extending the Visual Studio 2010 C# Intellisense?

Basically I would like to add extend the IntelliSense of Visual Studio 2010 (C#). Is it possible somehow?
We use objects generated at runtime - thus IntelliSense doesn't work for them. We have methods for getting their structure elsewhere, and it would be nice if they could seamlessly extend the normal IntelliSense.
If it's not possible, is there an alternate approach?
The following post can be usefull to you:
How to extend IntelliSense items
Hope that I helped.

Extending the extension manager

I want to extend the extension manager in Visual Studio 2010. I'd rather know if that is at all possible before I get into it, but am unable to find anything about it.
All the extensibility options I've read about mention nothing about being able to actually change the function of an existing VS2010 tool like the extension manager.
I'd appreciate any relevant links.
There are no supported interfaces for extending the Extension Manager in Visual Studio 2010.
What specifically did you have in mind though? Perhaps there's some other way you can accomplish what you're trying to do...

Visual Studio DSL Tools and Server Explorer

Is it possible to enable users to drag and drop a Table from the Visual Studio Server Explorer onto my own DSL Diagram?
I can drop custom Domain Classes I have created but want to make use of the build in funcationality.
I am working in Visual Studio 2010.
I suppose you could override the CreateDiagramView method in your DocView class, and call CreateDiagramView to get to the diagram. From there, you could listen to the DragDrop event. If you can understand what was dropped on you, you could do something with it.
Note: I haven't tested any of this - just happened to have a DSL open and played a bit.
You can find a working example here
http://altinoren.com/activewriter/

Resources