Visual Studio DSL Tools and Server Explorer - visual-studio

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/

Related

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.

Roslyn Code refactoring VSIX project -- How to add more to the VSIX?

I've created a visual studio extension with some nice refactoring features via a Code Refactoring (CodeRefactoringProvider) roslyn project, but there isn't really anything to it in terms of adding tooltips or menu items or doing something on startup.
If I wanted to do something like add a settings menu or tell the user that they're on a trial version, how/when could I even do it? Even though I'm working in a vsix, events don't seem to be exposed anywhere.
Do CodeRefactoringProviders run in a bit of a sandbox? Because I like the way it consumes my class, shows the user a preview and it fits into the editor amazingly, but of course I'd like more control because after all, the root of what you create is a VSIX which can do almost anything in the visual studio environment.
I'm sure I could limit the # of refactorings and show a popup.. but I'm fairly certain people would send death threats.
You can add other elements in just the same way you would in any other vsix in a Roslyn vsix. There are various ways to do this, such as creating a Visual Studio Package, using an ITextViewCreationListener, etc.
One sample that I created showed how to integrate a Tools Options page with a Roslyn code issue at http://code.msdn.microsoft.com/windowsdesktop/Roslyn-Code-Issue-with-84d792dd.

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...

How do you show a dialog when a project is created in Visual Studio?

I'm trying to create a web application project template for everyone to use here at work that will minimize the amount of work that we have to do to create a new application with all our normal stuff, and I was thinking that it would be nice to do some setup stuff (add some records to a database) when the developer creates a new application (only if they tell it to), and I would like to do it through a dialog like the one that pops up for unit testing when you create a new ASP.Net MVC project. Is there any way to write a custom dialog that will pop up when you create a new project from the our custom project template? I'm assuming they're just using some public interface for the MVC unit testing dialog, right?
We're still on Visual Studio 2005, though, so maybe something like that isn't supported until 2008?
You're going to need a little VSX for this (Visual Studio Extensibility). Install the Visual Studio SDK and look for samples about the IWizard interface.
That may be all you need. However, if you need a more extensive and powerful experience around custom creation of projects and project items, and easy addition of context-sensitive commands to Visual Studio, then take a look at the Guidance Automation Extensions and Guidance Automation Toolkit.

How Can I add additional functions to Visual Studio's Server Explorer?

I am trying to write simple Visual Studio Add-In for code generation. In my solution explorer window there is a database connection an I want to get table names from this active connection.How can I do this?
Example
This looks to be what you need.
I have done this using DDEX Designer. For more information you can see example from Get data sources, data providers and data connections from a Visual Studio

Resources