vs-extensibility

Idea for extending C# syntax

你。 提交于 2019-12-03 06:19:15
C# unfortunately does not allow for extra user-defined syntax. But I was wondering whether it was possible to surpass this limitation by tapping into the visual studio onbuild-event. Suppose I have some syntactic sugar which could be easily translated into actual C# code. If I were to automatically translate a cs document containing this new syntax into a valid cs document, right before a C#-project is built, then the project could build succesfully. Overall this would function as if I had extended the C# language, because I started with an invalid cs document containing unoffical syntax, but

Run script when finished saving file - Visual Studio Extensibility

我只是一个虾纸丫 提交于 2019-12-02 11:56:11
Can someone give me some sample code for Visual Studio Extensibility where I can grab the text from a document, when the Save event ends, and run a script in C # with that text (example, trigger a Web service for certain file extensions). It could also be a new button (for example, save in the web service). You can subscribe to the DocumentSaved event: events = DTE.Events; documentEvents = events.DocumentEvents; documentEvents.DocumentSaved += OnDocumentSaved; In the OnDocumentSaved handler with EnvDTE.Document you can get the document path as doc.FullName . To get text from EnvDTE.Document:

how to get the selected connection node object of VS Server Explorer window DDEX

自作多情 提交于 2019-12-02 04:36:11
I'm adding some options for the Connection Node in the server explorer for my VS extension. For one of the menu options that I have added I need to get the connection string of the very selected connection, So I have tried this by adding some code in the BeforeQueryStatus event and also in the command handler method. But looks like I'm missing something since every time I want to get an Instance of the DataViewHierarchyAccessor I always get a null value. Although if I do the same thing but in a lower level node works fine. I have used the following code with no luck:

VSIX package doesn't include localized resources of referenced assembly

梦想与她 提交于 2019-12-02 00:31:02
问题 I'm creating a VS2010 extension (let's call it MyExtension ). The UI for this extension is in a different assembly ( MyExtension.UI ), the extension project only contains boilerplate code to call the UI from the menu command. MyExtension.UI contains localized resources (e.g. fr\MyExtensions.UI.resources.dll ), but the VSIX package doesn't include these resources (although they are present in the bin\Debug directory). How should I tell VS to include these resources in the VSIX package? I

Importing SvsServiceProvider in VS 2012

霸气de小男生 提交于 2019-12-01 21:51:37
问题 I am new to Visual Studio Extensibility and am try to implement one of the Microsoft Walkthroughs from the VS 2012 SDK (Displaying Statement Complete). I am having some difficulty with one class in the walkthrough. The problem is that I get a an error that SVsServiceProvider is not defined. I have imported Microsoft.VisualStudio.Shell . Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports System.ComponentModel.Composition Imports System.Runtime

VSIX package doesn't include localized resources of referenced assembly

我怕爱的太早我们不能终老 提交于 2019-12-01 20:22:12
I'm creating a VS2010 extension (let's call it MyExtension ). The UI for this extension is in a different assembly ( MyExtension.UI ), the extension project only contains boilerplate code to call the UI from the menu command. MyExtension.UI contains localized resources (e.g. fr\MyExtensions.UI.resources.dll ), but the VSIX package doesn't include these resources (although they are present in the bin\Debug directory). How should I tell VS to include these resources in the VSIX package? I looked in the .vsixmanifest designer, but I can't find the appropriate option... This is actually a bug that

How to Get Project Type Guid of selected project in the Solution Explorer by using VS Package

三世轮回 提交于 2019-12-01 11:05:33
I've created the simple VS Package for adding new item in the context menu of solution explorer. In that I need to check Selected Project's Project Type GUID. How can i get this. For example, One Solution contains the three different type of projects, like WindowFormsApplication, MVC Projects,WebApplication. While select the MVC Projects, we need to get that ProjectType GUID. I've tried the followings in my Package.cs, IVsMonitorSelection monitorSelection = (IVsMonitorSelection)Package.GetGlobalService(typeof(SVsShellMonitorSelection)); monitorSelection.GetCurrentSelection(out hierarchyPtr,

Is there a config type file for Visual Studio Add-In?

岁酱吖の 提交于 2019-12-01 03:23:28
问题 When creating a Visual Studio Add-In, how can you utilise an app.config for the add-in. If I add one to the project and deploy it then when the Add-In runs and I programmatically try to access it via the ConfigurationManager.AppSettings its not picking up the config file for the add-in. Am I doing something wrong or is there another means to access file based configuration settings for an add-in? 回答1: ConfigurationManager.AppSettings picks up the configuration file for the AppDomain you are

DTE2 events don't fire

拥有回忆 提交于 2019-11-30 18:32:12
While trying to develop my first VS Addin, I am having issues in firing DTE2 events. Basically, the DocumentOpened and LineChanged events don't fire for some reason. What important part did I miss? namespace TestAddin { public class Connect : IDTExtensibility2 { private AddIn _addInInstance; private DTE2 _applicationObject; public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2) application; _addInInstance = (AddIn) addInInst; _applicationObject.Events.DocumentEvents.DocumentOpened +=

How to get the details of the selected item in solution explorer using vs package

感情迁移 提交于 2019-11-30 15:16:31
I am trying to create a VS package in which, i have added a menu command to the context menu you get when you right click an item in solution explorer. Now on clicking the command i want to show a pop up with the details of the item on which you right clicked and choose my command. How can i get it done?? what service i can use to get the details of the selected item? private static EnvDTE80.DTE2 GetDTE2() { return GetGlobalService(typeof(DTE)) as EnvDTE80.DTE2; } private string GetSourceFilePath() { EnvDTE80.DTE2 _applicationObject = GetDTE2(); UIHierarchy uih = _applicationObject.ToolWindows