vspackage

Cannot run VSPackage when developing on multiple machines

♀尐吖头ヾ 提交于 2019-12-02 21:59:15
we are working on a VSPackage in a team, using Visual Studio 2012 and TFS. The extension works fine on the computer used to create it (through a wizard). On another computer, Visual Studio says that "a project with output type of class library cannot be started directly" when we attempt to run it (with F5). The output of the project is indeed class library, and pressing F5 on the first machine starts Experimental Instance of Visual Studio with the extension loaded and working. By looking at "%LOCALAPPDATA%\Microsoft\VisualStudio\11.0Exp\Extensions" on the second computer, we see that the

How to access project code meta data?

橙三吉。 提交于 2019-12-02 17:49:08
问题 In my VSPackage I need to replace reference to a property in code with its actual value. For example public static void Main(string[] args) { Console.WriteLine(Resource.HelloWorld); } What I want is to replace "Resource.HelloWorld" with its actual value - that is, find class Resource and get value of its static property HelloWorld. Does Visual Studio expose any API to handle code model of the project? It definitely has one, because this is very similar to common task of renaming variables. I

How to access project code meta data?

我的未来我决定 提交于 2019-12-02 09:45:43
In my VSPackage I need to replace reference to a property in code with its actual value. For example public static void Main(string[] args) { Console.WriteLine(Resource.HelloWorld); } What I want is to replace "Resource.HelloWorld" with its actual value - that is, find class Resource and get value of its static property HelloWorld. Does Visual Studio expose any API to handle code model of the project? It definitely has one, because this is very similar to common task of renaming variables. I don't want to use reflection on output assembly, because it's slow and it locks the file for a while.

Add Syntax Highlighting to IElisonBuffer

假装没事ソ 提交于 2019-12-02 06:25:01
问题 I'm working on a project where we've split up C# code into functions and stored these functions within IElisonBuffers. I've got Intellisense hooked up, and the buffers interact with other extensions fine as shown below: However, I cannot get syntax highlighting to work within these editors. I embed these editors via the following steps: Create an IVsInvisibleEditor for the file. Get the IVsTextLines for this IVsInvisibleEditor Create an IVsCodeWindow and set the buffer for this IVsCodeWindow

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:

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,

VSIX Project Context Menu

眉间皱痕 提交于 2019-12-01 09:02:25
I'm trying to create a Visual Studio 2017 extension, just for fun and to learn how VS extensibility works. My extension must be usable from the Solution Explorer tab as a context menu button, but I would like to include it at a menu level that isn't root. My goal is to put it in the "Add" sub-menu, but at the moment I'm only able to put it at root level (when you right-click the Project item, the menu entry is shown as the last of the context menu control). How can I move it under the "Add" node? Can it be done from the CommandPlacement tags I have configured in my .vsct file? Use as parent of

“Exception has been thrown by the target of an invocation.” when building a Visual Studio 2010 VSPackage

﹥>﹥吖頭↗ 提交于 2019-12-01 06:45:02
I recently create a couple of VSPackages for some Visual Studio extensions (menu bar/command). I compiled them correctly yesterday, checked into TFS (i'm the only one touching this project, FYI). I had already installed these extensions and were working fine. Today it doesn't compile! I get the following error: Exception has been thrown by the target of an invocation. This doesn't tell me anything, so i fired up Visual Studio with the following command: devenv.exe /Rebuild > out.log In my out.log, I see the following: C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK

How get the current running Visual Studio installation path from VSPackage

ぐ巨炮叔叔 提交于 2019-12-01 06:41:47
I've created a VSPackage which should copy some XML schema files to Visual Studio's installation path: %VS install path% \Xml\Schemas . I have multiple Visual Studios installed on my machine: Visual Studio 2013 Professional. Visual Studio 2015 Community Edition. Visual Studio Express Editions. I need to detect the path to the Visual Studio from which my VSPackage is executing its command. How can I get the current running Visual Studio's installation path in the package? First, I agree with Carlos in that particular point that an extension should never require elevated priviledges. But that

How get the current running Visual Studio installation path from VSPackage

假装没事ソ 提交于 2019-12-01 04:12:45
问题 I've created a VSPackage which should copy some XML schema files to Visual Studio's installation path: %VS install path% \Xml\Schemas . I have multiple Visual Studios installed on my machine: Visual Studio 2013 Professional. Visual Studio 2015 Community Edition. Visual Studio Express Editions. I need to detect the path to the Visual Studio from which my VSPackage is executing its command. How can I get the current running Visual Studio's installation path in the package? 回答1: First, I agree