├── .gitattributes ├── .github └── dependabot.yml ├── .gitignore ├── CommandCodeWindowContextMenu ├── CommandCodeWindowContextMenu.sln ├── CommandCodeWindowContextMenu │ ├── Command1.cs │ ├── CommandCodeWindowContextMenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Command1.png │ │ └── VSPackageCommandCodeWindowContextMenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandCodeWindowContextMenu.cs │ ├── VSPackageCommandCodeWindowContextMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandFileContextMenu ├── CommandFileContextMenu.sln ├── CommandFileContextMenu │ ├── Command1.cs │ ├── CommandFileContextMenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Command1.png │ │ └── VSPackageCommandFileContextMenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandFileContextMenu.cs │ ├── VSPackageCommandFileContextMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandProjectContextMenu ├── CommandProjectContextMenu.sln ├── CommandProjectContextMenu │ ├── Command1.cs │ ├── CommandProjectContextMenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Command1.png │ │ └── VSPackageCommandProjectContextMenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandProjectContextMenu.cs │ ├── VSPackageCommandProjectContextMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandSolutionContextMenu ├── CommandSolutionContextMenu.sln ├── CommandSolutionContextMenu │ ├── Command1.cs │ ├── CommandSolutionContextMenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Command1.png │ │ └── VSPackageCommandSolutionContextMenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandSolutionContextMenu.cs │ ├── VSPackageCommandSolutionContextMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandSubmenu ├── CommandSubmenu.sln ├── CommandSubmenu │ ├── Command1.cs │ ├── Command2.cs │ ├── CommandSubmenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Commands.png │ │ └── VSPackageCommandSubmenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandSubmenu.cs │ ├── VSPackageCommandSubmenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandToolbar ├── CommandToolbar.sln ├── CommandToolbar │ ├── Command1.cs │ ├── Command2.cs │ ├── CommandToolbar.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Commands.png │ │ └── VSPackageCommandToolbar.ico │ ├── VSPackage.resx │ ├── VSPackageCommandToolbar.cs │ ├── VSPackageCommandToolbar.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandTopMenu ├── CommandTopMenu.sln ├── CommandTopMenu │ ├── Command1.cs │ ├── Command2.cs │ ├── CommandTopMenu.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Commands.png │ │ └── VSPackageCommandTopMenu.ico │ ├── VSPackage.resx │ ├── VSPackageCommandTopMenu.cs │ ├── VSPackageCommandTopMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── CommandWithArguments ├── CommandWithArguments.sln ├── CommandWithArguments │ ├── CommandWithArguments.cs │ ├── CommandWithArguments.csproj │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ └── VSPackageCommandWithArguments.ico │ ├── VSPackage.resx │ ├── VSPackageCommandWithArguments.cs │ ├── VSPackageCommandWithArguments.vsct │ ├── packages.config │ ├── source.extension.vsixmanifest │ └── stylesheet.css └── README.md ├── ContextMenu ├── ContextMenu.sln ├── ContextMenu │ ├── Commands │ │ ├── Command1.cs │ │ ├── Command2.cs │ │ └── ToolWindowCommand.cs │ ├── ContextMenu.csproj │ ├── Key.snk │ ├── MyToolWindow.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Images.png │ │ └── VSPackageContextMenu.ico │ ├── ToolWindowControl.xaml │ ├── ToolWindowControl.xaml.cs │ ├── VSPackage.resx │ ├── VSPackageContextMenu.cs │ ├── VSPackageContextMenu.vsct │ ├── packages.config │ └── source.extension.vsixmanifest └── README.md ├── DtePackage ├── DtePackage.sln ├── DtePackage │ ├── DtePackage.csproj │ ├── Key.snk │ ├── MyPackage.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ └── MyPackage.ico │ ├── VSPackage.resx │ ├── packages.config │ ├── source.extension.vsixmanifest │ └── stylesheet.css └── README.md ├── PackageCommandsCreatedByCode ├── PackageCommandsCreatedByCode.sln ├── PackageCommandsCreatedByCode │ ├── Key.snk │ ├── PackageCommandsCreatedByCode.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ └── VSMyPackage.ico │ ├── VSMyPackage.cs │ ├── VSPackage.resx │ ├── index.html │ ├── packages.config │ ├── source.extension.vsixmanifest │ └── stylesheet.css └── README.md ├── VSIXDebuggerVisualizer ├── DebuggerVisualizer │ ├── DebuggerVisualizer.csproj │ ├── DummyDebuggerVisualizer.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md ├── VSIX │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ └── VSIXPackage.ico │ ├── VSIX.csproj │ ├── VSIXPackage.cs │ ├── VSPackage.resx │ ├── packages.config │ ├── source.extension.vsixmanifest │ └── stylesheet.css └── VSIXDebuggerVisualizer.sln └── VSIXLocalizedPackage ├── README.md ├── VSIXLocalizedPackage.sln └── VSIXLocalizedPackage ├── Key.snk ├── MyCommand.cs ├── Properties └── AssemblyInfo.cs ├── Resources ├── MyCommand.png └── VSLocalizedPackage.ico ├── VSIXLocalizedPackage.csproj ├── VSLocalizedPackage.cs ├── VSLocalizedPackage.en-US.vsct ├── VSLocalizedPackage.es-ES.vsct ├── VSPackage.en-US.resx ├── VSPackage.es-ES.resx ├── es-ES └── extension.vsixlangpack ├── packages.config └── source.extension.vsixmanifest /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandCodeWindowContextMenu", "CommandCodeWindowContextMenu\CommandCodeWindowContextMenu.csproj", "{6302EA70-637D-4FDC-B169-1493427DD8D2}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F01A8A59-5843-4AF3-A293-6DA86D5DEE1B}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {6302EA70-637D-4FDC-B169-1493427DD8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {6302EA70-637D-4FDC-B169-1493427DD8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {6302EA70-637D-4FDC-B169-1493427DD8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {6302EA70-637D-4FDC-B169-1493427DD8D2}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandCodeWindowContextMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0100; 12 | 13 | public static readonly Guid CommandSet = new Guid("0c1acc31-15ac-417c-86b2-eefdc669e8bf"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message; 57 | string title = "Command1"; 58 | EnvDTE.DTE dte; 59 | EnvDTE.Document activeDocument; 60 | 61 | dte = (EnvDTE.DTE)this.ServiceProvider.GetService(typeof(EnvDTE.DTE)); 62 | activeDocument = dte.ActiveDocument; 63 | message = $"Called on {activeDocument.FullName}"; 64 | 65 | // Show a message box to prove we were here 66 | VsShellUtilities.ShowMessageBox( 67 | this.ServiceProvider, 68 | message, 69 | title, 70 | OLEMSGICON.OLEMSGICON_INFO, 71 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 72 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Key.snk -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandCodeWindowContextMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandCodeWindowContextMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Resources/Command1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Resources/Command1.png -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Resources/VSPackageCommandCodeWindowContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/Resources/VSPackageCommandCodeWindowContextMenu.ico -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/VSPackageCommandCodeWindowContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandCodeWindowContextMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandCodeWindowContextMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandCodeWindowContextMenu : Package 14 | { 15 | public const string PackageGuidString = "7e37eef9-8cbe-4b10-81f7-66413cd2c9d3"; 16 | 17 | public VSPackageCommandCodeWindowContextMenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/VSPackageCommandCodeWindowContextMenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/CommandCodeWindowContextMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandCodeWindowContextMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandCodeWindowContextMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio command on the code window context menu 2 | ===================================================================== 3 | 4 | Demonstrates the use of the CommandPlacements section of the .vsct file to place a command inside a new group on the code window context menu. -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandFileContextMenu", "CommandFileContextMenu\CommandFileContextMenu.csproj", "{4B7453DE-C0BF-4277-ACC9-8B8972D7EEA9}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{24937576-A89B-4EA2-B0D6-9AD2CB442B24}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {4B7453DE-C0BF-4277-ACC9-8B8972D7EEA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {4B7453DE-C0BF-4277-ACC9-8B8972D7EEA9}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {4B7453DE-C0BF-4277-ACC9-8B8972D7EEA9}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {4B7453DE-C0BF-4277-ACC9-8B8972D7EEA9}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandFileContextMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0100; 12 | 13 | public static readonly Guid CommandSet = new Guid("b394839a-d886-44d2-94c9-ffeeb48d97d5"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message; 57 | string title = "Command1"; 58 | EnvDTE.DTE dte; 59 | EnvDTE.SelectedItems selectedItems; 60 | EnvDTE.ProjectItem projectItem; 61 | 62 | dte = (EnvDTE.DTE)this.ServiceProvider.GetService(typeof(EnvDTE.DTE)); 63 | selectedItems = dte.SelectedItems; 64 | 65 | if (selectedItems != null) 66 | { 67 | foreach (EnvDTE.SelectedItem selectedItem in selectedItems) 68 | { 69 | projectItem = selectedItem.ProjectItem as EnvDTE.ProjectItem; 70 | 71 | if (projectItem != null) 72 | { 73 | message = $"Called on {projectItem.Name}"; 74 | 75 | // Show a message box to prove we were here 76 | VsShellUtilities.ShowMessageBox( 77 | this.ServiceProvider, 78 | message, 79 | title, 80 | OLEMSGICON.OLEMSGICON_INFO, 81 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 82 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandFileContextMenu/CommandFileContextMenu/Key.snk -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandFileContextMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandFileContextMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/Resources/Command1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandFileContextMenu/CommandFileContextMenu/Resources/Command1.png -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/Resources/VSPackageCommandFileContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandFileContextMenu/CommandFileContextMenu/Resources/VSPackageCommandFileContextMenu.ico -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/VSPackageCommandFileContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandFileContextMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandFileContextMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandFileContextMenu : Package 14 | { 15 | public const string PackageGuidString = "669df51d-2588-4d30-962e-0070898e765e"; 16 | 17 | public VSPackageCommandFileContextMenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/VSPackageCommandFileContextMenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandFileContextMenu/CommandFileContextMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandFileContextMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandFileContextMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio command on the file context menu 2 | ============================================================== 3 | 4 | Demonstrates the use of the CommandPlacements section of the .vsct file to place a command inside a new group on the context menu of a file or multiple files (belonging to the same project, or to different projects). -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandProjectContextMenu", "CommandProjectContextMenu\CommandProjectContextMenu.csproj", "{534DD115-3325-4371-9E74-C0027E626437}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4C05316F-D3C6-47FE-AD61-F1318B416121}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {534DD115-3325-4371-9E74-C0027E626437}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {534DD115-3325-4371-9E74-C0027E626437}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {534DD115-3325-4371-9E74-C0027E626437}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {534DD115-3325-4371-9E74-C0027E626437}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandProjectContextMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0100; 12 | 13 | public static readonly Guid CommandSet = new Guid("9a55a2b4-3e29-4359-882b-fa5f51c09300"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message; 57 | string title = "Command1"; 58 | EnvDTE.DTE dte; 59 | object[] activeSolutionProjects; 60 | EnvDTE.Project project; 61 | 62 | dte = (EnvDTE.DTE)this.ServiceProvider.GetService(typeof(EnvDTE.DTE)); 63 | activeSolutionProjects = dte.ActiveSolutionProjects as object[]; 64 | 65 | if (activeSolutionProjects != null) 66 | { 67 | foreach (object activeSolutionProject in activeSolutionProjects) 68 | { 69 | project = activeSolutionProject as EnvDTE.Project; 70 | 71 | if (project != null) 72 | { 73 | message = $"Called on {project.FullName}"; 74 | 75 | // Show a message box to prove we were here 76 | VsShellUtilities.ShowMessageBox( 77 | this.ServiceProvider, 78 | message, 79 | title, 80 | OLEMSGICON.OLEMSGICON_INFO, 81 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 82 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandProjectContextMenu/CommandProjectContextMenu/Key.snk -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandProjectContextMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandProjectContextMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/Resources/Command1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandProjectContextMenu/CommandProjectContextMenu/Resources/Command1.png -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/Resources/VSPackageCommandProjectContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandProjectContextMenu/CommandProjectContextMenu/Resources/VSPackageCommandProjectContextMenu.ico -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/VSPackageCommandProjectContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandProjectContextMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandProjectContextMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandProjectContextMenu : Package 14 | { 15 | public const string PackageGuidString = "069acb34-c12c-4e1c-ae69-1f9295046c84"; 16 | 17 | public VSPackageCommandProjectContextMenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/VSPackageCommandProjectContextMenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/CommandProjectContextMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandProjectContextMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandProjectContextMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio command on the project context menu 2 | ================================================================= 3 | 4 | Demonstrates the use of the CommandPlacements section of the .vsct file to place a command inside a new group on the context menu of a Windows project, Web project, or multiple projects selected. -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandSolutionContextMenu", "CommandSolutionContextMenu\CommandSolutionContextMenu.csproj", "{1AC2737A-BF95-4E2C-AE25-8355E1F1C462}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FC1B15E1-C018-4DED-9932-4049F3226448}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {1AC2737A-BF95-4E2C-AE25-8355E1F1C462}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {1AC2737A-BF95-4E2C-AE25-8355E1F1C462}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {1AC2737A-BF95-4E2C-AE25-8355E1F1C462}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {1AC2737A-BF95-4E2C-AE25-8355E1F1C462}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandSolutionContextMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0100; 12 | 13 | public static readonly Guid CommandSet = new Guid("42d8467b-0102-4e3f-964c-dbedf18b2323"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message; 57 | string title = "Command1"; 58 | EnvDTE.DTE dte; 59 | EnvDTE.Solution solution; 60 | 61 | dte = (EnvDTE.DTE)this.ServiceProvider.GetService(typeof(EnvDTE.DTE)); 62 | solution = dte.Solution; 63 | message = $"Called on {solution.FullName}"; 64 | 65 | // Show a message box to prove we were here 66 | VsShellUtilities.ShowMessageBox( 67 | this.ServiceProvider, 68 | message, 69 | title, 70 | OLEMSGICON.OLEMSGICON_INFO, 71 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 72 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSolutionContextMenu/CommandSolutionContextMenu/Key.snk -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandSolutionContextMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandSolutionContextMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/Resources/Command1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSolutionContextMenu/CommandSolutionContextMenu/Resources/Command1.png -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/Resources/VSPackageCommandSolutionContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSolutionContextMenu/CommandSolutionContextMenu/Resources/VSPackageCommandSolutionContextMenu.ico -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/VSPackageCommandSolutionContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandSolutionContextMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandSolutionContextMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandSolutionContextMenu : Package 14 | { 15 | public const string PackageGuidString = "cffa6255-844b-403b-9a39-0361b700844d"; 16 | 17 | public VSPackageCommandSolutionContextMenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/VSPackageCommandSolutionContextMenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/CommandSolutionContextMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandSolutionContextMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandSolutionContextMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio command on the Solution context menu 2 | ================================================================== 3 | 4 | Demonstrates the use of the CommandPlacements section of the .vsct file to place a command inside a new group inside the Solution context menu. -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandSubmenu", "CommandSubmenu\CommandSubmenu.csproj", "{E968C7B6-2AD9-48D8-A244-53563D17F564}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E6AB370C-490A-4ED9-A794-D5E9E81741B0}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {E968C7B6-2AD9-48D8-A244-53563D17F564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {E968C7B6-2AD9-48D8-A244-53563D17F564}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {E968C7B6-2AD9-48D8-A244-53563D17F564}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {E968C7B6-2AD9-48D8-A244-53563D17F564}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandSubmenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0101; 12 | 13 | public static readonly Guid CommandSet = new Guid("bea4976d-811a-4dd0-9745-0bed7a658b5d"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command1"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Command2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandSubmenu 8 | { 9 | internal sealed class Command2 10 | { 11 | public const int CommandId = 0x0102; 12 | 13 | public static readonly Guid CommandSet = new Guid("bea4976d-811a-4dd0-9745-0bed7a658b5d"); 14 | 15 | private readonly Package package; 16 | 17 | private Command2(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command2 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command2(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command2"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSubmenu/CommandSubmenu/Key.snk -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandSubmenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandSubmenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Resources/Commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSubmenu/CommandSubmenu/Resources/Commands.png -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/Resources/VSPackageCommandSubmenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandSubmenu/CommandSubmenu/Resources/VSPackageCommandSubmenu.ico -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/VSPackageCommandSubmenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandSubmenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandSubmenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandSubmenu : Package 14 | { 15 | public const string PackageGuidString = "d2cc7f26-42fb-4c8d-858f-05f3fc3599d5"; 16 | 17 | public VSPackageCommandSubmenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | Command2.Initialize(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/VSPackageCommandSubmenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | My submenu 17 | 18 | 19 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandSubmenu/CommandSubmenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandSubmenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandSubmenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create Visual Studio commands on a submenu 2 | ================================================= 3 | 4 | Demonstrates the use of the CommandPlacements section of the .vsct file to place a command inside a new group on a submenu inside a new group on the Solution context menu and on the Standard toolbar. -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandToolbar", "CommandToolbar\CommandToolbar.csproj", "{719BCCDA-D372-4F6F-9569-3F265F434252}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B655B51-DEF1-4A78-BE86-27A1220A486F}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {719BCCDA-D372-4F6F-9569-3F265F434252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {719BCCDA-D372-4F6F-9569-3F265F434252}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {719BCCDA-D372-4F6F-9569-3F265F434252}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {719BCCDA-D372-4F6F-9569-3F265F434252}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandToolbar 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0101; 12 | 13 | public static readonly Guid CommandSet = new Guid("8b033dfa-ab64-4106-9b87-116a5fc2a9d8"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command1"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Command2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandToolbar 8 | { 9 | internal sealed class Command2 10 | { 11 | public const int CommandId = 0x0102; 12 | 13 | public static readonly Guid CommandSet = new Guid("8b033dfa-ab64-4106-9b87-116a5fc2a9d8"); 14 | 15 | private readonly Package package; 16 | 17 | private Command2(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command2 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command2(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command2"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandToolbar/CommandToolbar/Key.snk -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandToolbar")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandToolbar")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Resources/Commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandToolbar/CommandToolbar/Resources/Commands.png -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/Resources/VSPackageCommandToolbar.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandToolbar/CommandToolbar/Resources/VSPackageCommandToolbar.ico -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/VSPackageCommandToolbar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandToolbar 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandToolbar.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandToolbar : Package 14 | { 15 | public const string PackageGuidString = "4d39cbb8-8aad-4b40-b867-22082c266766"; 16 | 17 | public VSPackageCommandToolbar() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | Command2.Initialize(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/VSPackageCommandToolbar.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | My toolbar 17 | 18 | 19 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandToolbar/CommandToolbar/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandToolbar 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandToolbar/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio toolbar 2 | ===================================== 3 | 4 | Demonstrates how to create a toolbar. -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandTopMenu", "CommandTopMenu\CommandTopMenu.csproj", "{C120F47A-3B55-4378-A766-710E6743CC57}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E204B70-D5D6-47D3-BCBD-60E07B9D67DD}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {C120F47A-3B55-4378-A766-710E6743CC57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {C120F47A-3B55-4378-A766-710E6743CC57}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {C120F47A-3B55-4378-A766-710E6743CC57}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {C120F47A-3B55-4378-A766-710E6743CC57}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandTopMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | public const int CommandId = 0x0101; 12 | 13 | public static readonly Guid CommandSet = new Guid("acf32b59-19bf-4492-b19b-2d359e74a69a"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command1"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Command2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace CommandTopMenu 8 | { 9 | internal sealed class Command2 10 | { 11 | public const int CommandId = 0x0102; 12 | 13 | public static readonly Guid CommandSet = new Guid("acf32b59-19bf-4492-b19b-2d359e74a69a"); 14 | 15 | private readonly Package package; 16 | 17 | private Command2(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command2 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command2(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command2"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandTopMenu/CommandTopMenu/Key.snk -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandTopMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandTopMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Resources/Commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandTopMenu/CommandTopMenu/Resources/Commands.png -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/Resources/VSPackageCommandTopMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandTopMenu/CommandTopMenu/Resources/VSPackageCommandTopMenu.ico -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/VSPackageCommandTopMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandTopMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandTopMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandTopMenu : Package 14 | { 15 | public const string PackageGuidString = "cd803dc7-0b76-4fb6-b92e-6415591b66b8"; 16 | 17 | public VSPackageCommandTopMenu() 18 | { 19 | } 20 | 21 | protected override void Initialize() 22 | { 23 | base.Initialize(); 24 | Command1.Initialize(this); 25 | Command2.Initialize(this); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/VSPackageCommandTopMenu.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | My Top Menu 17 | 18 | 19 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandTopMenu/CommandTopMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandTopMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandTopMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio top menu 2 | ====================================== 3 | 4 | Demonstrates how to create a top menu. -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandWithArguments", "CommandWithArguments\CommandWithArguments.csproj", "{655D3E93-7AEE-4696-B742-65065A2AC5DE}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{FFDE3F84-E3B0-4831-B6F7-E832ED298460}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {655D3E93-7AEE-4696-B742-65065A2AC5DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {655D3E93-7AEE-4696-B742-65065A2AC5DE}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {655D3E93-7AEE-4696-B742-65065A2AC5DE}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {655D3E93-7AEE-4696-B742-65065A2AC5DE}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/CommandWithArguments.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | 6 | namespace CommandWithArguments 7 | { 8 | internal sealed class CommandWithArguments 9 | { 10 | public const int CommandId = 0x0100; 11 | 12 | public static readonly Guid CommandSet = new Guid("1ce3ba1f-07bd-41be-93c8-831fc64fd7d4"); 13 | 14 | private readonly Package package; 15 | 16 | private CommandWithArguments(Package package) 17 | { 18 | if (package == null) 19 | { 20 | throw new ArgumentNullException("package"); 21 | } 22 | 23 | this.package = package; 24 | 25 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 26 | if (commandService != null) 27 | { 28 | var menuCommandID = new CommandID(CommandSet, CommandId); 29 | 30 | // Step 1: Add the AllowParams in the .vsct file for the command 31 | 32 | // Step 2: Use an OleMenuCommand, not a MenuCommand 33 | var oleMenuCommand = new OleMenuCommand(this.MenuItemCallback, menuCommandID); 34 | 35 | // Step 3: Initialize the ParametersDescription property to the "$" value. 36 | // That magical value means that the command accepts any kind of values 37 | oleMenuCommand.ParametersDescription = "$"; 38 | 39 | commandService.AddCommand(oleMenuCommand); 40 | } 41 | } 42 | 43 | public static CommandWithArguments Instance 44 | { 45 | get; 46 | private set; 47 | } 48 | 49 | private IServiceProvider ServiceProvider 50 | { 51 | get 52 | { 53 | return this.package; 54 | } 55 | } 56 | 57 | public static void Initialize(Package package) 58 | { 59 | Instance = new CommandWithArguments(package); 60 | } 61 | 62 | private void MenuItemCallback(object sender, EventArgs e) 63 | { 64 | string message; 65 | string title = "CommandWithArguments"; 66 | string argumentValue = ""; 67 | 68 | // Step 4: Cast EventArgs to OleMenuCmdEventArgs to get the argument value 69 | var oleMenuCmdEventArgs = e as OleMenuCmdEventArgs; 70 | 71 | if (oleMenuCmdEventArgs.InValue != null) 72 | { 73 | argumentValue = oleMenuCmdEventArgs.InValue.ToString(); 74 | } 75 | message = $"Inside {this.GetType().FullName}.MenuItemCallback() called with value {argumentValue}'"; 76 | 77 | // Show a message box to prove we were here 78 | VsShellUtilities.ShowMessageBox( 79 | this.ServiceProvider, 80 | message, 81 | title, 82 | OLEMSGICON.OLEMSGICON_INFO, 83 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 84 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandWithArguments/CommandWithArguments/Key.snk -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommandWithArguments")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommandWithArguments")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/Resources/VSPackageCommandWithArguments.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/CommandWithArguments/CommandWithArguments/Resources/VSPackageCommandWithArguments.ico -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/VSPackageCommandWithArguments.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace CommandWithArguments 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageCommandWithArguments.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | public sealed class VSPackageCommandWithArguments : Package 14 | { 15 | public const string PackageGuidString = "8c756339-2f14-43b7-becc-5da3c229ad49"; 16 | 17 | public VSPackageCommandWithArguments() 18 | { 19 | } 20 | 21 | #region Package Members 22 | 23 | protected override void Initialize() 24 | { 25 | base.Initialize(); 26 | CommandWithArguments.Initialize(this); 27 | } 28 | 29 | #endregion 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/VSPackageCommandWithArguments.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CommandWithArguments 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CommandWithArguments/CommandWithArguments/stylesheet.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | border: 0; 5 | color: #1E1E1E; 6 | font-size: 13px; 7 | font-family: "Segoe UI", Helvetica, Arial, sans-serif; 8 | line-height: 1.45; 9 | word-wrap: break-word; 10 | } 11 | 12 | /* General & 'Reset' Stuff */ 13 | 14 | 15 | .container { 16 | width: 980px; 17 | margin: 0 auto; 18 | } 19 | 20 | section { 21 | display: block; 22 | margin: 0; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | margin: 0; 27 | } 28 | 29 | /* Header,
30 | header - container 31 | h1 - project name 32 | h2 - project description 33 | */ 34 | 35 | #header { 36 | color: #FFF; 37 | background: #68217a; 38 | position:relative; 39 | } 40 | #hangcloud { 41 | width: 190px; 42 | height: 160px; 43 | background: url("../images/bannerart03.png"); 44 | position: absolute; 45 | top: 0; 46 | right: -30px; 47 | } 48 | h1, h2 { 49 | font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif; 50 | line-height: 1; 51 | margin: 0 18px; 52 | padding: 0; 53 | } 54 | #header h1 { 55 | font-size: 3.4em; 56 | padding-top: 18px; 57 | font-weight: normal; 58 | margin-left: 15px; 59 | } 60 | 61 | #header h2 { 62 | font-size: 1.5em; 63 | margin-top: 10px; 64 | padding-bottom: 18px; 65 | font-weight: normal; 66 | } 67 | 68 | 69 | #main_content { 70 | width: 100%; 71 | display: flex; 72 | flex-direction: row; 73 | } 74 | 75 | 76 | h1, h2, h3, h4, h5, h6 { 77 | font-weight: bolder; 78 | } 79 | 80 | #main_content h1 { 81 | font-size: 1.8em; 82 | margin-top: 34px; 83 | } 84 | 85 | #main_content h1:first-child { 86 | margin-top: 30px; 87 | } 88 | 89 | #main_content h2 { 90 | font-size: 1.4em; 91 | font-weight: bold; 92 | } 93 | p, ul { 94 | margin: 11px 18px; 95 | } 96 | 97 | #main_content a { 98 | color: #06C; 99 | text-decoration: none; 100 | } 101 | ul { 102 | margin-top: 13px; 103 | margin-left: 18px; 104 | padding-left: 0; 105 | } 106 | ul li { 107 | margin-left: 18px; 108 | padding-left: 0; 109 | } 110 | #lpanel { 111 | width: 620px; 112 | float: left; 113 | } 114 | #rpanel ul { 115 | list-style-type: none; 116 | width: 300px; 117 | } 118 | #rpanel ul li { 119 | line-height: 1.8em; 120 | } 121 | #rpanel { 122 | background: #e7e7e7; 123 | width: 360px; 124 | float: right; 125 | } 126 | 127 | #rpanel div { 128 | width: 300px; 129 | } 130 | -------------------------------------------------------------------------------- /CommandWithArguments/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio command that accepts arguments 2 | ============================================================ 3 | 4 | By default, the commands that you create for Visual Studio don't accept parameters 5 | 6 | To accept parameters, four steps are required: 7 | 8 | * Step 1: Add the AllowParams command flag in the .vsct file for the command 9 | * Step 2: When creating the menu command, use an OleMenuCommand type, not a MenuCommand type 10 | * Step 3: Fill the ParametersDescription property of the OleMenuCommand with the magical value "$" 11 | * Step 4: In the MenuItemCallback method, cast EventArgs to OleMenuCmdEventArgs to get the argument value 12 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContextMenu", "ContextMenu\ContextMenu.csproj", "{352B51A5-9D6D-43F7-87E7-4C93CB42FA2F}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{115DD776-C1BE-468F-BE45-91A7A8539119}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {352B51A5-9D6D-43F7-87E7-4C93CB42FA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {352B51A5-9D6D-43F7-87E7-4C93CB42FA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {352B51A5-9D6D-43F7-87E7-4C93CB42FA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {352B51A5-9D6D-43F7-87E7-4C93CB42FA2F}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Commands/Command1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace ContextMenu 8 | { 9 | internal sealed class Command1 10 | { 11 | // Warning!!: Keep these values in sync with the .vsct file 12 | public const int CommandId = 0x0101; 13 | public static readonly Guid CommandSet = new Guid("c1a3a312-e25a-4cd1-b557-011428323a99"); 14 | 15 | private readonly Package package; 16 | 17 | private Command1(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command1 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command1(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command1"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Commands/Command2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace ContextMenu 8 | { 9 | internal sealed class Command2 10 | { 11 | // Warning!!: Keep these values in sync with the .vsct file 12 | public const int CommandId = 0x0102; 13 | public static readonly Guid CommandSet = new Guid("c1a3a312-e25a-4cd1-b557-011428323a99"); 14 | 15 | private readonly Package package; 16 | 17 | private Command2(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static Command2 Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new Command2(package); 52 | } 53 | 54 | private void MenuItemCallback(object sender, EventArgs e) 55 | { 56 | string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 57 | string title = "Command2"; 58 | 59 | // Show a message box to prove we were here 60 | VsShellUtilities.ShowMessageBox( 61 | this.ServiceProvider, 62 | message, 63 | title, 64 | OLEMSGICON.OLEMSGICON_INFO, 65 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 66 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Commands/ToolWindowCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace ContextMenu 8 | { 9 | internal sealed class ToolWindowCommand 10 | { 11 | // Warning!!: Keep these values in sync with the .vsct file 12 | public const int CommandId = 0x0100; 13 | public static readonly Guid CommandSet = new Guid("c1a3a312-e25a-4cd1-b557-011428323a99"); 14 | 15 | private readonly Package package; 16 | 17 | private ToolWindowCommand(Package package) 18 | { 19 | if (package == null) 20 | { 21 | throw new ArgumentNullException("package"); 22 | } 23 | 24 | this.package = package; 25 | 26 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 27 | if (commandService != null) 28 | { 29 | var menuCommandID = new CommandID(CommandSet, CommandId); 30 | var menuItem = new MenuCommand(this.ShowToolWindow, menuCommandID); 31 | commandService.AddCommand(menuItem); 32 | } 33 | } 34 | 35 | public static ToolWindowCommand Instance 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | private IServiceProvider ServiceProvider 42 | { 43 | get 44 | { 45 | return this.package; 46 | } 47 | } 48 | 49 | public static void Initialize(Package package) 50 | { 51 | Instance = new ToolWindowCommand(package); 52 | } 53 | 54 | private void ShowToolWindow(object sender, EventArgs e) 55 | { 56 | // Get the instance number 0 of this tool window. This window is single instance so this instance 57 | // is actually the only one. 58 | // The last flag is set to true so that if the tool window does not exists it will be created. 59 | ToolWindowPane window = this.package.FindToolWindow(typeof(MyToolWindow), 0, true); 60 | if ((null == window) || (null == window.Frame)) 61 | { 62 | throw new NotSupportedException("Cannot create tool window"); 63 | } 64 | 65 | IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; 66 | Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/ContextMenu/ContextMenu/Key.snk -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/MyToolWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Microsoft.VisualStudio.Shell; 4 | 5 | namespace ContextMenu 6 | { 7 | [Guid("f45e20ff-639e-4954-9e1a-d4767f5662ed")] 8 | public class MyToolWindow : ToolWindowPane 9 | { 10 | private ToolWindowControl m_toolWindowControl; 11 | 12 | public MyToolWindow() : base(null) 13 | { 14 | this.Caption = "My toolwindow"; 15 | 16 | m_toolWindowControl = new ToolWindowControl(); 17 | 18 | this.Content = m_toolWindowControl; 19 | } 20 | 21 | public override void OnToolWindowCreated() 22 | { 23 | VSPackageContextMenu package; 24 | 25 | base.OnToolWindowCreated(); 26 | 27 | package = (VSPackageContextMenu)base.Package; 28 | 29 | m_toolWindowControl.Initialize(package); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ContextMenu")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ContextMenu")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Resources/Images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/ContextMenu/ContextMenu/Resources/Images.png -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/Resources/VSPackageContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/ContextMenu/ContextMenu/Resources/VSPackageContextMenu.ico -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/ToolWindowControl.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/ToolWindowControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell.Interop; 2 | using System.Windows.Controls; 3 | 4 | namespace ContextMenu 5 | { 6 | public partial class ToolWindowControl : UserControl 7 | { 8 | private VSPackageContextMenu m_package; 9 | 10 | public ToolWindowControl() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | 15 | public void Initialize(VSPackageContextMenu package) 16 | { 17 | m_package = package; 18 | } 19 | 20 | private void frame_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) 21 | { 22 | // Warning!!: Keep these values in sync with the .vsct file 23 | const string guidVSPackageContextMenuCmdSet = "c1a3a312-e25a-4cd1-b557-011428323a99"; 24 | const int MyContextMenuId = 0x0200; 25 | 26 | System.IServiceProvider serviceProvider; 27 | IVsUIShell uiShell; 28 | System.Guid contextMenuGuid = new System.Guid(guidVSPackageContextMenuCmdSet); 29 | System.Windows.Point relativePoint; 30 | System.Windows.Point screenPoint; 31 | POINTS point; 32 | POINTS[] points; 33 | 34 | if (e.ChangedButton == System.Windows.Input.MouseButton.Right) 35 | { 36 | serviceProvider = (System.IServiceProvider)m_package; 37 | uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; 38 | 39 | if (uiShell != null) 40 | { 41 | relativePoint = e.GetPosition(this); 42 | screenPoint = this.PointToScreen(relativePoint); 43 | 44 | point = new POINTS(); 45 | point.x = (short)screenPoint.X; 46 | point.y = (short)screenPoint.Y; 47 | 48 | points = new[] { point }; 49 | 50 | // TODO: error handling 51 | uiShell.ShowContextMenu(0, ref contextMenuGuid, MyContextMenuId, points, null); 52 | } 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/VSPackageContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace ContextMenu 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true)] 9 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 10 | [Guid(VSPackageContextMenu.PackageGuidString)] 11 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | [ProvideToolWindow(typeof(MyToolWindow))] 14 | public sealed class VSPackageContextMenu : Package 15 | { 16 | public const string PackageGuidString = "9a1f0ba6-7996-44d1-bf23-712cf7adbcf6"; 17 | 18 | public VSPackageContextMenu() 19 | { 20 | } 21 | 22 | protected override void Initialize() 23 | { 24 | base.Initialize(); 25 | ToolWindowCommand.Initialize(this); 26 | Command1.Initialize(this); 27 | Command2.Initialize(this); 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ContextMenu/ContextMenu/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | ContextMenu 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ContextMenu/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Create a Visual Studio context menu 2 | ========================================== 3 | 4 | Demonstrates how to create a context menu that is shown when right-clicking on a toolwindow. 5 | 6 | To show the toolwindow click the View > Other Windows > My toolwindow command. -------------------------------------------------------------------------------- /DtePackage/DtePackage.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DtePackage", "DtePackage\DtePackage.csproj", "{0A88B05C-428C-4AE0-9EE8-2776577C8537}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C9924E47-95C0-4D3C-9033-7E938ACC236F}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {0A88B05C-428C-4AE0-9EE8-2776577C8537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {0A88B05C-428C-4AE0-9EE8-2776577C8537}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {0A88B05C-428C-4AE0-9EE8-2776577C8537}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {0A88B05C-428C-4AE0-9EE8-2776577C8537}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /DtePackage/DtePackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/DtePackage/DtePackage/Key.snk -------------------------------------------------------------------------------- /DtePackage/DtePackage/MyPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using Microsoft.VisualStudio; 6 | 7 | namespace DtePackage 8 | { 9 | [PackageRegistration(UseManagedResourcesOnly = true)] 10 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 11 | [Guid(MyPackage.PackageGuidString)] 12 | [ProvideAutoLoad(Microsoft.VisualStudio.VSConstants.UICONTEXT.NoSolution_string)] 13 | public sealed class MyPackage : Package 14 | { 15 | public const string PackageGuidString = "4d1225ef-ea14-4475-aa8d-19a148cf8c22"; 16 | 17 | internal class DteInitializer : IVsShellPropertyEvents 18 | { 19 | private IVsShell shellService; 20 | private uint cookie; 21 | private Action callback; 22 | 23 | internal DteInitializer(IVsShell shellService, Action callback) 24 | { 25 | int hr; 26 | 27 | this.shellService = shellService; 28 | this.callback = callback; 29 | 30 | // Set an event handler to detect when the IDE is fully initialized 31 | hr = this.shellService.AdviseShellPropertyChanges(this, out this.cookie); 32 | 33 | Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr); 34 | } 35 | 36 | int IVsShellPropertyEvents.OnShellPropertyChange(int propid, object var) 37 | { 38 | int hr; 39 | bool isShellInitialized = false; 40 | 41 | switch (propid) 42 | { 43 | // This was for VS 2005, 2008 44 | //case (int) __VSSPROPID.VSSPROPID_Zombie: 45 | 46 | // isShellInitialized = !(bool)var; 47 | // break; 48 | 49 | // This is for VS 2010 and higher 50 | case (int)__VSSPROPID4.VSSPROPID_ShellInitialized: 51 | 52 | isShellInitialized = (bool)var; 53 | break; 54 | } 55 | 56 | if (isShellInitialized) 57 | { 58 | // Release the event handler to detect when the IDE is fully initialized 59 | hr = this.shellService.UnadviseShellPropertyChanges(this.cookie); 60 | 61 | Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr); 62 | 63 | this.cookie = 0; 64 | 65 | this.callback(); 66 | } 67 | return VSConstants.S_OK; 68 | } 69 | } 70 | 71 | private EnvDTE80.DTE2 m_dte; 72 | private DteInitializer m_dteInitializer; 73 | 74 | 75 | public MyPackage() 76 | { 77 | } 78 | 79 | protected override void Initialize() 80 | { 81 | IVsShell shellService; 82 | 83 | base.Initialize(); 84 | 85 | // Try to retrieve the DTE instance at this point 86 | InitializeDte(); 87 | 88 | // If not retrieved, we must wait for the Visual Studio Shell to be initialized 89 | if (m_dte == null) 90 | { 91 | // Note: if targetting only VS 2015 and higher, we could use this: 92 | // Microsoft.VisualStudio.Shell.KnownUIContexts.ShellInitializedContext.WhenActivated(() => this.InitializeDte()); 93 | 94 | // For VS 2005 and higher, we use this: 95 | shellService = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShell)) as IVsShell; 96 | 97 | m_dteInitializer = new DteInitializer(shellService, this.InitializeDte); 98 | } 99 | } 100 | 101 | private void InitializeDte() 102 | { 103 | m_dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2; 104 | 105 | m_dteInitializer = null; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /DtePackage/DtePackage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DtePackage")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DtePackage")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /DtePackage/DtePackage/Resources/MyPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/DtePackage/DtePackage/Resources/MyPackage.ico -------------------------------------------------------------------------------- /DtePackage/DtePackage/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DtePackage/DtePackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | DtePackage 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /DtePackage/DtePackage/stylesheet.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | border: 0; 5 | color: #1E1E1E; 6 | font-size: 13px; 7 | font-family: "Segoe UI", Helvetica, Arial, sans-serif; 8 | line-height: 1.45; 9 | word-wrap: break-word; 10 | } 11 | 12 | /* General & 'Reset' Stuff */ 13 | 14 | 15 | .container { 16 | width: 980px; 17 | margin: 0 auto; 18 | } 19 | 20 | section { 21 | display: block; 22 | margin: 0; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | margin: 0; 27 | } 28 | 29 | /* Header,
30 | header - container 31 | h1 - project name 32 | h2 - project description 33 | */ 34 | 35 | #header { 36 | color: #FFF; 37 | background: #68217a; 38 | position:relative; 39 | } 40 | #hangcloud { 41 | width: 190px; 42 | height: 160px; 43 | background: url("../images/bannerart03.png"); 44 | position: absolute; 45 | top: 0; 46 | right: -30px; 47 | } 48 | h1, h2 { 49 | font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif; 50 | line-height: 1; 51 | margin: 0 18px;; 52 | padding: 0; 53 | } 54 | #header h1 { 55 | font-size: 3.4em; 56 | padding-top: 18px; 57 | font-weight: normal; 58 | margin-left: 15px; 59 | } 60 | 61 | #header h2 { 62 | font-size: 1.5em; 63 | margin-top: 10px; 64 | padding-bottom: 18px; 65 | font-weight: normal; 66 | } 67 | 68 | 69 | #main_content { 70 | width: 100%; 71 | display: flex; 72 | flex-direction: row; 73 | } 74 | 75 | 76 | h1, h2, h3, h4, h5, h6 { 77 | font-weight: bolder; 78 | } 79 | 80 | #main_content h1 { 81 | font-size: 1.8em; 82 | margin-top: 34px; 83 | } 84 | 85 | #main_content h1:first-child { 86 | margin-top: 30px; 87 | } 88 | 89 | #main_content h2 { 90 | font-size: 1.8em; 91 | } 92 | p, ul { 93 | margin: 11px 18px; 94 | } 95 | 96 | #main_content a { 97 | color: #06C; 98 | text-decoration: none; 99 | } 100 | ul { 101 | margin-top: 13px; 102 | margin-left: 18px; 103 | padding-left: 0; 104 | } 105 | ul li { 106 | margin-left: 18px; 107 | padding-left: 0; 108 | } 109 | #lpanel { 110 | width: 620px; 111 | float: left; 112 | } 113 | #rpanel ul { 114 | list-style-type: none; 115 | } 116 | #rpanel ul li { 117 | line-height: 1.8em; 118 | } 119 | #rpanel { 120 | background: #e7e7e7; 121 | width: 360px; 122 | } 123 | -------------------------------------------------------------------------------- /DtePackage/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Get the EnvDTE.DTE instance from a package 2 | ================================================= 3 | 4 | Although a package can use Visual Studio services, sometimes it may need to use the 5 | automation model (EnvDTE). To get the EnvDTE.DTE instance, you can use the SDTE service: 6 | 7 | ```C# 8 | EnvDTE80.DTE2 dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2; 9 | ``` 10 | However, you can get a null instance if your package is loaded very early, for example if it is marked to load on Visual Studio startup. So, 11 | the package should wait until the Visual Studio shell is fully initialized. Across the several Visual Studio versions, the way to get notified 12 | when the shell is fully initialized has changed slightly. This sample shows you the different variations: 13 | 14 | * All Visual Studio versions: use the [IVsShell.AdviseShellPropertyChanges](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsshell.adviseshellpropertychanges.aspx) method and wait for the [__VSSPROPID.VSSPROPID_Zombie](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.__vsspropid.aspx) property value changed. 15 | * Visual Studio 2010 and higher: use the [IVsShell.AdviseShellPropertyChanges](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsshell.adviseshellpropertychanges.aspx) method and wait for the [__VSSPROPID4.VSSPROPID_ShellInitialized](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.__vsspropid4.aspx) property value changed. 16 | * Visual Studio 2015: use the [KnownUIContexts.ShellInitializedContext.WhenActivated](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.knownuicontexts.shellinitializedcontext.aspx) method. 17 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCommandsCreatedByCode", "PackageCommandsCreatedByCode\PackageCommandsCreatedByCode.csproj", "{FC0D3293-8D75-4F83-8CCA-CDC31CE80DFE}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2ED6E63C-2909-4827-BC20-E6FEAAAE633E}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {FC0D3293-8D75-4F83-8CCA-CDC31CE80DFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {FC0D3293-8D75-4F83-8CCA-CDC31CE80DFE}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {FC0D3293-8D75-4F83-8CCA-CDC31CE80DFE}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {FC0D3293-8D75-4F83-8CCA-CDC31CE80DFE}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/Key.snk -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PackageCommandsCreatedByCode")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PackageCommandsCreatedByCode")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/Resources/VSMyPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/Resources/VSMyPackage.ico -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Getting Started 9 | 10 | 11 | 12 |
13 | 17 | 18 |
19 |
20 |

Creating a Visual Studio Extension

21 | 22 |

This VSIX project enables developers to take advantage of the extensibility APIs in the Visual Studio 2015 IDE Software Development Kit. The solution contains a VSIX project that packages the extension into a VSIX file. This file is used to install an extension for Visual Studio.

23 |

To add new features to the extension:

24 | 25 |
    26 |
  1. Right-click the project node in Solution Explorer and select Add>New Item.
  2. 27 |
  3. In the Add New Item dialog box, expand the Extensibility node under Visual C# or Visual Basic.
  4. 28 |
  5. Choose from the available Item templates: Visual Studio Package, Editor Items (Classifier, Margin, Text Adornment, Viewport Adornment), Commands, Tool Window, etc., and then click Add.
  6. 29 |
30 | 31 |

The files for the template that you selected are added to the project. You can start adding functionality to your item template, press F5 to run the project, or add another Item template.

32 | 33 |

To run the project, press F5. Visual Studio will:

34 | 35 |
    36 |
  • Build the extension from the VSIX project.
  • 37 |
  • Create the VSIX package from the VSIX project.
  • 38 |
  • When debugging, start an experimental instance of Visual Studio with the VSIX package installed.
  • 39 |
40 | 41 |

In the experimental instance of Visual Studio you can test out the functionality of your extension without affecting your Visual Studio installation.

42 | 43 |
44 |
45 | 46 |

Visual Studio Extensibility Resources

47 | 48 |

Check out the VS Extensibility Dev Center, the extensibility samples, and the extensibility documentation to learn more about building extensions.

49 | 50 |

Community Extensions

51 | 52 |

Here you can see other extensions that the Visual Studio Community has developed

53 | 54 | 80 |

Give us feedback

81 |

UserVoice

82 |
83 |
84 |
85 | 86 | 87 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | PackageCommandsCreatedByCode 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/PackageCommandsCreatedByCode/stylesheet.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | border: 0; 5 | color: #1E1E1E; 6 | font-size: 13px; 7 | font-family: "Segoe UI", Helvetica, Arial, sans-serif; 8 | line-height: 1.45; 9 | word-wrap: break-word; 10 | } 11 | 12 | /* General & 'Reset' Stuff */ 13 | 14 | 15 | .container { 16 | width: 980px; 17 | margin: 0 auto; 18 | } 19 | 20 | section { 21 | display: block; 22 | margin: 0; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | margin: 0; 27 | } 28 | 29 | /* Header,
30 | header - container 31 | h1 - project name 32 | h2 - project description 33 | */ 34 | 35 | #header { 36 | color: #FFF; 37 | background: #68217a; 38 | position:relative; 39 | } 40 | #hangcloud { 41 | width: 190px; 42 | height: 160px; 43 | background: url("../images/bannerart03.png"); 44 | position: absolute; 45 | top: 0; 46 | right: -30px; 47 | } 48 | h1, h2 { 49 | font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif; 50 | line-height: 1; 51 | margin: 0 18px;; 52 | padding: 0; 53 | } 54 | #header h1 { 55 | font-size: 3.4em; 56 | padding-top: 18px; 57 | font-weight: normal; 58 | margin-left: 15px; 59 | } 60 | 61 | #header h2 { 62 | font-size: 1.5em; 63 | margin-top: 10px; 64 | padding-bottom: 18px; 65 | font-weight: normal; 66 | } 67 | 68 | 69 | #main_content { 70 | width: 100%; 71 | display: flex; 72 | flex-direction: row; 73 | } 74 | 75 | 76 | h1, h2, h3, h4, h5, h6 { 77 | font-weight: bolder; 78 | } 79 | 80 | #main_content h1 { 81 | font-size: 1.8em; 82 | margin-top: 34px; 83 | } 84 | 85 | #main_content h1:first-child { 86 | margin-top: 30px; 87 | } 88 | 89 | #main_content h2 { 90 | font-size: 1.8em; 91 | } 92 | p, ul { 93 | margin: 11px 18px; 94 | } 95 | 96 | #main_content a { 97 | color: #06C; 98 | text-decoration: none; 99 | } 100 | ul { 101 | margin-top: 13px; 102 | margin-left: 18px; 103 | padding-left: 0; 104 | } 105 | ul li { 106 | margin-left: 18px; 107 | padding-left: 0; 108 | } 109 | #lpanel { 110 | width: 620px; 111 | float: left; 112 | } 113 | #rpanel ul { 114 | list-style-type: none; 115 | } 116 | #rpanel ul li { 117 | line-height: 1.8em; 118 | } 119 | #rpanel { 120 | background: #e7e7e7; 121 | width: 360px; 122 | } 123 | -------------------------------------------------------------------------------- /PackageCommandsCreatedByCode/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Package with commands created by code 2 | ===================================== 3 | 4 | While most of the time a package will create its commands using a .vsct file, so that they are also added to commandbars, menus, etc. there may be situations in which a package 5 | needs to create a command by code dynamically, even without knowing the command name at compile time. 6 | 7 | If you have used add-ins (EnvDTE), you know that add-ins create commands always by code, using the [EnvDTE.Commands.AddNamedCommand](https://msdn.microsoft.com/en-us/library/envdte.commands.addnamedcommand.aspx). While you can get an instance 8 | even from a package, you can not use that method from a package because its first parameter is an EnvDTE.AddIn instance. 9 | 10 | To create commands by code from a package, you need to use the native services, specifically the [AddNamedCommand method of the IVsProfferCommands interface](https://msdn.microsoft.com/en-us/library/envdte.ivsproffercommands.addnamedcommand.aspx). 11 | 12 | In this sample a package will create two commands by code at run-time. Rather than using the EnvDTE.IVsProfferCommands or EnvDTE80.IVsProfferCommands2 interfaces, 13 | the [Microsoft.VisualStudio.Shell.Interop.IVsProfferCommands3](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsproffercommands3.aspx) interface 14 | will be used, to avoid completely dependencies on the automation model references (EnvDTE). 15 | 16 | **Note**: this sample only works on Visual Studio 2015. On previous versions of Visual Studio there is a bug that prevents enabling the commands, so they remain always disabled. -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/DebuggerVisualizer/DebuggerVisualizer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9D3D74D1-1A50-455F-88E9-C2BA078113C6} 8 | Library 9 | Properties 10 | DebuggerVisualizer 11 | DebuggerVisualizer 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/DebuggerVisualizer/DummyDebuggerVisualizer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace DebuggerVisualizer 3 | { 4 | public class DummyDebuggerVisualizer 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/DebuggerVisualizer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DebuggerVisualizer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DebuggerVisualizer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9d3d74d1-1a50-455f-88e9-c2ba078113c6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/README.md: -------------------------------------------------------------------------------- 1 | VSIX Debugger Visualizer 2 | ======================== 3 | 4 | According to the MSDN documentation ([How to: Install a Visualizer](https://msdn.microsoft.com/en-us/library/sb2yca43.aspx)), to install a Visual Studio debugger visualizer you must copy the DLL to either of the following locations: 5 | 6 | * \\Common7\Packages\Debugger\Visualizers 7 | * My Documents\\\\Visualizers 8 | 9 | While that approach is simple to do by hand, you may want something more automatic. This sample shows an approach to install a Visual Studio debugger visualizer using VSIX, the same deployment technology used to install packages, MEF components, etc. 10 | 11 | To approach to use VSIX is the following: 12 | 13 | * You create a solution with two projects: one for the debugger visualizer and another for a VSIX package. 14 | * You create a minimal package without user interface whose only purpose is to deploy the debugger visualizer dll in the suitable folder. 15 | * The project with the package references the project with the debugger visualizer, so that the compiled dll is included in the VSIX. 16 | * The package is marked to load on Visual Studio startup. It happens that Visual Studio loads packages marked to load on startup so early that there is no danger that the debugger visualizer is already in use. 17 | * When loaded, the package obtains the "My Documents\\\\Visualizers" installation folder for visualizers (using the [IVsShell.GetProperty](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsshell.getproperty.aspx) method with the [__VSSPROPID2.VSSPROPID_VisualStudioDir](https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.__vsspropid2.aspx) property, concatenating the "Visualizers" subfolder). Copying files to this folder doesn't require admin rights. 18 | * Then it checks if there is already a dll for the debugger visualizer in that folder: if there is no dll, it copies it. Otherwise, it checks if the version of the installed dll is older than the one being deployed. 19 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/VSIXDebuggerVisualizer/VSIX/Key.snk -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("VSIX")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("VSIX")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/Resources/VSIXPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/VSIXDebuggerVisualizer/VSIX/Resources/VSIXPackage.ico -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/VSIXPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using System.IO; 6 | using System.Diagnostics; 7 | 8 | namespace VSIX 9 | { 10 | [PackageRegistration(UseManagedResourcesOnly = true)] 11 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] 12 | [Guid(VSIXPackage.PackageGuidString)] 13 | [ProvideAutoLoad(Microsoft.VisualStudio.VSConstants.UICONTEXT.NoSolution_string)] 14 | public sealed class VSIXPackage : Package 15 | { 16 | public const string PackageGuidString = "e9737e5e-4cbf-4c0c-91d7-d40f96839286"; 17 | 18 | public VSIXPackage() 19 | { 20 | } 21 | 22 | // This method is called when VS loads because this package is marked with ProvideAutoLoad attribute 23 | protected override void Initialize() 24 | { 25 | const string PAYLOAD_FILE_NAME = "DebuggerVisualizer.dll"; 26 | 27 | string sourceFolderFullName; 28 | string destinationFolderFullName; 29 | string sourceFileFullName; 30 | string destinationFileFullName; 31 | IVsShell shell; 32 | object documentsFolderFullNameObject = null; 33 | string documentsFolderFullName; 34 | 35 | try 36 | { 37 | base.Initialize(); 38 | 39 | // The Visualizer dll is in the same folder than the package because its project is added as reference to this project, 40 | // so it is included inside the .vsix file. We only need to deploy it to the correct destination folder. 41 | sourceFolderFullName = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 42 | 43 | // Get the destination folder for visualizers 44 | shell = base.GetService(typeof(SVsShell)) as IVsShell; 45 | shell.GetProperty((int)__VSSPROPID2.VSSPROPID_VisualStudioDir, out documentsFolderFullNameObject); 46 | documentsFolderFullName = documentsFolderFullNameObject.ToString(); 47 | destinationFolderFullName = Path.Combine(documentsFolderFullName, "Visualizers"); 48 | 49 | sourceFileFullName = Path.Combine(sourceFolderFullName, PAYLOAD_FILE_NAME); 50 | destinationFileFullName = Path.Combine(destinationFolderFullName, PAYLOAD_FILE_NAME); 51 | 52 | CopyFileIfNewerVersion(sourceFileFullName, destinationFileFullName); 53 | } 54 | catch (Exception ex) 55 | { 56 | // TODO: Handle exception 57 | System.Diagnostics.Debug.WriteLine(ex.ToString()); 58 | } 59 | } 60 | 61 | private void CopyFileIfNewerVersion(string sourceFileFullName, string destinationFileFullName) 62 | { 63 | FileVersionInfo destinationFileVersionInfo; 64 | FileVersionInfo sourceFileVersionInfo; 65 | bool copy = false; 66 | 67 | if (File.Exists(destinationFileFullName)) 68 | { 69 | sourceFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(sourceFileFullName); 70 | destinationFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(destinationFileFullName); 71 | if (sourceFileVersionInfo.FileMajorPart > destinationFileVersionInfo.FileMajorPart) 72 | { 73 | copy = true; 74 | } 75 | else if (sourceFileVersionInfo.FileMajorPart == destinationFileVersionInfo.FileMajorPart 76 | && sourceFileVersionInfo.FileMinorPart > destinationFileVersionInfo.FileMinorPart) 77 | { 78 | copy = true; 79 | } 80 | } 81 | else 82 | { 83 | // First time 84 | copy = true; 85 | } 86 | 87 | if (copy) 88 | { 89 | File.Copy(sourceFileFullName, destinationFileFullName, true); 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | VSIX 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIX/stylesheet.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | border: 0; 5 | color: #1E1E1E; 6 | font-size: 13px; 7 | font-family: "Segoe UI", Helvetica, Arial, sans-serif; 8 | line-height: 1.45; 9 | word-wrap: break-word; 10 | } 11 | 12 | /* General & 'Reset' Stuff */ 13 | 14 | 15 | .container { 16 | width: 980px; 17 | margin: 0 auto; 18 | } 19 | 20 | section { 21 | display: block; 22 | margin: 0; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | margin: 0; 27 | } 28 | 29 | /* Header,
30 | header - container 31 | h1 - project name 32 | h2 - project description 33 | */ 34 | 35 | #header { 36 | color: #FFF; 37 | background: #68217a; 38 | position:relative; 39 | } 40 | #hangcloud { 41 | width: 190px; 42 | height: 160px; 43 | background: url("../images/bannerart03.png"); 44 | position: absolute; 45 | top: 0; 46 | right: -30px; 47 | } 48 | h1, h2 { 49 | font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif; 50 | line-height: 1; 51 | margin: 0 18px;; 52 | padding: 0; 53 | } 54 | #header h1 { 55 | font-size: 3.4em; 56 | padding-top: 18px; 57 | font-weight: normal; 58 | margin-left: 15px; 59 | } 60 | 61 | #header h2 { 62 | font-size: 1.5em; 63 | margin-top: 10px; 64 | padding-bottom: 18px; 65 | font-weight: normal; 66 | } 67 | 68 | 69 | #main_content { 70 | width: 100%; 71 | display: flex; 72 | flex-direction: row; 73 | } 74 | 75 | 76 | h1, h2, h3, h4, h5, h6 { 77 | font-weight: bolder; 78 | } 79 | 80 | #main_content h1 { 81 | font-size: 1.8em; 82 | margin-top: 34px; 83 | } 84 | 85 | #main_content h1:first-child { 86 | margin-top: 30px; 87 | } 88 | 89 | #main_content h2 { 90 | font-size: 1.8em; 91 | } 92 | p, ul { 93 | margin: 11px 18px; 94 | } 95 | 96 | #main_content a { 97 | color: #06C; 98 | text-decoration: none; 99 | } 100 | ul { 101 | margin-top: 13px; 102 | margin-left: 18px; 103 | padding-left: 0; 104 | } 105 | ul li { 106 | margin-left: 18px; 107 | padding-left: 0; 108 | } 109 | #lpanel { 110 | width: 620px; 111 | float: left; 112 | } 113 | #rpanel ul { 114 | list-style-type: none; 115 | } 116 | #rpanel ul li { 117 | line-height: 1.8em; 118 | } 119 | #rpanel { 120 | background: #e7e7e7; 121 | width: 360px; 122 | } 123 | -------------------------------------------------------------------------------- /VSIXDebuggerVisualizer/VSIXDebuggerVisualizer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebuggerVisualizer", "DebuggerVisualizer\DebuggerVisualizer.csproj", "{9D3D74D1-1A50-455F-88E9-C2BA078113C6}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSIX", "VSIX\VSIX.csproj", "{99B07107-05CB-4818-BA75-BC225D172B20}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A06C7603-1E9E-4C97-B28B-3261AC15F855}" 11 | ProjectSection(SolutionItems) = preProject 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {9D3D74D1-1A50-455F-88E9-C2BA078113C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {9D3D74D1-1A50-455F-88E9-C2BA078113C6}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {9D3D74D1-1A50-455F-88E9-C2BA078113C6}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {9D3D74D1-1A50-455F-88E9-C2BA078113C6}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {99B07107-05CB-4818-BA75-BC225D172B20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {99B07107-05CB-4818-BA75-BC225D172B20}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {99B07107-05CB-4818-BA75-BC225D172B20}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {99B07107-05CB-4818-BA75-BC225D172B20}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/README.md: -------------------------------------------------------------------------------- 1 | HOWTO: Localize a Visual Studio package and its VSIX 2 | ==================================================== 3 | 4 | This sample shows how to localize: 5 | 6 | * The .vsct files of the commands of a package 7 | * The .resx files of the package 8 | * The .vsix file 9 | 10 | References: 11 | 12 | Localizing Menu Commands 13 | (https://msdn.microsoft.com/en-us/library/ee943168.aspx) 14 | 15 | Localizing VSIX Packages 16 | (https://msdn.microsoft.com/en-us/library/dd997147.aspx) 17 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26127.3 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSIXLocalizedPackage", "VSIXLocalizedPackage\VSIXLocalizedPackage.csproj", "{44ADEEBC-69B3-450F-B873-CACD41E21C98}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F3EF0DEE-F955-43B0-AE51-D48993F616D4}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {44ADEEBC-69B3-450F-B873-CACD41E21C98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {44ADEEBC-69B3-450F-B873-CACD41E21C98}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {44ADEEBC-69B3-450F-B873-CACD41E21C98}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {44ADEEBC-69B3-450F-B873-CACD41E21C98}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/VSIXLocalizedPackage/VSIXLocalizedPackage/Key.snk -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/MyCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Company. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | using System; 8 | using System.ComponentModel.Design; 9 | using System.Globalization; 10 | using Microsoft.VisualStudio.Shell; 11 | using Microsoft.VisualStudio.Shell.Interop; 12 | 13 | namespace VSIXLocalizedPackage 14 | { 15 | /// 16 | /// Command handler 17 | /// 18 | internal sealed class MyCommand 19 | { 20 | /// 21 | /// Command ID. 22 | /// 23 | public const int CommandId = 0x0100; 24 | 25 | /// 26 | /// Command menu group (command set GUID). 27 | /// 28 | public static readonly Guid CommandSet = new Guid("edc10475-baa3-4e7b-8145-7ae9d49c303d"); 29 | 30 | /// 31 | /// VS Package that provides this command, not null. 32 | /// 33 | private readonly Package package; 34 | 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// Adds our command handlers for menu (commands must exist in the command table file) 38 | /// 39 | /// Owner package, not null. 40 | private MyCommand(Package package) 41 | { 42 | if (package == null) 43 | { 44 | throw new ArgumentNullException("package"); 45 | } 46 | 47 | this.package = package; 48 | 49 | OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 50 | if (commandService != null) 51 | { 52 | var menuCommandID = new CommandID(CommandSet, CommandId); 53 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 54 | commandService.AddCommand(menuItem); 55 | } 56 | } 57 | 58 | /// 59 | /// Gets the instance of the command. 60 | /// 61 | public static MyCommand Instance 62 | { 63 | get; 64 | private set; 65 | } 66 | 67 | /// 68 | /// Gets the service provider from the owner package. 69 | /// 70 | private IServiceProvider ServiceProvider 71 | { 72 | get 73 | { 74 | return this.package; 75 | } 76 | } 77 | 78 | /// 79 | /// Initializes the singleton instance of the command. 80 | /// 81 | /// Owner package, not null. 82 | public static void Initialize(Package package) 83 | { 84 | Instance = new MyCommand(package); 85 | } 86 | 87 | /// 88 | /// This function is the callback used to execute the command when the menu item is clicked. 89 | /// See the constructor to see how the menu item is associated with this function using 90 | /// OleMenuCommandService service and MenuCommand class. 91 | /// 92 | /// Event sender. 93 | /// Event args. 94 | private void MenuItemCallback(object sender, EventArgs e) 95 | { 96 | string message = string.Format(CultureInfo.CurrentCulture, "{0}.MenuItemCallback()", this.GetType().FullName); 97 | string title = "MyCommand"; 98 | 99 | // Show a message box to prove we were here 100 | VsShellUtilities.ShowMessageBox( 101 | this.ServiceProvider, 102 | message, 103 | title, 104 | OLEMSGICON.OLEMSGICON_INFO, 105 | OLEMSGBUTTON.OLEMSGBUTTON_OK, 106 | OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("VSIXLocalizedPackage")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("VSIXLocalizedPackage")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 18 | 19 | [assembly: ComVisible(false)] 20 | [assembly: AssemblyVersion("1.0.0.0")] 21 | [assembly: AssemblyFileVersion("1.0.0.0")] 22 | 23 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/Resources/MyCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/VSIXLocalizedPackage/VSIXLocalizedPackage/Resources/MyCommand.png -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/Resources/VSLocalizedPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visualstudioextensibility/VSX-Samples/cb6b9d64342338280282255ba209f80813bbbfa4/VSIXLocalizedPackage/VSIXLocalizedPackage/Resources/VSLocalizedPackage.ico -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/VSLocalizedPackage.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Company. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | using System; 8 | using System.ComponentModel.Design; 9 | using System.Diagnostics; 10 | using System.Diagnostics.CodeAnalysis; 11 | using System.Globalization; 12 | using System.Runtime.InteropServices; 13 | using Microsoft.VisualStudio; 14 | using Microsoft.VisualStudio.OLE.Interop; 15 | using Microsoft.VisualStudio.Shell; 16 | using Microsoft.VisualStudio.Shell.Interop; 17 | using Microsoft.Win32; 18 | 19 | namespace VSIXLocalizedPackage 20 | { 21 | /// 22 | /// This is the class that implements the package exposed by this assembly. 23 | /// 24 | /// 25 | /// 26 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 27 | /// is to implement the IVsPackage interface and register itself with the shell. 28 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 29 | /// to do it: it derives from the Package class that provides the implementation of the 30 | /// IVsPackage interface and uses the registration attributes defined in the framework to 31 | /// register itself and its components with the shell. These attributes tell the pkgdef creation 32 | /// utility what data to put into .pkgdef file. 33 | /// 34 | /// 35 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 36 | /// 37 | /// 38 | [PackageRegistration(UseManagedResourcesOnly = true)] 39 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 40 | [Guid(VSLocalizedPackage.PackageGuidString)] 41 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 42 | [ProvideMenuResource("Menus.ctmenu", 1)] 43 | public sealed class VSLocalizedPackage : Package 44 | { 45 | /// 46 | /// VSLocalizedPackage GUID string. 47 | /// 48 | public const string PackageGuidString = "b4283981-f861-4e21-a12d-8f6ea803334d"; 49 | 50 | /// 51 | /// Initializes a new instance of the class. 52 | /// 53 | public VSLocalizedPackage() 54 | { 55 | // Inside this method you can place any initialization code that does not require 56 | // any Visual Studio service because at this point the package object is created but 57 | // not sited yet inside Visual Studio environment. The place to do all the other 58 | // initialization is the Initialize method. 59 | } 60 | 61 | #region Package Members 62 | 63 | /// 64 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 65 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 66 | /// 67 | protected override void Initialize() 68 | { 69 | base.Initialize(); 70 | MyCommand.Initialize(this); 71 | } 72 | 73 | #endregion 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/es-ES/extension.vsixlangpack: -------------------------------------------------------------------------------- 1 |  2 | 3 | VSIXLocalizedPackage (es-ES) 4 | Mi descripción (es-ES). 5 | 6 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /VSIXLocalizedPackage/VSIXLocalizedPackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | VSIXLocalizedPackage (en-US) 6 | My description (en-US). 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------