vs-extensibility

How do you cancel a ToolWindowPane or Visual Studio IDE close operation via a VSPackage?

爷,独闯天下 提交于 2020-01-01 06:27:10
问题 I have a VSPackage with a dockable tool window containing form data. If there are unsaved changes in this form, I would like to cancel a close to either the tool window and the visual studio IDE if the user clicks cancel on saving changes before closing. I can perform the save test on close, but I don't see any event handler methods or other options to actually cancel the close. Here is some blurb from the package: private DTE2 _applicationObject = null; ///-----------------------------------

How do you cancel a ToolWindowPane or Visual Studio IDE close operation via a VSPackage?

前提是你 提交于 2020-01-01 06:27:09
问题 I have a VSPackage with a dockable tool window containing form data. If there are unsaved changes in this form, I would like to cancel a close to either the tool window and the visual studio IDE if the user clicks cancel on saving changes before closing. I can perform the save test on close, but I don't see any event handler methods or other options to actually cancel the close. Here is some blurb from the package: private DTE2 _applicationObject = null; ///-----------------------------------

Idea for extending C# syntax

一曲冷凌霜 提交于 2020-01-01 02:35:18
问题 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

Run script when finished saving file - Visual Studio Extensibility

荒凉一梦 提交于 2019-12-31 06:23:20
问题 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). 回答1: You can subscribe to the DocumentSaved event: events = DTE.Events; documentEvents = events.DocumentEvents; documentEvents.DocumentSaved += OnDocumentSaved; In the OnDocumentSaved

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

こ雲淡風輕ζ 提交于 2019-12-31 04:23:10
问题 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

Finding a ProjectItem by type name via DTE

廉价感情. 提交于 2019-12-29 04:46:06
问题 Given a type name, is it possible to use DTE to find the ProjectItem that the type is located in? Something similar to how the Navigate To... dialog works in Visual Studio 2010. The closest I could find is Solution.FindProjectItem, but that takes in a file name. Thanks! 回答1: I've been trying to do something similar, and have come up with the following, which simply searches through namespaces and classes until it hits the one you're looking for. It seems to work in most cases although when

Finding a ProjectItem by type name via DTE

烈酒焚心 提交于 2019-12-29 04:46:05
问题 Given a type name, is it possible to use DTE to find the ProjectItem that the type is located in? Something similar to how the Navigate To... dialog works in Visual Studio 2010. The closest I could find is Solution.FindProjectItem, but that takes in a file name. Thanks! 回答1: I've been trying to do something similar, and have come up with the following, which simply searches through namespaces and classes until it hits the one you're looking for. It seems to work in most cases although when

Obtain a PLK for a 2005/2008 VSPackage

▼魔方 西西 提交于 2019-12-25 07:49:50
问题 Our VS extension still needs to support VS 2005 and 2008, but I cannot generate a VSPackage PLK anymore - the system seems to be either broken or no longer supported by Microsoft. There is an MSDN page: How to: Obtain a PLK for a VSPackage, but steps described there no longer work on the new VS Extesibility website. Does anybody know whether creation of new VSPackages (signed with PLK) is still supported for VS 2005 and 2008? If so, where to go for the PLKs? 回答1: Enroll the VSIP Program

how to update Visual Studio UI when using DynamicItemStart inside a vsix package

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:46:12
问题 I'm implementing a DynamicItemStart button inside a Menu Controller. I'm loading the dynamic items for this button when Visual Studio starts. Everything is loaded correctly so the initialize method is called an I see all the new items in this Dynamic button. After the package is completely loaded I want to add more items to this Dynamic button, but since the package is already loaded the initialize method is not called again and I cannot see the new items in this Dynamic button. I only see

Attaching files in VSIX container

≯℡__Kan透↙ 提交于 2019-12-23 17:06:04
问题 Is it possible to include some predefined files in the VSIX container and then access them by the extension? 回答1: In the .vsixmanifest designer select Assets - New - Select type and file name. Or directly edit .vsixmanifest Assets node. These files will be deployed to the same directory as the main extension dll. 回答2: In Solution Explorer, right click the file and open Properties pane. Set Include in VSIX = true 来源: https://stackoverflow.com/questions/23106519/attaching-files-in-vsix