visual-studio-sdk

How do I programmatically find out the Action of each StartUp Project in a solution?

断了今生、忘了曾经 提交于 2019-12-22 04:41:30
问题 Under Solution->Properties, I can set multiple start-up projects: I know that I can get the list of projects marked with "Start" (by using EnvDTE: solution.SolutionBuild.StartupProjects ), but how do I get the list of projects whose action is "Start without debugging"? They do not appear in the list. 回答1: I don't think this is documented and available officially, but here are some information: This is stored in the solution's .SUO file by the Visual Studio built-in package. The SUO file has

Is it possible to automatically set “Copy to Output Directory” when creating files in Visual Studio 2010?

别来无恙 提交于 2019-12-19 00:45:14
问题 I recently started playing around with LuaInterface to get Lua scripting working in my C# programs. In order to easily create Lua scripts from within Visual Studio, I installed a Lua syntax highlighting plugin and created an Item Template so that I could create new scripts by right clicking on the project file and selecting "New Item->Lua Script". This works quite well. In order for the program to find the scripts, they need to be placed in the same directory (or a subdirectory) of the build

Visual Studio Extensibility (VSX) - Get the current branch name

我的未来我决定 提交于 2019-12-14 02:31:07
问题 I am developing a Visual Studio extension (VS Package). I am trying to get the Source Control branch name for a project/solution. The only source control service available in the VS SDK is SVsSccManager but that doesn't provide any means of retrieving the source control branch name. Also looked at DTE.SourceControl but alas, it doesn't give branch info. I really don't want to develop my own Source Control plug-in to simply retrieve the branch name (this feels like total overkill). Is there

Programmatically adding and editing the Targets in a Visual Studio Project File

瘦欲@ 提交于 2019-12-13 14:33:20
问题 I am trying to programmatically add the following Target to my Visual Studio Project File. <Target Name="PostBuildEvent" Condition="'$(PostBuildEvent)'!=''" DependsOnTargets="$(PostBuildEventDependsOn)"> <Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" IgnoreExitCode="true" /> </Target> I am pretty sure that IVsBuildPropertyStorage or IVsBuildPropertyStorage2 will not work because the require a ProjectItem aka a node from the <ItemGroup> element in the project file. What I would

Accessing all the methods and classes for VS Extension with Adornment

强颜欢笑 提交于 2019-12-13 06:56:33
问题 I am developing an extension for visual studio with adornment. I have to put label above every class and methods in active document. Now my problem is how can I get all the methods and classes? I searched for it but none of them shows the exact solution. Thanks in advance! 回答1: if(this._dte!=null && this._dte.ActiveDocument!=null) { List<CodeClass> foundClasses = new List<CodeClass>(); List<CodeFunction> foundMethod = new List<CodeFunction>(); CodeElements elementsInDocument = this._dte

Creating a custom designer

眉间皱痕 提交于 2019-12-10 11:27:08
问题 I've been asked to create a Custom Designer for Visual Studio. In this designer a programmer can create/edit Forms with controls and position them. The input and result will be used and compiled by an external system (Sesam i've been told but never heard of it) The format will be in XML. The question is, where do I start, is it even feasible to create a Custom Designer? 回答1: You can create custom designers, but how you go about it depends on your requirements. If you're lucky, you can get

DTEEvents.OnStartupComplete event not working for VSPackage (VSSDK2010)

北慕城南 提交于 2019-12-10 11:12:01
问题 In the Package constructor I added the event handler for OnStartupComplete event. But when I run the code, the the event handler is not called. What am I doing wrong? 回答1: There's a bug in VS that recycles the DTEEvents object (with your event handlers) unless you keep an explicit reference to it. You need something like this: [ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)] [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)] class MyPackage : Package { DTEEvents

Store array in options using DialogPage

大憨熊 提交于 2019-12-08 17:02:47
问题 Assume that I need to store any array in the extension just freshly created from the template. I just created new VSIX project, added VSPackage to it, then added option page grid ( DialogPage ). Then I followed instructions from answers to a similar question: DialogPage - string array not persisted. And, for demonstration purposes, let's also add int[] array and plain int with custom type converter . // [standard attributes] [ProvideOptionPage(typeof(OptionPageGrid), "My Category", "My Grid

Visual Studio SDK - How to add a margin glyph on command invoked?

和自甴很熟 提交于 2019-12-07 23:14:02
问题 How can I modify this sample: https://msdn.microsoft.com/en-us/library/ee361745.aspx to have glyphs added to the margin when a button I added is clicked? I have a button which creates a special kind of breakpoint. I would like this kind to be recognized by my own margin glyph. So I wrote the GetTags method in my Tagger class as follows: IEnumerable<ITagSpan<MyBreakpointTag>> ITagger<MyBreakpointTag>.GetTags(NormalizedSnapshotSpanCollection spans) { if (BreakpointManager != null) { DTE2 ide =

DTEEvents.OnStartupComplete event not working for VSPackage (VSSDK2010)

拟墨画扇 提交于 2019-12-06 12:00:41
In the Package constructor I added the event handler for OnStartupComplete event. But when I run the code, the the event handler is not called. What am I doing wrong? There's a bug in VS that recycles the DTEEvents object (with your event handlers) unless you keep an explicit reference to it. You need something like this: [ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)] [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)] class MyPackage : Package { DTEEvents _EventsObj; protected override void Initialize() { var dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); _EventsObj