envdte

How to use DTE in PowerShell?

你离开我真会死。 提交于 2019-12-04 01:42:28
I am trying to use PowerShell to automate the process of creating an n-tier solution based on a seed (think EDMX file or DbContext) configuration. I want to be able to open a skeleton solution, get the active instance, and populate project files with auto-generated code. I'm trying to transcode the example provided here to powershell, however, I am getting errors. Here is the PowerShell code I am testing: First, I execute a little function to reference the DTE assemblies. $libs = "envdte.dll", "envdte80.dll", "envdte90.dll", "envdte100.dll" function LoadDTELibs { param( $path = "\Microsoft

Programmatically reset VisualStudio shortcuts

拟墨画扇 提交于 2019-12-04 00:00:43
问题 There are two related questions about resetting VisualStudio keyboard scheme and importing VisualStudio settings. However, this doesn't seem to play nice all together. I have two settings files containing shortcuts: <!-- IntelliJ.vssettings --> <ShortcutsScheme>Visual C# 2005</ShortcutsScheme> <UserShortcuts> <Shortcut Command="ReSharper.ReSharper_GotoNextHighlight" Scope="Global">F12</Shortcut> </UserShortcuts> <!-- ReSharper.vssettings --> <ShortcutsScheme>Visual C# 2005</ShortcutsScheme>

Getting the current EnvDTE or IServiceProvider when NOT coding an Addin

放肆的年华 提交于 2019-12-03 17:03:21
问题 I am coding up some design time code. I want to use this snippet: (Found here) var dte = (EnvDTE.DTE) GetService(typeof(EnvDTE.DTE)); if (dte != null) { var solution = dte.Solution; if (solution != null) { string baseDir = Path.GetDirectoryName(solution.FullName); } } Problem is that this does not compile. (GetService is not a known method call) I tried adding Microsoft.VisualStudio.Shell (and Microsoft.VisualStudio.Shell.10.0) but it did not help. In looking around on the internet I found

Get full list of available commands for DTE.ExecuteCommand

拥有回忆 提交于 2019-12-03 07:07:52
问题 I use VS2010 and Addin, using DTE.ExecuteCommand and commands like Build, Build.Cancel, Build.RebuildSolution, etc. You can get a command with DTE.Commands.Item("xxx") and guess if it is available with Command.IsAvailable. The list of commands is in the Tools, Options window, Environment, Keyboard section. Too, as you know DTE.ExecuteCommand takes two strings as parameters. The first one is the name of the command (for example, Action.CreateNewShortcut) and the second one is the arguments

Get full list of available commands for DTE.ExecuteCommand

霸气de小男生 提交于 2019-12-02 22:39:32
I use VS2010 and Addin, using DTE.ExecuteCommand and commands like Build, Build.Cancel, Build.RebuildSolution, etc. You can get a command with DTE.Commands.Item("xxx") and guess if it is available with Command.IsAvailable. The list of commands is in the Tools, Options window, Environment, Keyboard section. Too, as you know DTE.ExecuteCommand takes two strings as parameters. The first one is the name of the command (for example, Action.CreateNewShortcut) and the second one is the arguments that the command takes. The problem is that some commands require a variable number of arguments and I don

Add-In events are never executed

北慕城南 提交于 2019-12-02 20:57:26
I used the "Add-In for Visual Studio" wizard to create a new Addin project and now, I'm trying to add some event handlers: public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _applicationObject.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; _applicationObject.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone; _applicationObject.Events.SelectionEvents.OnChange += SelectionEvents_OnChange; _applicationObject.Events.DocumentEvents

How can I use EnvDTE within a .NET Standard project

女生的网名这么多〃 提交于 2019-12-02 00:16:27
问题 I'm porting a .net 4.7 project to .net standard, which uses T4 to generate some code. I iterate over the classes, properties and methods. This use to work perfectly, but now the return types of DTE are of type 'System.__ComObject' and I cannot cast them. Error: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE.CodeClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B1F42514-91CD-4D3A-8B25-A317D8032B24}'

How can I use EnvDTE within a .NET Standard project

◇◆丶佛笑我妖孽 提交于 2019-12-01 22:34:57
I'm porting a .net 4.7 project to .net standard, which uses T4 to generate some code. I iterate over the classes, properties and methods. This use to work perfectly, but now the return types of DTE are of type 'System.__ComObject' and I cannot cast them. Error: Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE.CodeClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B1F42514-91CD-4D3A-8B25-A317D8032B24}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E

VSIX window - key shortcut to execute ICommand

家住魔仙堡 提交于 2019-12-01 21:21:56
Having a Visual Studio extension (VSIX) project: In Window we got UserControl , which have Button binded to some ICommand . This works perfectly as expected, however I would like to attach a key shortcut (e.g.: CTRL + S ) which would fire the same Command . I have checked several questions, in which I found the most useful this code: <UserControl.InputBindings> <KeyBinding Modifiers="Ctrl" Key="Esc" Command="{Binding SaveCmd}"/> </UserControl.InputBindings> However the Command is never fired from the key-press, I think the issue(s) might be: code above should not be working? (I found article

ENVDTE - Add new project to existing solution and locate it in a specific folder

醉酒当歌 提交于 2019-12-01 20:17:05
I wrote a Visual Studio Wizard Template using c# on visual studio 2012. I followed the MSDN steps: I created a VS template, then I created a Class Library project with a class which implements the IWizard interface, I configured the .vstemplate file and etc... In my Class Library project I copy an existing solution from some directory in my computer, I add the new generated project to that solution, and run it. I'm doing this like: public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { solutionDir =