diff --git a/AsyncToolWindow/.gitattributes b/AsyncToolWindow/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/AsyncToolWindow/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/AsyncToolWindow/.gitignore b/AsyncToolWindow/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/AsyncToolWindow/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/AsyncToolWindow/AsyncToolWindowSample.sln b/AsyncToolWindow/AsyncToolWindowSample.sln new file mode 100644 index 00000000..6db47d48 --- /dev/null +++ b/AsyncToolWindow/AsyncToolWindowSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27716.3005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncToolWindowSample", "src\AsyncToolWindowSample.csproj", "{5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EDE420A2-0953-46FE-B91B-92E19703EE05}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0F64B331-379E-4AD7-94AC-930833EF7C08} + EndGlobalSection +EndGlobal diff --git a/AsyncToolWindow/LICENSE b/AsyncToolWindow/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/AsyncToolWindow/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/AsyncToolWindow/README.md b/AsyncToolWindow/README.md new file mode 100644 index 00000000..89b952f1 --- /dev/null +++ b/AsyncToolWindow/README.md @@ -0,0 +1,39 @@ +# Async Tool Window example + +[![Build status](https://ci.appveyor.com/api/projects/status/eo79i4hqbn4jahqx?svg=true)](https://ci.appveyor.com/project/madskristensen/asynctoolwindowsample) + +**Applies to Visual Studio 2017.6 and newer** + +This sample shows how to provide an Async Tool Window in a Visual Studio extension. + +Clone the repo to test out the sample in Visual Studio 2017 yourself. + +![Tool Window](art/tool-window.png) + +## Specify minimum supported version +Since protocol handler support is new in Visual Studio 2017 Update 6, we need to specify that our extension requires that version or newer. We do that in the .vsixmanifest file like so: + +```xml + +``` + +*15.0.27413* is the full version string of Visual Studio 2017 Update 6. + +See the full sample [.vsixmanifest file](src/source.extension.vsixmanifest). + +## This sample +The code in this sample contains the concepts: + +1. [Custom Tool Window Pane](src/ToolWindows/SampleToolWindow.cs) +2. [XAML control](src/ToolWindows/SampleToolWindowControl.xaml) for the pane +3. [Custom command](src/Commands/ShowToolWindow.cs) that can show the tool window +4. [AsyncPackage class](src/MyPackage.cs) that glues it all together + +Follow the links above directly into the source code to see how it is all hooked up. + +## Further reading +Read the docs for all the details surrounding these scenarios. + +* [VSCT Schema Reference](https://docs.microsoft.com/en-us/visualstudio/extensibility/vsct-xml-schema-reference) +* [Use AsyncPackage with background load](https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background) +* [Custom command sample](https://github.com/madskristensen/CustomCommandSample) \ No newline at end of file diff --git a/AsyncToolWindow/appveyor.yml b/AsyncToolWindow/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/AsyncToolWindow/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/AsyncToolWindow/art/tool-window.png b/AsyncToolWindow/art/tool-window.png new file mode 100644 index 00000000..f15296a0 Binary files /dev/null and b/AsyncToolWindow/art/tool-window.png differ diff --git a/AsyncToolWindow/src/AsyncToolWindowSample.csproj b/AsyncToolWindow/src/AsyncToolWindowSample.csproj new file mode 100644 index 00000000..c60e9bf2 --- /dev/null +++ b/AsyncToolWindow/src/AsyncToolWindowSample.csproj @@ -0,0 +1,234 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {5CE4ED47-6A68-4F09-B0EE-501CACAA3EBD} + Library + Properties + AsyncToolWindowSample + AsyncToolWindowSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + SampleToolWindowControl.xaml + + + + + + Resources\LICENSE + true + + + Menus.ctmenu + + + + Designer + + + + + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.6.27740\lib\net46\Microsoft.VisualStudio.CoreUtility.dll + + + ..\packages\Microsoft.VisualStudio.ImageCatalog.15.6.27413\lib\net45\Microsoft.VisualStudio.ImageCatalog.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.15.6.27413\lib\net45\Microsoft.VisualStudio.Imaging.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.26930\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.6.27413\lib\net45\Microsoft.VisualStudio.Shell.15.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.6.27413\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.15.0.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.15.6.27413\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + + + ..\packages\Microsoft.VisualStudio.Text.Data.15.6.27740\lib\net46\Microsoft.VisualStudio.Text.Data.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Threading.15.6.56\lib\net46\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.6.27413\lib\net46\Microsoft.VisualStudio.Utilities.dll + + + ..\packages\Microsoft.VisualStudio.Validation.15.3.53\lib\net45\Microsoft.VisualStudio.Validation.dll + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + False + + + ..\packages\StreamJsonRpc.1.3.23\lib\net45\StreamJsonRpc.dll + + + + + + + + + + + + + + + true + VSPackage + + + + + true + + + + + Designer + MSBuild:Compile + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + \ No newline at end of file diff --git a/AsyncToolWindow/src/Commands/ShowToolWindow.cs b/AsyncToolWindow/src/Commands/ShowToolWindow.cs new file mode 100644 index 00000000..f74a9e2b --- /dev/null +++ b/AsyncToolWindow/src/Commands/ShowToolWindow.cs @@ -0,0 +1,32 @@ +using System; +using System.ComponentModel.Design; +using AsyncToolWindowSample.ToolWindows; +using Microsoft.VisualStudio.Shell; +using Task = System.Threading.Tasks.Task; + +namespace AsyncToolWindowSample +{ + internal sealed class ShowToolWindow + { + public static async Task InitializeAsync(AsyncPackage package) + { + var commandService = (IMenuCommandService)await package.GetServiceAsync(typeof(IMenuCommandService)); + + var cmdId = new CommandID(Guid.Parse("9cc1062b-4c82-46d2-adcb-f5c17d55fb85"), 0x0100); + var cmd = new MenuCommand((s, e) => Execute(package), cmdId); + commandService.AddCommand(cmd); + } + + private static void Execute(AsyncPackage package) + { + package.JoinableTaskFactory.RunAsync(async () => + { + ToolWindowPane window = await package.ShowToolWindowAsync( + typeof(SampleToolWindow), + 0, + create: true, + cancellationToken: package.DisposalToken); + }); + } + } +} diff --git a/AsyncToolWindow/src/MyPackage.cs b/AsyncToolWindow/src/MyPackage.cs new file mode 100644 index 00000000..160b6f3d --- /dev/null +++ b/AsyncToolWindow/src/MyPackage.cs @@ -0,0 +1,47 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using AsyncToolWindowSample.ToolWindows; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Task = System.Threading.Tasks.Task; + +namespace AsyncToolWindowSample +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("Async Tool Window Sample", "Shows how to use an Async Tool Window in Visual Studio 15.6+", "1.0")] + [ProvideToolWindow(typeof(SampleToolWindow), Style = VsDockStyle.Tabbed, DockedWidth = 300, Window = "DocumentWell", Orientation = ToolWindowOrientation.Left)] + [Guid("6e3b2e95-902b-4385-a966-30c06ab3c7a6")] + [ProvideMenuResource("Menus.ctmenu", 1)] + public sealed class MyPackage : AsyncPackage + { + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(); + await ShowToolWindow.InitializeAsync(this); + } + + public override IVsAsyncToolWindowFactory GetAsyncToolWindowFactory(Guid toolWindowType) + { + return toolWindowType.Equals(Guid.Parse(SampleToolWindow.WindowGuidString)) ? this : null; + } + + protected override string GetToolWindowTitle(Type toolWindowType, int id) + { + return toolWindowType == typeof(SampleToolWindow) ? SampleToolWindow.Title : base.GetToolWindowTitle(toolWindowType, id); + } + + protected override async Task InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken) + { + // Perform as much work as possible in this method which is being run on a background thread. + // The object returned from this method is passed into the constructor of the SampleToolWindow + var dte = await GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; + + return new SampleToolWindowState + { + DTE = dte + }; + } + } +} diff --git a/AsyncToolWindow/src/Properties/AssemblyInfo.cs b/AsyncToolWindow/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0902269c --- /dev/null +++ b/AsyncToolWindow/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AsyncToolWindowSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AsyncToolWindowSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AsyncToolWindow/src/Resources/Icon128x128.png b/AsyncToolWindow/src/Resources/Icon128x128.png new file mode 100644 index 00000000..e54b6fce Binary files /dev/null and b/AsyncToolWindow/src/Resources/Icon128x128.png differ diff --git a/AsyncToolWindow/src/ToolWindows/SampleToolWindow.cs b/AsyncToolWindow/src/ToolWindows/SampleToolWindow.cs new file mode 100644 index 00000000..f76a94f0 --- /dev/null +++ b/AsyncToolWindow/src/ToolWindows/SampleToolWindow.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.InteropServices; +using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Shell; + +namespace AsyncToolWindowSample.ToolWindows +{ + [Guid(WindowGuidString)] + public class SampleToolWindow : ToolWindowPane + { + public const string WindowGuidString = "e4e2ba26-a455-4c53-adb3-8225fb696f8b"; // Replace with new GUID in your own code + public const string Title = "Sample Tool Window"; + + // "state" parameter is the object returned from MyPackage.InitializeToolWindowAsync + public SampleToolWindow(SampleToolWindowState state) : base() + { + Caption = Title; + BitmapImageMoniker = KnownMonikers.ImageIcon; + + Content = new SampleToolWindowControl(state); + } + } +} diff --git a/AsyncToolWindow/src/ToolWindows/SampleToolWindowControl.xaml b/AsyncToolWindow/src/ToolWindows/SampleToolWindowControl.xaml new file mode 100644 index 00000000..fa5c096e --- /dev/null +++ b/AsyncToolWindow/src/ToolWindows/SampleToolWindowControl.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + + + + + diff --git a/AsyncToolWindow/src/VSPackage.resx b/AsyncToolWindow/src/VSPackage.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/AsyncToolWindow/src/VSPackage.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AsyncToolWindow/src/packages.config b/AsyncToolWindow/src/packages.config new file mode 100644 index 00000000..16d4878d --- /dev/null +++ b/AsyncToolWindow/src/packages.config @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AsyncToolWindow/src/source.extension.vsixmanifest b/AsyncToolWindow/src/source.extension.vsixmanifest new file mode 100644 index 00000000..8fa416af --- /dev/null +++ b/AsyncToolWindow/src/source.extension.vsixmanifest @@ -0,0 +1,26 @@ + + + + + Async Tool Window Sample + Shows how to use an Async Tool Window in Visual Studio 15.6+ + https://github.com/madskristensen/AsyncToolWindowSample + Resources\LICENSE + Resources\Icon128x128.png + Resources\Icon128x128.png + toolwindow, sample + + + + + + + + + + + + + + + diff --git a/CustomCommand/.gitattributes b/CustomCommand/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/CustomCommand/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/CustomCommand/.gitignore b/CustomCommand/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/CustomCommand/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/CustomCommand/CustomCommandSample.sln b/CustomCommand/CustomCommandSample.sln new file mode 100644 index 00000000..4b8d3ada --- /dev/null +++ b/CustomCommand/CustomCommandSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27716.3005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomCommandSample", "src\CustomCommandSample.csproj", "{02A96BAA-1270-4A0A-B22F-73E031A855BA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{52A72E6B-9976-4FA8-B887-299D61E87816}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {02A96BAA-1270-4A0A-B22F-73E031A855BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02A96BAA-1270-4A0A-B22F-73E031A855BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02A96BAA-1270-4A0A-B22F-73E031A855BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02A96BAA-1270-4A0A-B22F-73E031A855BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {22ABBD8A-4A67-4928-AD45-AB65D1E3F4C4} + EndGlobalSection +EndGlobal diff --git a/CustomCommand/LICENSE b/CustomCommand/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/CustomCommand/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/CustomCommand/README.md b/CustomCommand/README.md new file mode 100644 index 00000000..f849b9e2 --- /dev/null +++ b/CustomCommand/README.md @@ -0,0 +1,99 @@ +# Custom commands example + +[![Build status](https://ci.appveyor.com/api/projects/status/89s5yj3ya9e1jitg?svg=true)](https://ci.appveyor.com/project/madskristensen/customcommandsample) + +**Applies to Visual Studio 2015 and newer** + +This sample shows how to add your own menu button to Visual Studio. + +Clone the repo to test out the sample in Visual Studio 2017 yourself. + +## What is a command? +A command is code that Visual Studio will execute when it is being invoked. Most common, commands are buttons in menus or toolbars and can have keyboard shortcuts mapped to them. + +![Command](art/command.png) + +It's easy to create commands in a Visual Studio extension. + +## Let's get started +In your VSIX project, add a new item by right-clicking the project and selecting **Add -> New Item...** and then search for and select **Custom Command**. + +This will a bunch of files to your project. The key ones are: + +1. The .vsct file +2. The command Class +3. The Package class + +**The .vsct file** is where we defined what commands we want to add, what their names and icons are and where they are located (what menu or toolbar to add them to). + +```xml + + + + + + + + + +``` + +The XML in the .vsct file specifies a button that is parented to a group, which is parented to a build-in menu - the top level *Tools* menu. + +[See full .vsct file in source](src/VSCommandTable.vsct) + +A button MUST always be inside a group and a group MUST always be inside a menu/toolbar. + +**The command class** contains the code that initializes the command as well as code to be execute when the command is invoked. + +```c# +internal sealed class MyCommand +{ + public static async Task InitializeAsync(AsyncPackage package) + { + var commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; + + var cmdId = new CommandID(Guid.Parse("2b40859b-27f8-4dc6-85b1-f253386aa5f6"), 0x0100); + var cmd = new MenuCommand((s, e) => Execute(package), cmdId); + commandService.AddCommand(cmd); + } + + private static void Execute(AsyncPackage package) + { + // Do something + } +} +``` + +[See full command class in source](src/Commands/MyCommand.cs) + +**The Package class** is initialized automatically the first time the command is being executed. In the package `InitializeAsync` method, the `MyCommand.InitializeAsync(this)` will initialize the command before it is being executed. + +```c# +public sealed class MyPackage : AsyncPackage +{ + [ProvideMenuResource("Menus.ctmenu", 1)] + [Guid("fa24d542-0b4d-4f6b-ac03-24ff47c11b76")] + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + await MyCommand.InitializeAsync(this); + } +} +``` + +[See full Package class in source](src/MyPackage.cs) + +## Further reading +Read the docs for all the details surrounding these scenarios. + +* [VSCT Schema Reference](https://docs.microsoft.com/en-us/visualstudio/extensibility/vsct-xml-schema-reference) +* [Use AsyncPackage with background load](https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background) +* [Use Rule-based UI Context](https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions) +* [VisibilityConstraints sample](https://github.com/madskristensen/VisibilityConstraintsSample) \ No newline at end of file diff --git a/CustomCommand/appveyor.yml b/CustomCommand/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/CustomCommand/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/CustomCommand/art/command.png b/CustomCommand/art/command.png new file mode 100644 index 00000000..afd5fcc9 Binary files /dev/null and b/CustomCommand/art/command.png differ diff --git a/CustomCommand/src/Commands/MyCommand.cs b/CustomCommand/src/Commands/MyCommand.cs new file mode 100644 index 00000000..6d26a563 --- /dev/null +++ b/CustomCommand/src/Commands/MyCommand.cs @@ -0,0 +1,36 @@ +using System; +using System.ComponentModel.Design; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Task = System.Threading.Tasks.Task; + +namespace CustomCommandSample +{ + internal sealed class MyCommand + { + public static async Task InitializeAsync(AsyncPackage package) + { + await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); + + var commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; + + // must match the button GUID and ID specified in the .vsct file + var cmdId = new CommandID(Guid.Parse("2b40859b-27f8-4dc6-85b1-f253386aa5f6"), 0x0100); + var cmd = new MenuCommand((s, e) => Execute(package), cmdId); + commandService.AddCommand(cmd); + } + + private static void Execute(AsyncPackage package) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + VsShellUtilities.ShowMessageBox( + package, + $"Inside {typeof(MyCommand).FullName}.Execute()", + nameof(MyCommand), + OLEMSGICON.OLEMSGICON_INFO, + OLEMSGBUTTON.OLEMSGBUTTON_OK, + OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); + } + } +} diff --git a/CustomCommand/src/CustomCommandSample.csproj b/CustomCommand/src/CustomCommandSample.csproj new file mode 100644 index 00000000..6e67dca5 --- /dev/null +++ b/CustomCommand/src/CustomCommandSample.csproj @@ -0,0 +1,199 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {02A96BAA-1270-4A0A-B22F-73E031A855BA} + Library + Properties + CustomCommandSample + CustomCommandSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + Resources\LICENSE + true + + + + Designer + + + + + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26201\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.15.0.26201\lib\net45\Microsoft.VisualStudio.Imaging.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.26930\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26201\lib\Microsoft.VisualStudio.Shell.15.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.0.26201\lib\net45\Microsoft.VisualStudio.Utilities.dll + + + ..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll + + + False + + + + + + + + + + + Menus.ctmenu + + + + + true + VSPackage + + + + + true + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + \ No newline at end of file diff --git a/CustomCommand/src/MyPackage.cs b/CustomCommand/src/MyPackage.cs new file mode 100644 index 00000000..a840903f --- /dev/null +++ b/CustomCommand/src/MyPackage.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio.Shell; +using Task = System.Threading.Tasks.Task; + +namespace CustomCommandSample +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("Custom Command Sample", "Shows how to hook up a command in VS", "1.0")] + [ProvideMenuResource("Menus.ctmenu", 1)] + [Guid("fa24d542-0b4d-4f6b-ac03-24ff47c11b76")] // must match GUID in the .vsct file + public sealed class MyPackage : AsyncPackage + { + // This method is run automatically the first time the command is being executed + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + await MyCommand.InitializeAsync(this); + } + } +} diff --git a/CustomCommand/src/Properties/AssemblyInfo.cs b/CustomCommand/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ef25a319 --- /dev/null +++ b/CustomCommand/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CustomCommandSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CustomCommandSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CustomCommand/src/Resources/Icon128x128.png b/CustomCommand/src/Resources/Icon128x128.png new file mode 100644 index 00000000..e54b6fce Binary files /dev/null and b/CustomCommand/src/Resources/Icon128x128.png differ diff --git a/CustomCommand/src/VSCommandTable.vsct b/CustomCommand/src/VSCommandTable.vsct new file mode 100644 index 00000000..33c38443 --- /dev/null +++ b/CustomCommand/src/VSCommandTable.vsct @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CustomCommand/src/VSPackage.resx b/CustomCommand/src/VSPackage.resx new file mode 100644 index 00000000..1f2a9e7f --- /dev/null +++ b/CustomCommand/src/VSPackage.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MyCommand Extension + + + MyCommand Visual Studio Extension Detailed Info + + \ No newline at end of file diff --git a/CustomCommand/src/packages.config b/CustomCommand/src/packages.config new file mode 100644 index 00000000..01a7a16c --- /dev/null +++ b/CustomCommand/src/packages.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CustomCommand/src/source.extension.vsixmanifest b/CustomCommand/src/source.extension.vsixmanifest new file mode 100644 index 00000000..31791408 --- /dev/null +++ b/CustomCommand/src/source.extension.vsixmanifest @@ -0,0 +1,26 @@ + + + + + Custom Command Sample + Shows how to hook up a command in VS + https://github.com/madskristensen/CustomCommandSample + Resources\LICENSE + Resources\Icon128x128.png + Resources\Icon128x128.png + sample, command + + + + + + + + + + + + + + + diff --git a/Options/.gitattributes b/Options/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/Options/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/Options/.gitignore b/Options/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/Options/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/Options/LICENSE b/Options/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/Options/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Options/OptionsSample.sln b/Options/OptionsSample.sln new file mode 100644 index 00000000..d1103821 --- /dev/null +++ b/Options/OptionsSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27522.3005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OptionsSample", "src\OptionsSample.csproj", "{EA3FC813-244D-4964-9DC3-774535F41FCC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C1C256BE-5EE4-4CF5-B5E8-F77A7ACEAFEC}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA3FC813-244D-4964-9DC3-774535F41FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA3FC813-244D-4964-9DC3-774535F41FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA3FC813-244D-4964-9DC3-774535F41FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA3FC813-244D-4964-9DC3-774535F41FCC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B976655C-B9F5-4C64-86E7-F8939CCBBA11} + EndGlobalSection +EndGlobal diff --git a/Options/README.md b/Options/README.md new file mode 100644 index 00000000..65e208a7 --- /dev/null +++ b/Options/README.md @@ -0,0 +1,108 @@ +# Options example + +[![Build status](https://ci.appveyor.com/api/projects/status/98lp2282nvh9955r?svg=true)](https://ci.appveyor.com/project/madskristensen/optionssample) + +**Applies to Visual Studio 2015 and newer** + +This sample shows how to correctly specify and consume options for a Visual Studio extension that is both thread-safe and performant. + +The goal is to use best practices to achieve the following: + +* A simple way to provide custom options +* Expose the options in the **Tools -> Options** dialog +* Thread-safe way to access and modify the settings +* Both synchronous and asyncronous support +* No need to load the package for the settings to initialize + +## Let's get started +The source code in this sample adds two options pages to the **Tools -> Options** dialog - *General* and *Other* which is nested under the *My Options* node. + +![Options](art/options.png) + +To make them show up in that dialog they have to be registered on the package class itself using the `ProvideOptionPage` attribute, like so: + +```c# +[ProvideOptionPage(typeof(DialogPageProvider.General), "My Options", "General", 0, 0, true)] +[ProvideOptionPage(typeof(DialogPageProvider.Other), "My Options", "Other", 0, 0, true)] +public sealed class MyPackage : AsyncPackage +{ + ... +} +``` + +Both `GeneralOptions` ([source](src/Options/GeneralOptions.cs)) and `OtherOptions` ([source](src/Options/OtherOptions.cs)) are classes containing the settings as regular public properties. They are inheriting from the generic base class `BaseOptionModel` ([source](src/Options/BaseOptionModel.cs)). + +```c# +internal class GeneralOptions : BaseOptionModel +{ + [Category("My category")] + [DisplayName("Message box text")] + [Description("Specifies the text to show in the message box")] + [DefaultValue("My message")] + public string Message { get; set; } = "My message"; +} +``` + +These classes can be used from anywhere in the extension when options are needed, but we need to provide a way to expose them to VS and for that we're going to create a class called `DialogPageProvider`: + +```c# +internal class DialogPageProvider +{ + public class General : BaseOptionPage { } + public class Other : BaseOptionPage { } +} +``` + +The classes specified inside the `DialogPageProvider` class are inheriting from the second generic base class in this sample - `BaseOptionPage` ([source](src/Options/BaseOptionPage.cs)). It's sole responsibility is to function as the entry point for the **Tools -> Options** dialog. + +That's it. We have now created custom options pages and registered them on the package. + +## Using the custom options +The options are ready to be consumed by our code and there are two ways to go about it: + +### 1. From the UI thread +Whenever our code executes on the UI thread we can easily access the settings like so: + +```c# +string message = GeneralOptions.Instance.Message; +``` + +This will throw when not on the UI thread so you'll catch any misuse during development. + +### 2. From a background thread +This is a thread-safe way to obtain the options instance. When in doubt, use it this way. + + +```c# +GeneralOptions options = await GeneralOptions.GetLiveInstanceAsync(); +string message = options.Message; +``` + +See how it is being used from the [TextviewCreationListener.cs](src/TextviewCreationListener.cs) MEF component in the source code. + +## Modify the options +You can programmatically modify the options like this: + +```c# +GeneralOptions options = await GeneralOptions.GetLiveInstanceAsync(); +options.Message = "My new message"; +await options.SaveAsync(); +``` + +The above method can be called in a syncronous way on the UI thread, like so: + +```c# +GeneralOptions.Instance.Message = "My new message"; +GeneralOptions.Instance.Save(); +``` + +It is recommented to do it async if possible. + +There you have it. Custom options using best practices. + +## Futher reading +Read the docs for all the details surrounding these scenarios, but notice that while they do provide more detailed documentation, they don't follow the best practices outlined in this sample. + +* [Creating an Options Page](https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-an-options-page) +* [Using the Settings Store](https://docs.microsoft.com/en-us/visualstudio/extensibility/using-the-settings-store) +* [Writing to the User Settings Store](https://docs.microsoft.com/en-us/visualstudio/extensibility/writing-to-the-user-settings-store) \ No newline at end of file diff --git a/Options/appveyor.yml b/Options/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/Options/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/Options/art/options.png b/Options/art/options.png new file mode 100644 index 00000000..db4cf9f6 Binary files /dev/null and b/Options/art/options.png differ diff --git a/Options/src/Options/BaseOptionModel.cs b/Options/src/Options/BaseOptionModel.cs new file mode 100644 index 00000000..6198dcab --- /dev/null +++ b/Options/src/Options/BaseOptionModel.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization.Formatters.Binary; +using System.Threading.Tasks; +using Microsoft; +using Microsoft.VisualStudio.Settings; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Shell.Settings; +using Microsoft.VisualStudio.Threading; +using Task = System.Threading.Tasks.Task; + +namespace OptionsSample.Options +{ + /// + /// A base class for specifying options + /// + internal abstract class BaseOptionModel where T : BaseOptionModel, new() + { + private static AsyncLazy _liveModel = new AsyncLazy(CreateAsync, ThreadHelper.JoinableTaskFactory); + private static AsyncLazy _settingsManager = new AsyncLazy(GetSettingsManagerAsync, ThreadHelper.JoinableTaskFactory); + + protected BaseOptionModel() + { } + + /// + /// A singleton instance of the options. MUST be called form UI thread only + /// + public static T Instance + { + get + { + ThreadHelper.ThrowIfNotOnUIThread(); + +#pragma warning disable VSTHRD104 // Offer async methods + return ThreadHelper.JoinableTaskFactory.Run(GetLiveInstanceAsync); +#pragma warning restore VSTHRD104 // Offer async methods + } + } + + /// + /// Get the singleton instance of the options. Thread safe. + /// + public static Task GetLiveInstanceAsync() => _liveModel.GetValueAsync(); + + /// + /// Creates a new instance of the options class and loads the values from the store. For internal use only + /// + /// + public static async Task CreateAsync() + { + var instance = new T(); + await instance.LoadAsync(); + return instance; + } + + /// + /// The name of the options collection as stored in the registry. + /// + protected virtual string CollectionName { get; } = typeof(T).FullName; + + /// + /// Hydrates the properties from the registry. + /// + public virtual void Load() + { + ThreadHelper.JoinableTaskFactory.Run(LoadAsync); + } + + /// + /// Hydrates the properties from the registry asyncronously. + /// + public virtual async Task LoadAsync() + { + ShellSettingsManager manager = await _settingsManager.GetValueAsync(); + SettingsStore settingsStore = manager.GetReadOnlySettingsStore(SettingsScope.UserSettings); + + if (!settingsStore.CollectionExists(CollectionName)) + { + return; + } + + foreach (PropertyInfo property in GetOptionProperties()) + { + try + { + string serializedProp = settingsStore.GetString(CollectionName, property.Name); + object value = DeserializeValue(serializedProp, property.PropertyType); + property.SetValue(this, value); + } + catch (Exception ex) + { + System.Diagnostics.Debug.Write(ex); + } + } + } + + /// + /// Saves the properties to the registry. + /// + public virtual void Save() + { + ThreadHelper.JoinableTaskFactory.Run(SaveAsync); + } + + /// + /// Saves the properties to the registry asyncronously. + /// + public virtual async Task SaveAsync() + { + ShellSettingsManager manager = await _settingsManager.GetValueAsync(); + WritableSettingsStore settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings); + + if (!settingsStore.CollectionExists(CollectionName)) + { + settingsStore.CreateCollection(CollectionName); + } + + foreach (PropertyInfo property in GetOptionProperties()) + { + string output = SerializeValue(property.GetValue(this)); + settingsStore.SetString(CollectionName, property.Name, output); + } + + T liveModel = await GetLiveInstanceAsync(); + + if (this != liveModel) + { + await liveModel.LoadAsync(); + } + } + + /// + /// Serializes an object value to a string using the binary serializer. + /// + protected virtual string SerializeValue(object value) + { + using (var stream = new MemoryStream()) + { + var formatter = new BinaryFormatter(); + formatter.Serialize(stream, value); + stream.Flush(); + return Convert.ToBase64String(stream.ToArray()); + } + } + + /// + /// Deserializes a string to an object using the binary serializer. + /// + protected virtual object DeserializeValue(string value, Type type) + { + byte[] b = Convert.FromBase64String(value); + + using (var stream = new MemoryStream(b)) + { + var formatter = new BinaryFormatter(); + return formatter.Deserialize(stream); + } + } + + private static async Task GetSettingsManagerAsync() + { +#pragma warning disable VSTHRD010 + // False-positive in Threading Analyzers. Bug tracked here https://github.com/Microsoft/vs-threading/issues/230 + var svc = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(typeof(SVsSettingsManager)) as IVsSettingsManager; +#pragma warning restore VSTHRD010 + + Assumes.Present(svc); + + return new ShellSettingsManager(svc); + } + + private IEnumerable GetOptionProperties() + { + return GetType() + .GetProperties() + .Where(p => p.PropertyType.IsSerializable && p.PropertyType.IsPublic); + } + } +} \ No newline at end of file diff --git a/Options/src/Options/BaseOptionPage.cs b/Options/src/Options/BaseOptionPage.cs new file mode 100644 index 00000000..4b17ef47 --- /dev/null +++ b/Options/src/Options/BaseOptionPage.cs @@ -0,0 +1,31 @@ +using Microsoft.VisualStudio.Shell; + +namespace OptionsSample.Options +{ + /// + /// A base class for a DialogPage to show in Tools -> Options. + /// + internal class BaseOptionPage : DialogPage where T : BaseOptionModel, new() + { + private BaseOptionModel _model; + + public BaseOptionPage() + { +#pragma warning disable VSTHRD104 // Offer async methods + _model = ThreadHelper.JoinableTaskFactory.Run(BaseOptionModel.CreateAsync); +#pragma warning restore VSTHRD104 // Offer async methods + } + + public override object AutomationObject => _model; + + public override void LoadSettingsFromStorage() + { + _model.Load(); + } + + public override void SaveSettingsToStorage() + { + _model.Save(); + } + } +} diff --git a/Options/src/Options/DialogPageProvider.cs b/Options/src/Options/DialogPageProvider.cs new file mode 100644 index 00000000..f4a7a38f --- /dev/null +++ b/Options/src/Options/DialogPageProvider.cs @@ -0,0 +1,11 @@ +namespace OptionsSample.Options +{ + /// + /// A provider for custom implementations. + /// + internal class DialogPageProvider + { + public class General : BaseOptionPage { } + public class Other : BaseOptionPage { } + } +} diff --git a/Options/src/Options/GeneralOptions.cs b/Options/src/Options/GeneralOptions.cs new file mode 100644 index 00000000..a7d215bd --- /dev/null +++ b/Options/src/Options/GeneralOptions.cs @@ -0,0 +1,13 @@ +using System.ComponentModel; + +namespace OptionsSample.Options +{ + internal class GeneralOptions : BaseOptionModel + { + [Category("My category")] + [DisplayName("Message box text")] + [Description("Specifies the text to show in the message box")] + [DefaultValue("My message")] + public string Message { get; set; } = "My message"; + } +} diff --git a/Options/src/Options/OtherOptions.cs b/Options/src/Options/OtherOptions.cs new file mode 100644 index 00000000..8cad6031 --- /dev/null +++ b/Options/src/Options/OtherOptions.cs @@ -0,0 +1,34 @@ +using System.ComponentModel; + +namespace OptionsSample.Options +{ + internal class OtherOptions : BaseOptionModel + { + [Category("A category")] + [DisplayName("Show message")] + [Description("The description of the property")] + [DefaultValue(true)] + public bool ShowMessage { get; set; } = true; + + [Category("Another category")] + [DisplayName("Favorite clothing")] + [Description("The description of the property")] + [DefaultValue(Clothing.Pants)] + [TypeConverter(typeof(EnumConverter))] // This will make use of enums more resilient + public Clothing ClothingChoice { get; set; } = Clothing.Pants; + + [Category("My category")] + [DisplayName("This is a boolean")] + [Description("The description of the property")] + [DefaultValue(true)] + [Browsable(false)] // This will hide it from the Tools -> Options page, but still work like normal + public bool HiddenProperty { get; set; } = true; + } + + public enum Clothing + { + Pants, + Sweater, + Shoes + } +} diff --git a/Options/src/OptionsPackage.cs b/Options/src/OptionsPackage.cs new file mode 100644 index 00000000..bec12ac5 --- /dev/null +++ b/Options/src/OptionsPackage.cs @@ -0,0 +1,22 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio.Shell; +using OptionsSample.Options; +using Task = System.Threading.Tasks.Task; + +namespace OptionsSample +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] + [ProvideOptionPage(typeof(DialogPageProvider.General), "My Options", "General", 0, 0, true)] + [ProvideOptionPage(typeof(DialogPageProvider.Other), "My Options", "Other", 0, 0, true)] + [Guid("8bb519a5-4864-43b0-8684-e2f2f723100c")] + public sealed class OptionsPackage : AsyncPackage + { + protected override Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + return base.InitializeAsync(cancellationToken, progress); + } + } +} diff --git a/Options/src/OptionsSample.csproj b/Options/src/OptionsSample.csproj new file mode 100644 index 00000000..ba55a8a0 --- /dev/null +++ b/Options/src/OptionsSample.csproj @@ -0,0 +1,234 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {EA3FC813-244D-4964-9DC3-774535F41FCC} + Library + Properties + OptionsSample + OptionsSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + Component + + + + + + + + Designer + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26606\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + True + + + ..\packages\Microsoft.VisualStudio.Editor.15.0.26606\lib\net45\Microsoft.VisualStudio.Editor.dll + True + + + ..\packages\Microsoft.VisualStudio.Imaging.15.0.26201\lib\net45\Microsoft.VisualStudio.Imaging.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26201\lib\Microsoft.VisualStudio.Shell.15.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.Data.15.0.26606\lib\net45\Microsoft.VisualStudio.Text.Data.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.Logic.15.0.26606\lib\net45\Microsoft.VisualStudio.Text.Logic.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.UI.15.0.26606\lib\net45\Microsoft.VisualStudio.Text.UI.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.UI.Wpf.15.0.26606\lib\net45\Microsoft.VisualStudio.Text.UI.Wpf.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.0.26201\lib\net45\Microsoft.VisualStudio.Utilities.dll + True + + + ..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll + + + False + + + + + + + + + + + + + + + true + VSPackage + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + \ No newline at end of file diff --git a/Options/src/Properties/AssemblyInfo.cs b/Options/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b70cf783 --- /dev/null +++ b/Options/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OptionsSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OptionsSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Options/src/Resources/OptionsPackage.ico b/Options/src/Resources/OptionsPackage.ico new file mode 100644 index 00000000..d323b07f Binary files /dev/null and b/Options/src/Resources/OptionsPackage.ico differ diff --git a/Options/src/TextviewCreationListener.cs b/Options/src/TextviewCreationListener.cs new file mode 100644 index 00000000..b4fade72 --- /dev/null +++ b/Options/src/TextviewCreationListener.cs @@ -0,0 +1,31 @@ +using System.ComponentModel.Composition; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Utilities; +using OptionsSample.Options; + +namespace OptionsSample +{ + [Export(typeof(IWpfTextViewCreationListener))] + [ContentType("text")] + [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] + internal class TextviewCreationListener : IWpfTextViewCreationListener + { + // This method is executed when you open any file in the editor window + public void TextViewCreated(IWpfTextView textView) + { + // Call the Instance singleton from the UI thread is easy + bool showMessage = OtherOptions.Instance.ShowMessage; + + if (showMessage) + { + System.Threading.Tasks.Task.Run(async () => + { + // Make the call to GetLiveInstanceAsync from a background thread to avoid blocking the UI thread + GeneralOptions options = await GeneralOptions.GetLiveInstanceAsync(); + string message = options.Message; + // Do something with message + }); + } + } + } +} diff --git a/Options/src/VSPackage.resx b/Options/src/VSPackage.resx new file mode 100644 index 00000000..e7fb9e39 --- /dev/null +++ b/Options/src/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + OptionsPackage Extension + + + OptionsPackage Visual Studio Extension Detailed Info + + + Resources\OptionsPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Options/src/packages.config b/Options/src/packages.config new file mode 100644 index 00000000..4926f031 --- /dev/null +++ b/Options/src/packages.config @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Options/src/source.extension.vsixmanifest b/Options/src/source.extension.vsixmanifest new file mode 100644 index 00000000..cede984c --- /dev/null +++ b/Options/src/source.extension.vsixmanifest @@ -0,0 +1,22 @@ + + + + + Options Sample + Empty VSIX Project. + + + + + + + + + + + + + + + + diff --git a/ProtocolHandler/.gitattributes b/ProtocolHandler/.gitattributes new file mode 100644 index 00000000..412eeda7 --- /dev/null +++ b/ProtocolHandler/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/ProtocolHandler/.gitignore b/ProtocolHandler/.gitignore new file mode 100644 index 00000000..0c1a1bc3 --- /dev/null +++ b/ProtocolHandler/.gitignore @@ -0,0 +1,23 @@ +packages + +# User files +*.suo +*.user +*.sln.docstates +.vs/ + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NCrunch +*.ncrunchsolution +*.ncrunchproject +_NCrunch_WebCompiler \ No newline at end of file diff --git a/ProtocolHandler/LICENSE b/ProtocolHandler/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/ProtocolHandler/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/ProtocolHandler/ProtocolHandlerSample.sln b/ProtocolHandler/ProtocolHandlerSample.sln new file mode 100644 index 00000000..e5ef1247 --- /dev/null +++ b/ProtocolHandler/ProtocolHandlerSample.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27420.3004 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolHandlerSample", "src\ProtocolHandlerSample.csproj", "{3091084B-7E6D-46FE-8D66-20DA5356152F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C2108A69-BA8A-43FB-9605-BD05EC44E4C0}" + ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3091084B-7E6D-46FE-8D66-20DA5356152F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3091084B-7E6D-46FE-8D66-20DA5356152F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3091084B-7E6D-46FE-8D66-20DA5356152F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3091084B-7E6D-46FE-8D66-20DA5356152F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E52A6C9-3628-41E5-8170-49F834335758} + EndGlobalSection +EndGlobal diff --git a/ProtocolHandler/README.md b/ProtocolHandler/README.md new file mode 100644 index 00000000..1fda6f09 --- /dev/null +++ b/ProtocolHandler/README.md @@ -0,0 +1,93 @@ +# Protocol handler sample + +[![Build status](https://ci.appveyor.com/api/projects/status/qq6vg6wi2ixshcr2?svg=true)](https://ci.appveyor.com/project/madskristensen/protocolhandlersample) + +**Applies to Visual Studio 2017.6 and newer** + +This sample shows how to associate a URI protocol with Visual Studio and handle the passed in URI. For instance, a link with a custom protocol (*such as vsph://anything/I/want*) will open Visual Studio and pass the URI to the extension. + +## Specify minimum supported version +Since protocol handler support is new in Visual Studio 2017 Update 6, we need to specify that our extension requires that version or newer. We do that in the .vsixmanifest file like so: + +```xml + +``` + +*15.0.27413* is the full version string of Visual Studio 2017 Update 6. + +See the full sample [.vsixmanifest file](src/source.extension.vsixmanifest). + +## Register the protocol +The first thing we should do is to specify the protocol in our extension to let the Visual Studio extension installer register it with Windows. We do that by adding a .json file to our extension and set its Build Action property to *ContentManifest*. + +![Property Grid](art/property-grid.png) + +The content of the .json file should look like this. Replace any instance of *vsph* with your own protocol name. + +```json +{ + "$schema": "http://json.schemastore.org/vsix-manifestinjection", + "urlAssociations": [ + { + "protocol": "vsph", + "displayName": "Visual Studio Protocol Handler Sample", + "progId": "VisualStudio.vsph.[InstanceId]", + "defaultProgramRegistrationPath": "Software\\Microsoft\\VisualStudio_[InstanceId]\\Capabilities" + } + ], + "progIds": [ + { + "id": "VisualStudio.vsph.[InstanceId]", + "displayName": "Visual Studio Protocol Handler Sample", + "path": "[InstallDir]\\Common7\\IDE\\devenv.exe", + "arguments": "/MySwitch", + "defaultIconPath": "[InstallDir]\\Common7\\IDE\\devenv.exe" + } + ] +} +``` + +Notice that the *#/progIds/arguments* property is set to **/MySwitch**. This means that Visual Studio will be started with a that command line argument and the URL will be added to that like so: `devenv.exe /MySwitch vsph://anything/I/want` + +> Please note that for this to work, the extension must be a per-machine extension. Set this in the .vsixmanifest by specifying ``. + +## Intercept the URI +Now we need our package class to load automatically when Visual Studio was started by the protocol handler. We do that by adding an attribute to the Package/AsyncPackage class: + +```c# +[ProvideAppCommandLine("MySwitch", typeof(ProtocolPackage), Arguments = "1", DemandLoad = 1)] +public sealed class ProtocolPackage : AsyncPackage +{ + ... +} +``` + +With the `ProvideAppCommandLine` attribute in place, the package is automatically initialized when the `/MySwitch` command line argument was passed to `devenv.exe`. + +We can then access the URI from the Package.InitializeAsync method: + +```c# +protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) +{ + await JoinableTaskFactory.SwitchToMainThreadAsync(); + + var cmdline = await GetServiceAsync(typeof(SVsAppCommandLine)) as IVsAppCommandLine; + + ErrorHandler.ThrowOnFailure(cmdline.GetOption("MySwitch", out int isPresent, out string optionValue)); + + if (isPresent == 1) + { + // If opened from a URL, then "optionValue" is the URL string itself + System.Windows.Forms.MessageBox.Show(optionValue); + } +} +``` + +See the full sample [package class](src/ProtocolPackage.cs). + +And that's it. We now have an extension that can take action on custom protocol URIs. To test it out, [install this sample extension](http://vsixgallery.com/extension/88018116-8e87-4113-a1c0-db510a2aace0/) and then click [this link](https://tinyurl.com/vsph-sample). + +## Further reading + +- [Adding command line switches](https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-command-line-switches) +- [VS 2017 version numbers and release dates](https://docs.microsoft.com/en-us/visualstudio/install/visual-studio-build-numbers-and-release-dates) \ No newline at end of file diff --git a/ProtocolHandler/appveyor.yml b/ProtocolHandler/appveyor.yml new file mode 100644 index 00000000..1c21f733 --- /dev/null +++ b/ProtocolHandler/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts | Vsix-PublishToGallery diff --git a/ProtocolHandler/art/property-grid.png b/ProtocolHandler/art/property-grid.png new file mode 100644 index 00000000..d9a7d300 Binary files /dev/null and b/ProtocolHandler/art/property-grid.png differ diff --git a/ProtocolHandler/src/ContentManifest.json b/ProtocolHandler/src/ContentManifest.json new file mode 100644 index 00000000..247f7d14 --- /dev/null +++ b/ProtocolHandler/src/ContentManifest.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json.schemastore.org/vsix-manifestinjection", + "urlAssociations": [ + { + "protocol": "vsph", + "displayName": "Visual Studio Protocol Handler Sample", + "progId": "VisualStudio.vsph.[InstanceId]", + "defaultProgramRegistrationPath": "Software\\Microsoft\\VisualStudio_[InstanceId]\\Capabilities" + } + ], + "progIds": [ + { + "id": "VisualStudio.vsph.[InstanceId]", + "displayName": "Visual Studio Protocol Handler Sample", + "path": "[InstallDir]\\Common7\\IDE\\devenv.exe", + "arguments": "/MySwitch", + "defaultIconPath": "[InstallDir]\\Common7\\IDE\\devenv.exe" + } + ] +} \ No newline at end of file diff --git a/ProtocolHandler/src/Properties/AssemblyInfo.cs b/ProtocolHandler/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..2200a07f --- /dev/null +++ b/ProtocolHandler/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ProtocolHandlerSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtocolHandlerSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ProtocolHandler/src/ProtocolHandlerSample.csproj b/ProtocolHandler/src/ProtocolHandlerSample.csproj new file mode 100644 index 00000000..4ce15dfc --- /dev/null +++ b/ProtocolHandler/src/ProtocolHandlerSample.csproj @@ -0,0 +1,243 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {3091084B-7E6D-46FE-8D66-20DA5356152F} + Library + Properties + ProtocolHandlerSample + ProtocolHandlerSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + true + + + Designer + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.6.27740\lib\net46\Microsoft.VisualStudio.CoreUtility.dll + True + + + ..\packages\Microsoft.VisualStudio.ImageCatalog.15.6.27413\lib\net45\Microsoft.VisualStudio.ImageCatalog.dll + True + + + ..\packages\Microsoft.VisualStudio.Imaging.15.6.27413\lib\net45\Microsoft.VisualStudio.Imaging.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.6.27413\lib\net45\Microsoft.VisualStudio.Shell.15.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.6.27413\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.15.0.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.15.6.27413\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.Data.15.6.27740\lib\net46\Microsoft.VisualStudio.Text.Data.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Threading.15.6.46\lib\net46\Microsoft.VisualStudio.Threading.dll + True + + + ..\packages\Microsoft.VisualStudio.Utilities.15.6.27413\lib\net46\Microsoft.VisualStudio.Utilities.dll + True + + + ..\packages\Microsoft.VisualStudio.Validation.15.3.32\lib\net45\Microsoft.VisualStudio.Validation.dll + True + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + False + + + ..\packages\StreamJsonRpc.1.3.23\lib\net45\StreamJsonRpc.dll + True + + + + + + + + + + + + + + Always + true + + + + + + true + VSPackage + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolHandler/src/ProtocolPackage.cs b/ProtocolHandler/src/ProtocolPackage.cs new file mode 100644 index 00000000..fc8e5052 --- /dev/null +++ b/ProtocolHandler/src/ProtocolPackage.cs @@ -0,0 +1,34 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Task = System.Threading.Tasks.Task; + +namespace ProtocolHandlerSample +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] + [Guid("4b19d544-cbe1-404c-b751-21698348b48d")] + [ProvideAppCommandLine(_cliSwitch, typeof(ProtocolPackage), Arguments = "1", DemandLoad = 1)] // More info https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-command-line-switches + public sealed class ProtocolPackage : AsyncPackage + { + private const string _cliSwitch = "MySwitch"; + + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(); + + var cmdline = await GetServiceAsync(typeof(SVsAppCommandLine)) as IVsAppCommandLine; + + ErrorHandler.ThrowOnFailure(cmdline.GetOption(_cliSwitch, out int isPresent, out string optionValue)); + + if (isPresent == 1) + { + // If opened from a URL, then "optionValue" is the URL string itself + System.Windows.Forms.MessageBox.Show(optionValue); + } + } + } +} diff --git a/ProtocolHandler/src/Resources/Icon.png b/ProtocolHandler/src/Resources/Icon.png new file mode 100644 index 00000000..ab71bb30 Binary files /dev/null and b/ProtocolHandler/src/Resources/Icon.png differ diff --git a/ProtocolHandler/src/Resources/LICENSE b/ProtocolHandler/src/Resources/LICENSE new file mode 100644 index 00000000..601897f7 --- /dev/null +++ b/ProtocolHandler/src/Resources/LICENSE @@ -0,0 +1,13 @@ +Copyright 2017 Mads Kristensen + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/ProtocolHandler/src/Resources/ProtocolPackage.ico b/ProtocolHandler/src/Resources/ProtocolPackage.ico new file mode 100644 index 00000000..d323b07f Binary files /dev/null and b/ProtocolHandler/src/Resources/ProtocolPackage.ico differ diff --git a/ProtocolHandler/src/VSPackage.resx b/ProtocolHandler/src/VSPackage.resx new file mode 100644 index 00000000..df9a5e7b --- /dev/null +++ b/ProtocolHandler/src/VSPackage.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Protocol Handler Sample + + + Sample Visual Studio extension to demonstrate how to add a custom protocol handler to Visual Studio + + + + Resources\ProtocolPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProtocolHandler/src/packages.config b/ProtocolHandler/src/packages.config new file mode 100644 index 00000000..0f3177b1 --- /dev/null +++ b/ProtocolHandler/src/packages.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProtocolHandler/src/source.extension.vsixmanifest b/ProtocolHandler/src/source.extension.vsixmanifest new file mode 100644 index 00000000..b01f66ea --- /dev/null +++ b/ProtocolHandler/src/source.extension.vsixmanifest @@ -0,0 +1,24 @@ + + + + + Protocol Handler Sample + Sample Visual Studio extension to demonstrate how to add a custom protocol handler to Visual Studio + Resources\LICENSE + Resources\Icon.png + Resources\ProtocolPackage.ico + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index d0d7371d..9124b8d0 100644 --- a/README.md +++ b/README.md @@ -20,55 +20,7 @@ If you've never written a Visual Studio extension before, [we've got some great 1. Clone the repo to download all samples ([How to](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository#Cloning-an-Existing-Repository)) `git clone https://github.com/Microsoft/VSSDK-Extensibility-Samples.git` -2. Find samples in the table below -3. Read the readme included with each sample and try it in Visual Studio - -## Samples overview -For more details see the readme included with each sample. - -| Sample Name | Description | -| ---------------------------------------- | ------------------------------------------------------------------------------------------ | -| [Basic_Source_Control_Provider*](Basic_Source_Control_Provider/) | Shows how to add hooks for a simple source code provider | -| [Build_Progress_Bar*](Build_Progress_Bar/) | Displays a tool window written in WPF showing build progress | -| [Caret_Fish_Eye](Caret_Fish_Eye/) | Uses line transformation API to zoom lines in proportion to cursor distance | -| [Code_Sweep](Code_Sweep/) | Searches for words matching terms in an XML schema across a solution | -| [Combo_Box](Combo_Box/) | Place combo boxes in a Visual Studio toolbar | -| [CommandTargetRGB](CommandTargetRGB/) | Shows how to create a multi-instance tool window | -| [Completion_Tooltip_Customization](Completion_Tooltip_Customization/) | Replaces the completion tooltip UI | -| [Diff_Classifier](Diff_Classifier/) | Classifier with color highlighting | -| [Editor_With_Toolbox](Editor_With_Toolbox/) | Creates a custom toolbox associated with a specific file extension | -| [ErrorList](ErrorList/) | generates errors in error list when the user spelling errors in the editor | -| [High-DPI_Images_Icons](High-DPI_Images_Icons/) | Use these helpers to make your images/icons in *VS 2013 only* scale on high dense displays | -| [Highlight_Word](Highlight_Word/) | Highlight any words that match the word currently under the text cursor | -| [Intra-text_Adornment](Intra-text_Adornment/) | Text adornment that replaces hexadecimal color values with color swatches | -| [LanguageServerProtocol](LanguageServerProtocol) | Uses the common language server protocol to create a mock language server and hook it up to VS to handle *.foo files | -| [LightBulb*](LightBulb/) | Creates a custom lightbulb to set text case in text files | -| [MSDNSearch](MSDNSearch/) | Implements MSDN search functionality directly into Quick Search | -| [Menu_And_Commands*](Menu_And_Commands/) | Demonstrates how to add commands to various places in the IDE | -| [Ook_Language_Integration](Ook_Language_Integration/) | Implements language support for a simple programming language | -| [Options_Page*](Options_Page/) | Shows how to add custom pages to the Tools / Options dialog | -| [Reference_Package](Reference_Package/) | Boilerplate containing minimum requirements for a functional extension | -| [Reference_Services](Reference_Services/) | Shows how to create and consume services as a service provider | -| [RunningDocumentTable(RDT)_Event_Explorer](RunningDocumentTable%28RDT%29_Event_Explorer/) | Creates an explorer grid to log events in a tool window | -| [Single_File_Generator](Single_File_Generator/) | Creates a file generator that uses XML as basis for creating a new C# file | -| [Source_Code_Control_Provider*](Source_Code_Control_Provider/) | More complex example of a source code provider | -| [Source_Control_Provider_Status_Bar_Integration](Source_Control_Provider_Status_Bar_Integration/) | Display source control information in the Status Bar. | -| [SqliteVisualizer](SqliteVisualizer) | Visualize a SQLite instance while native debugging in Visual Studio. | -| [Todo_Classification](Todo_Classification/) | Classifier that highlights TODO comments and displays a matching glyph | -| [Typing_Speed_Meter](Typing_Speed_Meter/) | Displays an adornment with a typing speed indicator in the Text Editor | -| [WPFDesigner_XML](WPFDesigner_XML/) | WPF-based visual designer for editing .vstemplate XML files | -| [WPF_Toolwindow*](WPF_Toolwindow/) | Provides a sample toolwindow that can host a WPF or WinForms control | -| [Windows_Forms_Controls_Installer](Windows_Forms_Controls_Installer/) | Loads custom Windows Forms controls inside the toolbox | -| [Backwards_Compatible_AsyncPackage_2013](Backwards_Compatible_AsyncPackage_2013/) | Sample backwards compatible package that also supports asynchronous loading | - - - -## High-quality icons and image assets -Visual Studio 2015 introduced support for the Image Service, which makes it easy for your extension to support high-DPI displays, Visual Studio themes and high contrast modes for accessibility. We also have a catalog of thousands of icons and images that you can use as part of your extension for consistency with other parts of the Visual Studio interface. Samples that demonstrate using the Image Service / Catalog are denoted with * in the list above. We also have an [Image Service and Catalog cookbook](http://aka.ms/VSImageService), which provides extensive documentation on using these capabilities. - -For Visual Studio 2013, only high-DPI images/icons are supported; the [High-DPI_Images_Icons](High-DPI_Images_Icons/) sample shows examples of the limited support available. +2. Read the readme included with each sample and try it in Visual Studio ## Other extensibility samples diff --git a/SingleFileGenerator/.gitattributes b/SingleFileGenerator/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/SingleFileGenerator/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/SingleFileGenerator/.gitignore b/SingleFileGenerator/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/SingleFileGenerator/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/SingleFileGenerator/LICENSE b/SingleFileGenerator/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/SingleFileGenerator/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/SingleFileGenerator/README.md b/SingleFileGenerator/README.md new file mode 100644 index 00000000..582ec408 --- /dev/null +++ b/SingleFileGenerator/README.md @@ -0,0 +1,146 @@ +# Single File Generator sample + +[![Build status](https://ci.appveyor.com/api/projects/status/khf234gs5mg2xp72?svg=true)](https://ci.appveyor.com/project/madskristensen/singlefilegeneratorsample) + +**Applies to Visual Studio 2017 and newer** + +This example shows how to write a Single File Generator in a Visual Studio extension that will output a nested file when the parent file is modified. + +Clone the repo to test out the sample in Visual Studio 2017 yourself. + +## What is a Single File Generator +A Single File Generator is a mechanism that will auto-create and nest an output file when the source file changes. In this sample, the generator is applied to a **.js** file that will then output a **.min.js** file like so: + +![Nested file](art/code-behind.png) + +It is also known as a Custom Tool which can be manually set in the properties of supported files. + +![Property Grid](art/property-grid.png) + +The most well-known examples of existing generators are the ones creating a strongly typed C#/VB nested file for .resx files. + +Every time the file with the Custom Tool property is modified, the Single File Generator will execute to update the nested file. + +The nested file can be of any type - code, image, etc. - the sky is the limit. + +## Let's get started +Before we begin, make sure you have created a VSIX project in Visual Studio. See how to [create a VSIX project](https://docs.microsoft.com/en-us/visualstudio/extensibility/extensibility-hello-world) if you don't already have one ready. + +### Install NuGet package +The base classes for the Single File Generator are located in the [Microsoft.VisualStudio.TextTemplating.VSHost.15.0](https://www.nuget.org/packages/Microsoft.VisualStudio.TextTemplating.VSHost.15.0/) NuGet package, so go ahead and install that into your VSIX project. + +We also need the [Nuglify](https://www.nuget.org/packages/NUglify/) NuGet package that can minify JavaScript. + +### The generator +The generator is a simple class that inherits from the *BaseCodeGeneratorWithSite* and has 2 methods for us to implement. + +```c# +using Microsoft.VisualStudio.TextTemplating.VSHost; + +[Guid("82ca81c8-b507-4ba1-a33d-ff6cdad20e36")] // change this GUID +public sealed class MinifyCodeGenerator : BaseCodeGeneratorWithSite +{ + public override string GetDefaultExtension() + { + return ".min.js"; + } + + protected override byte[] GenerateCode(string inputFileName, string inputFileContent) + { + UglifyResult minified = Uglify.Js(inputFileContent); + return Encoding.UTF8.GetBytes(minified.Code); + } +} +``` + +[See full generator class in the source](src/Generators/MinifyGenerator.cs). + +That's it, you now have a Single File Generator that writes a .min.js file with the minified content of the source .js file. Now we must register the generator to make it work. + +### Registering the generator +Decorate your *Package* class with the `ProvideCodeGenerator` attribute. + +```c# +[ProvideCodeGenerator(typeof(MinifyCodeGenerator), nameof(MinifyCodeGenerator), "Minifies JavaScript", true)] +public class VSPackage : AsyncPackage +{ + ... +} +``` + +[See full Package class in the source](src/VSPackage.cs). + +> Note: if you don't have a *Package* class, add one to your project using the Add New Item dialog. The template is called *Visual Studio AsyncPackage* in VS 2017.7 + +Now the generator is registered, and you can now manually give the Custom Tool property on .js files the *MinifyCodeGenerator* value. + +That's it. We've now implemented a Single File Generator that minifies JavaScript files. + +However, it would be much easier if we give our users a command in the context-menu of files in Solution Explorer to add the value for them so they don't have to type *MinifyCodeGenerator* in the Property Grid manually. + +### Add the command button +In the .VSCT file you must specify a new button. It could look like this: + +```c# + +``` + +[See full .vsct file in the source](src/VSCommandTable.vsct). + +That will place the button in the context-menu in Solution Explorer. + +![Context Menu](art/context-menu.png) + +Then we need to add the command handler C# file. It will look similar to this: + +```c# +internal sealed class ApplyCustomTool +{ + private const int _commandId = 0x0100; + private static readonly Guid _commandSet = new Guid("4aaf93c0-70ae-4a4b-9fb6-1ad3997a9adf"); + private static DTE _dte; + + public static async Task InitializeAsync(AsyncPackage package) + { + _dte = await package.GetServiceAsync(typeof(DTE)) as DTE; + + var commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as IMenuCommandService; + var cmdId = new CommandID(_commandSet, _commandId); + var cmd = new MenuCommand(OnExecute, cmdId) + commandService.AddCommand(cmd); + } + + private static void OnExecute(object sender, EventArgs e) + { + ProjectItem item = _dte.SelectedItems.Item(1).ProjectItem; + item.Properties.Item("CustomTool").Value = nameof(MinifyCodeGenerator); + } +} +``` + +[See full command handler in the source](src/Commands/ApplyCustomTool.cs). + +And then finally initialize the command handler from the *Package* initialization method. + +```c# +protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) +{ + await ApplyCustomTool.InitializeAsync(this); +} +``` + +[See full Package class in the source](src/VSPackage.cs). + +### Single File Generators in the wild +Here are more samples of open source extensions implementing Single File Generators. + +* [VSIX Synchronizer](https://github.com/madskristensen/VsixSynchronizer) +* [Extensibility Tools](https://github.com/madskristensen/extensibilitytools) + +## License +[Apache 2.0](LICENSE) \ No newline at end of file diff --git a/SingleFileGenerator/SingleFileGeneratorSample.sln b/SingleFileGenerator/SingleFileGeneratorSample.sln new file mode 100644 index 00000000..492d80bf --- /dev/null +++ b/SingleFileGenerator/SingleFileGeneratorSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27620.3002 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleFileGeneratorSample", "src\SingleFileGeneratorSample.csproj", "{154F8BFA-6D1D-4FEF-95AC-95D4222B34DA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D8854F3A-BEAA-44E0-A140-413225798789}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {154F8BFA-6D1D-4FEF-95AC-95D4222B34DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {154F8BFA-6D1D-4FEF-95AC-95D4222B34DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {154F8BFA-6D1D-4FEF-95AC-95D4222B34DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {154F8BFA-6D1D-4FEF-95AC-95D4222B34DA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C1C1BBB7-1562-4820-8E03-795009DFE966} + EndGlobalSection +EndGlobal diff --git a/SingleFileGenerator/appveyor.yml b/SingleFileGenerator/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/SingleFileGenerator/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/SingleFileGenerator/art/code-behind.png b/SingleFileGenerator/art/code-behind.png new file mode 100644 index 00000000..2e52dd0b Binary files /dev/null and b/SingleFileGenerator/art/code-behind.png differ diff --git a/SingleFileGenerator/art/context-menu.png b/SingleFileGenerator/art/context-menu.png new file mode 100644 index 00000000..f977f1b0 Binary files /dev/null and b/SingleFileGenerator/art/context-menu.png differ diff --git a/SingleFileGenerator/art/property-grid.png b/SingleFileGenerator/art/property-grid.png new file mode 100644 index 00000000..898e1950 Binary files /dev/null and b/SingleFileGenerator/art/property-grid.png differ diff --git a/SingleFileGenerator/src/Commands/ApplyCustomTool.cs b/SingleFileGenerator/src/Commands/ApplyCustomTool.cs new file mode 100644 index 00000000..d53cbf1b --- /dev/null +++ b/SingleFileGenerator/src/Commands/ApplyCustomTool.cs @@ -0,0 +1,44 @@ +using System; +using System.ComponentModel.Design; +using System.IO; +using EnvDTE; +using Microsoft.VisualStudio.Shell; +using Task = System.Threading.Tasks.Task; + +namespace SingleFileGeneratorSample +{ + internal sealed class ApplyCustomTool + { + private const int _commandId = 0x0100; + private static readonly Guid _commandSet = new Guid("4aaf93c0-70ae-4a4b-9fb6-1ad3997a9adf"); + private static DTE _dte; + + public static async Task InitializeAsync(AsyncPackage package) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + _dte = await package.GetServiceAsync(typeof(DTE)) as DTE; + + var commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as IMenuCommandService; + var cmdId = new CommandID(_commandSet, _commandId); + + var cmd = new OleMenuCommand(OnExecute, cmdId) + { + // This will defer visibility control to the VisibilityConstraints section in the .vsct file + Supported = false + }; + + commandService.AddCommand(cmd); + } + + private static void OnExecute(object sender, EventArgs e) + { + ProjectItem item = _dte.SelectedItems.Item(1).ProjectItem; + + if (item != null) + { + item.Properties.Item("CustomTool").Value = MinifyCodeGenerator.Name; + } + } + } +} diff --git a/SingleFileGenerator/src/Generators/MinifyGenerator.cs b/SingleFileGenerator/src/Generators/MinifyGenerator.cs new file mode 100644 index 00000000..fcf2e384 --- /dev/null +++ b/SingleFileGenerator/src/Generators/MinifyGenerator.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using EnvDTE; +using Microsoft.VisualStudio.TextTemplating.VSHost; +using NUglify; + +namespace SingleFileGeneratorSample +{ + [Guid("cffb7601-6a1b-4f28-a2d0-a435e6686a2e")] + public sealed class MinifyCodeGenerator : BaseCodeGeneratorWithSite + { + public const string Name = nameof(MinifyCodeGenerator); + public const string Description = "Generates a minified version of JavaScript, CSS and HTML files files."; + + public override string GetDefaultExtension() + { + var item = GetService(typeof(ProjectItem)) as ProjectItem; + return ".min" + Path.GetExtension(item?.FileNames[1]); + } + + protected override byte[] GenerateCode(string inputFileName, string inputFileContent) + { + string ext = Path.GetExtension(inputFileName).ToLowerInvariant(); + UglifyResult result = Minify(inputFileName, inputFileContent); + + if (result.HasErrors) + { + return Encoding.UTF8.GetBytes("// Source file contains errors"); + } + else + { + return Encoding.UTF8.GetBytes(result.Code); + } + } + + private static UglifyResult Minify(string inputFileName, string inputFileContent) + { + string ext = Path.GetExtension(inputFileName).ToLowerInvariant(); + + switch (ext) + { + case ".js": + return Uglify.Js(inputFileContent); + case ".css": + return Uglify.Css(inputFileContent); + case ".htm": + case ".html": + return Uglify.Html(inputFileContent); + } + + return new UglifyResult(inputFileContent, new List()); + } + } +} \ No newline at end of file diff --git a/SingleFileGenerator/src/Properties/AssemblyInfo.cs b/SingleFileGenerator/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..108055dc --- /dev/null +++ b/SingleFileGenerator/src/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Single File Generator Sample")] +[assembly: AssemblyDescription("Shows how to implement a single file generator for Visual Studio")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Mads Kristensen")] +[assembly: AssemblyProduct("Single File Generator Sample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SingleFileGenerator/src/Resources/ApplyCustomToolPackage.ico b/SingleFileGenerator/src/Resources/ApplyCustomToolPackage.ico new file mode 100644 index 00000000..d323b07f Binary files /dev/null and b/SingleFileGenerator/src/Resources/ApplyCustomToolPackage.ico differ diff --git a/SingleFileGenerator/src/Resources/Icon128x128.png b/SingleFileGenerator/src/Resources/Icon128x128.png new file mode 100644 index 00000000..76e4085f Binary files /dev/null and b/SingleFileGenerator/src/Resources/Icon128x128.png differ diff --git a/SingleFileGenerator/src/SingleFileGeneratorSample.csproj b/SingleFileGenerator/src/SingleFileGeneratorSample.csproj new file mode 100644 index 00000000..7f381974 --- /dev/null +++ b/SingleFileGenerator/src/SingleFileGeneratorSample.csproj @@ -0,0 +1,211 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {154F8BFA-6D1D-4FEF-95AC-95D4222B34DA} + Library + Properties + SingleFileGeneratorSample + SingleFileGeneratorSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + Designer + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26606\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.15.0.26606\lib\net45\Microsoft.VisualStudio.Imaging.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26606\lib\Microsoft.VisualStudio.Shell.15.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26606\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.15.0.26606\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.TextTemplating.15.0.15.0.26606\lib\net45\Microsoft.VisualStudio.TextTemplating.15.0.dll + + + ..\packages\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll + + + ..\packages\Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.dll + + + ..\packages\Microsoft.VisualStudio.TextTemplating.VSHost.15.0.15.0.26606\lib\Microsoft.VisualStudio.TextTemplating.VSHost.15.0.dll + + + ..\packages\Microsoft.VisualStudio.Threading.15.3.23\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.0.26606\lib\net45\Microsoft.VisualStudio.Utilities.dll + + + ..\packages\Microsoft.VisualStudio.Validation.15.3.15\lib\net45\Microsoft.VisualStudio.Validation.dll + + + ..\packages\NUglify.1.5.10\lib\net40\NUglify.dll + + + False + + + + + + + + + + + Menus.ctmenu + + + + + true + VSPackage + + + + + + true + Always + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + \ No newline at end of file diff --git a/SingleFileGenerator/src/VSCommandTable.vsct b/SingleFileGenerator/src/VSCommandTable.vsct new file mode 100644 index 00000000..b7494fec --- /dev/null +++ b/SingleFileGenerator/src/VSCommandTable.vsct @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SingleFileGenerator/src/VSPackage.cs b/SingleFileGenerator/src/VSPackage.cs new file mode 100644 index 00000000..6ab85cb0 --- /dev/null +++ b/SingleFileGenerator/src/VSPackage.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.TextTemplating.VSHost; +using Task = System.Threading.Tasks.Task; + +namespace SingleFileGeneratorSample +{ + [Guid("2e927fa3-8684-47fc-9674-0046499860d3")] // Must match the GUID in the .vsct file + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("Single File Generator Sample", "", "1.0")] + [ProvideMenuResource("Menus.ctmenu", 1)] + [ProvideCodeGenerator(typeof(MinifyCodeGenerator), MinifyCodeGenerator.Name, MinifyCodeGenerator.Description, true)] + [ProvideUIContextRule("69760bd3-80f0-4901-818d-c4656aaa08e9", // Must match the GUID in the .vsct file + name: "UI Context", + expression: "js | css | html", // This will make the button only show on .js, .css and .htm(l) files + termNames: new[] { "js", "css", "html" }, + termValues: new[] { "HierSingleSelectionName:.js$", "HierSingleSelectionName:.css$", "HierSingleSelectionName:.html?$" })] + public sealed class VSPackage : AsyncPackage + { + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + await ApplyCustomTool.InitializeAsync(this); + } + }} diff --git a/SingleFileGenerator/src/VSPackage.resx b/SingleFileGenerator/src/VSPackage.resx new file mode 100644 index 00000000..8d8bd213 --- /dev/null +++ b/SingleFileGenerator/src/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ApplyCustomTool Extension + + + ApplyCustomTool Visual Studio Extension Detailed Info + + + Resources\ApplyCustomToolPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/SingleFileGenerator/src/packages.config b/SingleFileGenerator/src/packages.config new file mode 100644 index 00000000..7b7ac762 --- /dev/null +++ b/SingleFileGenerator/src/packages.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SingleFileGenerator/src/source.extension.vsixmanifest b/SingleFileGenerator/src/source.extension.vsixmanifest new file mode 100644 index 00000000..d790c55a --- /dev/null +++ b/SingleFileGenerator/src/source.extension.vsixmanifest @@ -0,0 +1,23 @@ + + + + + Single File Generator Sample + Shows how to implement a single file generator for Visual Studio + Resources\Icon128x128.png + Resources\Icon128x128.png + + + + + + + + + + + + + + + diff --git a/SolutionLoadEvents/.gitattributes b/SolutionLoadEvents/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/SolutionLoadEvents/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/SolutionLoadEvents/.gitignore b/SolutionLoadEvents/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/SolutionLoadEvents/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/SolutionLoadEvents/LICENSE b/SolutionLoadEvents/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/SolutionLoadEvents/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/SolutionLoadEvents/README.md b/SolutionLoadEvents/README.md new file mode 100644 index 00000000..da022766 --- /dev/null +++ b/SolutionLoadEvents/README.md @@ -0,0 +1,98 @@ +# Solution Load sample + +[![Build status](https://ci.appveyor.com/api/projects/status/s0wahy0lg80gaggm?svg=true)](https://ci.appveyor.com/project/madskristensen/solutionloadsample) + +**Applies to Visual Studio 2015 and newer** + +This example shows how to listen to solution events when the package might not be initialized until after the solution has loaded. + +Clone the repo to test out the sample in Visual Studio 2017 yourself. + +## What is the problem? +In Visual Studio 2017 Update 8, packages will no longer be auto-loaded immediately when the following is true: + +* Package inherits from AsyncPackage +* Uses `ProvideAutoload` attribute +* Supports background load +* VS is starting up or solution is being loaded + +Instead, the package will be initialized **after** the startup or solution load depending on the `ProvideAutoload` context. This is done for performance reasons and is generally speaking a net benefit to users. + +The consequence is that the solution might already have been loaded when your package initializes and no solution load events will be fired until the user opens another solution. + +[See full Pakcage class in the source](src/VSPackage.cs) + +## The new pattern +...happens to be what was always considered a best practice. Here are the steps: + +1. Specify the package to autoload when a solution is opened +2. Check if a solution is open when package initializes and act (**new**) +3. Add event handlers for solution open events + +Step #2 has always been considered a best practice, but now it is a mandatory step. + +It used to be ok to autoload when a solution opened and then hook up the event handler, similar to this: + +```c# +[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)] +public sealed class VSPackage : AsyncPackage +{ + protected override Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + SolutionEvents.OnAfterOpenSolution += HandleOpenSolution; + return base.InitializeAsync(cancellationToken, progress); + } + + private void HandleOpenSolution(object sender = null, EventArgs e = null) + { + ... + } +} +``` + +The issue in the above sample is that when the `SolutionEvents.OnAfterOpenSolution` event handler is registered, a solution might already be open. So we need to make sure to check that first, like so: + +```c# +[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)] +public sealed class VSPackage : AsyncPackage +{ + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + bool isSolutionLoaded = await IsSolutionLoadedAsync(); + + if (isSolutionLoaded) + { + HandleOpenSolution(); + } + + SolutionEvents.OnAfterOpenSolution += HandleOpenSolution; + } + + private async Task IsSolutionLoadedAsync() + { + await JoinableTaskFactory.SwitchToMainThreadAsync(); + var solService = await GetServiceAsync(typeof(SVsSolution)) as IVsSolution; + + ErrorHandler.ThrowOnFailure(solService.GetProperty((int)__VSPROPID.VSPROPID_IsSolutionOpen, out object value)); + + return value is bool isSolOpen && isSolOpen; + } + + private void HandleOpenSolution(object sender = null, EventArgs e = null) + { + ... + } +} +``` + +[See full Pakcage class in the source](src/VSPackage.cs) + +This simple check for `IsSolutionLoadedAsync()` is all we have to do and we can now handle the solution open as usual. + +## Further reading + +* [How to use AsyncPackage with background load](https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background) +* [Use Rule-based UI context for package load](https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions) + +## License +[Apache 2.0](LICENSE) \ No newline at end of file diff --git a/SolutionLoadEvents/SolutionLoadSample.sln b/SolutionLoadEvents/SolutionLoadSample.sln new file mode 100644 index 00000000..1873b5aa --- /dev/null +++ b/SolutionLoadEvents/SolutionLoadSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27626.3006 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionLoadSample", "src\SolutionLoadSample.csproj", "{E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ECAEC4E6-93AD-402F-AC43-FDFC689BB503}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C4E22784-4018-44CB-A4D3-9B97910E38A3} + EndGlobalSection +EndGlobal diff --git a/SolutionLoadEvents/appveyor.yml b/SolutionLoadEvents/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/SolutionLoadEvents/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/SolutionLoadEvents/src/Properties/AssemblyInfo.cs b/SolutionLoadEvents/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..1886cdd1 --- /dev/null +++ b/SolutionLoadEvents/src/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("SolutionLoadSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SolutionLoadSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SolutionLoadEvents/src/Resources/VSPackage.ico b/SolutionLoadEvents/src/Resources/VSPackage.ico new file mode 100644 index 00000000..d323b07f Binary files /dev/null and b/SolutionLoadEvents/src/Resources/VSPackage.ico differ diff --git a/SolutionLoadEvents/src/SolutionLoadSample.csproj b/SolutionLoadEvents/src/SolutionLoadSample.csproj new file mode 100644 index 00000000..7c77db71 --- /dev/null +++ b/SolutionLoadEvents/src/SolutionLoadSample.csproj @@ -0,0 +1,191 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {E0739238-CDB6-4C2E-8F35-6F15FF8CBBBF} + Library + Properties + SolutionLoadSample + SolutionLoadSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + Designer + + + + + + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26201\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.15.0.26201\lib\net45\Microsoft.VisualStudio.Imaging.dll + + + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26201\lib\Microsoft.VisualStudio.Shell.15.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + + + ..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.0.26201\lib\net45\Microsoft.VisualStudio.Utilities.dll + + + ..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll + + + False + + + + + + + + + + + + + + VSPackage.cs + true + VSPackage + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + \ No newline at end of file diff --git a/SolutionLoadEvents/src/VSPackage.cs b/SolutionLoadEvents/src/VSPackage.cs new file mode 100644 index 00000000..ff3b55bf --- /dev/null +++ b/SolutionLoadEvents/src/VSPackage.cs @@ -0,0 +1,51 @@ +using System; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Events; +using Microsoft.VisualStudio.Shell.Interop; +using Task = System.Threading.Tasks.Task; + +namespace SolutionLoadSample +{ + [Guid("61eadc52-5677-4548-b273-08f1e6574f71")] + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("Solution Load Sample", "Demonstrates use of solution load events", "1.0")] + // The following line will schedule the package to be initialized when a solution is being opened + [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)] + public sealed class VSPackage : AsyncPackage + { + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + // Since this package might not be initialized until after a solution has finished loading, + // we need to check if a solution has already been loaded and then handle it. + bool isSolutionLoaded = await IsSolutionLoadedAsync(); + + if (isSolutionLoaded) + { + HandleOpenSolution(); + } + + // Listen for subsequent solution events + SolutionEvents.OnAfterOpenSolution += HandleOpenSolution; + } + + private async Task IsSolutionLoadedAsync() + { + await JoinableTaskFactory.SwitchToMainThreadAsync(); + var solService = await GetServiceAsync(typeof(SVsSolution)) as IVsSolution; + + ErrorHandler.ThrowOnFailure(solService.GetProperty((int)__VSPROPID.VSPROPID_IsSolutionOpen, out object value)); + + return value is bool isSolOpen && isSolOpen; + } + + private void HandleOpenSolution(object sender = null, EventArgs e = null) + { + // Handle the open solution and try to do as much work + // on a background thread as possible + } + } +} diff --git a/SolutionLoadEvents/src/VSPackage.resx b/SolutionLoadEvents/src/VSPackage.resx new file mode 100644 index 00000000..c441f03c --- /dev/null +++ b/SolutionLoadEvents/src/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + VSPackage Extension + + + VSPackage Visual Studio Extension Detailed Info + + + Resources\VSPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/SolutionLoadEvents/src/packages.config b/SolutionLoadEvents/src/packages.config new file mode 100644 index 00000000..a6f7722e --- /dev/null +++ b/SolutionLoadEvents/src/packages.config @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SolutionLoadEvents/src/source.extension.vsixmanifest b/SolutionLoadEvents/src/source.extension.vsixmanifest new file mode 100644 index 00000000..613be140 --- /dev/null +++ b/SolutionLoadEvents/src/source.extension.vsixmanifest @@ -0,0 +1,21 @@ + + + + + Solution Load Sample + Demonstrates use of solution load events + + + + + + + + + + + + + + + diff --git a/TextmateGrammar/.gitattributes b/TextmateGrammar/.gitattributes new file mode 100644 index 00000000..412eeda7 --- /dev/null +++ b/TextmateGrammar/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/TextmateGrammar/.gitignore b/TextmateGrammar/.gitignore new file mode 100644 index 00000000..0c1a1bc3 --- /dev/null +++ b/TextmateGrammar/.gitignore @@ -0,0 +1,23 @@ +packages + +# User files +*.suo +*.user +*.sln.docstates +.vs/ + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NCrunch +*.ncrunchsolution +*.ncrunchproject +_NCrunch_WebCompiler \ No newline at end of file diff --git a/TextmateGrammar/LICENSE b/TextmateGrammar/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/TextmateGrammar/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/TextmateGrammar/README.md b/TextmateGrammar/README.md new file mode 100644 index 00000000..3188a8a1 --- /dev/null +++ b/TextmateGrammar/README.md @@ -0,0 +1,42 @@ +# Textmate grammar in Visual Studio + +[![Build status](https://ci.appveyor.com/api/projects/status/x5v4qf0i0es5750h?svg=true)](https://ci.appveyor.com/project/madskristensen/textmatesample) + +This is a sample project that demonstrates how to ship Textmate grammars inside Visual Studio extensions. + +## Ship your own Textmate bundle +Here is how to ship any existing Textmate bundle as a Visual Studio extension. + +### Step 1 - Clone this project +Clone or download this project. Find it [on GitHub](https://github.com/madskristensen/TextmateSample). + +Then open the solution (.sln file) in Visual Studio 2017. It should look similar to this: + +![Solution Explorer](art/solution-explorer.png) + +### Step 2 - Modify metadata +Open the `source.extension.vsixmanifest` file and update all the metadata such as name, author etc. and **make sure to use a new GUID as the Product ID**. + +### Step 3 - Update license +Open `/Resources/LICENSE` file and update it to your needs. If the Apache 2.0 license works for you then just update the name in the top of the file. + +### Step 4 - Add the Textmate files +Delete the files inside the `Grammars` folder and add your own `.tmLanguage`, `.tmTheme`, `.plist` and/or `.json` files from the Textmate bundle. They are sometimes found inside a folder called `Syntaxes` in the Textmate bundle. + +> Note that *snippets*, *commands* and *preferences* sometimes found in Textmate bundles are not supported by Visual Studio and should not be added to this project. + +Make sure to set the **Build Action** to *Content* and the **Include in VSIX** to *True* for each of the Textmate files in the `/Grammars` folder. + +Select all the files and hit F4 to open the Properties tool window. + +![Properties](art/properties.png) + +### Step 5 - Update languages.pkgdef +This file registers the Textmate bundle with Visual Studio and associates the file extensions with icons. + +## Verify it works +To test and verify that the Textmate grammar files work, simple hit **Ctrl+F5** to launch a new instance of Visual Studio that will automatically have your extension installed. + +Open a file with a file extension matching that of the Textmate grammar file and verify that it is colorized. + +![File](art/file.png) \ No newline at end of file diff --git a/TextmateGrammar/TextmateSample.sln b/TextmateGrammar/TextmateSample.sln new file mode 100644 index 00000000..cdf643b5 --- /dev/null +++ b/TextmateGrammar/TextmateSample.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27413.3005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextmateSample", "src\TextmateSample.csproj", "{C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3F449C01-F59E-4B77-994C-B1B20787D46B}" + ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E04C904-31DF-4BD9-AFED-E5EAB3994206} + EndGlobalSection +EndGlobal diff --git a/TextmateGrammar/appveyor.yml b/TextmateGrammar/appveyor.yml new file mode 100644 index 00000000..1c21f733 --- /dev/null +++ b/TextmateGrammar/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts | Vsix-PublishToGallery diff --git a/TextmateGrammar/art/file.png b/TextmateGrammar/art/file.png new file mode 100644 index 00000000..a340f710 Binary files /dev/null and b/TextmateGrammar/art/file.png differ diff --git a/TextmateGrammar/art/properties.png b/TextmateGrammar/art/properties.png new file mode 100644 index 00000000..65a21730 Binary files /dev/null and b/TextmateGrammar/art/properties.png differ diff --git a/TextmateGrammar/art/solution-explorer.png b/TextmateGrammar/art/solution-explorer.png new file mode 100644 index 00000000..50722e2a Binary files /dev/null and b/TextmateGrammar/art/solution-explorer.png differ diff --git a/TextmateGrammar/src/Grammars/Dart.tmLanguage b/TextmateGrammar/src/Grammars/Dart.tmLanguage new file mode 100644 index 00000000..42f280c8 --- /dev/null +++ b/TextmateGrammar/src/Grammars/Dart.tmLanguage @@ -0,0 +1,1161 @@ + + + + + fileTypes + + dart + dart6 + + name + Dart + patterns + + + match + ^(#!.*)$ + name + meta.preprocessor.script.dart + + + begin + ^\s*\b(library|import|export|part of|part)\b + beginCaptures + + 0 + + name + keyword.other.import.dart + + + end + ; + endCaptures + + 0 + + name + punctuation.terminator.dart + + + name + meta.declaration.dart + patterns + + + include + #strings + + + match + \b(as|show|hide|deferred)\b + name + keyword.other.import.dart + + + + + include + #comments + + + include + #constants-and-special-vars + + + include + #annotations + + + include + #decl-typedef + + + include + #decl-class + + + include + #decl-enum + + + include + #decl-function + + + include + #keywords + + + include + #strings + + + repository + + annotations + + patterns + + + captures + + 1 + + name + annotation.dart + + 2 + + name + entity.name.function.annotation.dart + + 3 + + name + support.type.dart + + + match + ^(?:\s*)((@)([a-zA-Z0-9_]+)) + + + + comments + + patterns + + + captures + + 0 + + name + punctuation.definition.comment.dart + + + match + /\*\*/ + name + comment.block.empty.dart + + + include + #comments-inline + + + + comments-inline + + patterns + + + begin + /\* + end + \*/ + name + comment.block.dart + patterns + + + include + text.dart-doccomments + + + + + begin + (///) + beginCaptures + + 1 + + name + marker.dart + + + end + $ + name + comment.line.triple-slash.dart + patterns + + + include + text.dart-doccomments + + + + + begin + (//) + beginCaptures + + 1 + + name + marker.dart + + + end + $ + name + comment.line.double-slash.dart + patterns + + + include + text.dart-doccomments + + + + + + constants-and-special-vars + + patterns + + + match + \b(true|false|null)\b + name + constant.language.dart + + + match + \b(this|super)\b + name + variable.language.dart + + + match + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b + name + constant.numeric.dart + + + + decl-class + + patterns + + + begin + \bclass\b + beginCaptures + + 0 + + name + keyword.control.new.dart + + + end + (?={) + name + meta.declaration.class.dart + patterns + + + include + #keywords + + + match + [A-Za-z_][A-Za-z0-9_]* + name + class.name.dart + + + + + + decl-enum + + patterns + + + begin + \benum\b + beginCaptures + + 0 + + name + keyword.declaration.dart + + + end + (?={) + name + meta.declaration.enum.dart + patterns + + + include + #keywords + + + match + [A-Za-z_][A-Za-z0-9_]* + name + enum.name.dart + + + + + + decl-function + + patterns + + + captures + + 1 + + name + storage.type.primitive.dart + + 2 + + name + keyword.declaration.dart + + 3 + + name + function.name.dart + + + comment + A getter with a primitive return type. + match + ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(get)\s+(\w+)\s+(?==>) + name + meta.declaration.function.dart + + + captures + + 1 + + name + type.user-defined.dart + + 2 + + name + keyword.declaration.dart + + 3 + + name + function.name.dart + + + comment + A getter with a user-defined return type or no return type. + match + ^\s*(?:\b(\w+)\b\s+)?(get)\s+(\w+)\s+(?==>) + name + meta.declaration.function.dart + + + begin + ^\s*(set)\s+(\w+)(?=\() + beginCaptures + + 1 + + name + keyword.declaration.dart + + 2 + + name + function.name.dart + + + comment + A setter. + end + \) + name + meta.declaration.function.dart + patterns + + + include + #comments-inline + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\() + beginCaptures + + 1 + + name + storage.type.primitive.dart + + 2 + + name + function.name.dart + + + comment + A function with a primitive return type. + end + \) + name + meta.declaration.function.dart + patterns + + + include + #comments-inline + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + ^\s*(?:\b(return)\b)\s+(\w+)(?=\() + beginCaptures + + 1 + + name + keyword.control.dart + + 2 + + name + function.name.dart + + + comment + A function invocation after 'return' + end + \) + name + meta.invocation.function.dart + patterns + + + include + #comments-inline + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + ^\s*\b(new)\b\s+(\w+)(?=\() + beginCaptures + + 1 + + name + keyword.declaration.dart + + 2 + + name + function.name.dart + + + comment + A class instantiation after 'new' + end + \) + name + meta.invocation.function.dart + patterns + + + include + #comments-inline + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + + decl-function-parameter + + patterns + + + include + #constants-and-special-vars + + + begin + (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\() + beginCaptures + + 1 + + name + storage.type.primitive.dart + + 2 + + name + function.name.dart + + + comment + A function with a primitive return type. + end + \) + name + meta.parameter.function.dart + patterns + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + \b(new)\b\s+(\w+)(?=\() + beginCaptures + + 1 + + name + keyword.declaration.dart + + 2 + + name + function.name.dart + + + comment + A class instantiation after 'new' + end + \) + name + meta.invocation.function.dart + patterns + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + (?:\b(\w+)\b)\s+(\w+)(?=\() + beginCaptures + + 1 + + name + type.user-defined.dart + + 2 + + name + function.name.dart + + + comment + A function with a user-defined return type. + end + \) + name + meta.parameter.function.dart + patterns + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + begin + (\w+)(?=\() + beginCaptures + + 1 + + name + function.name.dart + + + comment + A function with no return type. + end + \) + name + meta.parameter.function.dart + patterns + + + include + #decl-function-parameter + + + include + #strings + + + include + #keywords + + + + + + decl-typedef + + patterns + + + begin + typedef + beginCaptures + + 0 + + name + keyword.control.new.dart + + + end + ; + endCaptures + + 0 + + name + punctuation.terminator.dart + + + name + meta.declaration.typedef.dart + patterns + + + captures + + 1 + + name + storage.type.primitive.dart + + 2 + + name + typedef.return.dart + + 3 + + name + typedef.name.dart + + + match + (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b|([a-zA-Z_][a-zA-Z0-9_]*))\s+([a-zA-Z_][a-zA-Z0-9_]+) + + + begin + \( + end + \) + name + typedef.params.dart + patterns + + + include + #keywords + + + + + + + + keywords + + patterns + + + match + \bassert\b + name + keyword.control.assert.dart + + + match + \bas\b + name + keyword.cast.dart + + + match + \b(try|catch|finally|throw|on|rethrow)\b + name + keyword.control.catch-exception.dart + + + match + \s+\?\s+|\s+:\s+ + name + keyword.control.ternary.dart + + + match + \b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b + name + keyword.control.dart + + + match + \b(async\*|async|await\*|await|yield)\b + name + keyword.control.async.dart + + + match + \b(new)\b + name + keyword.control.new.dart + + + match + \b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\b + name + keyword.declaration.dart + + + match + \b(is\!?)\b + name + keyword.operator.dart + + + match + (<<|>>>?|~|\^|\||&) + name + keyword.operator.bitwise.dart + + + match + ((&|\^|\||<<|>>>?)=) + name + keyword.operator.assignment.bitwise.dart + + + match + (===?|!==?|<=?|>=?) + name + keyword.operator.comparison.dart + + + match + (([+*/%-]|\~)=) + name + keyword.operator.assignment.arithmetic.dart + + + match + (=) + name + keyword.operator.assignment.dart + + + match + (\-\-|\+\+) + name + keyword.operator.increment-decrement.dart + + + match + (\-|\+|\*|\/|\~\/|%) + name + keyword.operator.arithmetic.dart + + + match + (!|&&|\|\|) + name + keyword.operator.logical.dart + + + match + ; + name + punctuation.terminator.dart + + + match + \b(static|final|const)\b + name + storage.modifier.dart + + + match + \b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\b + name + storage.type.primitive.dart + + + + regexp + + patterns + + + match + \\[^'"] + name + constant.character.escaped.regex.dart + + + begin + \( + contentName + meta.capture.regex.dart + end + \) + patterns + + + match + \?(:|=|!) + name + ignore.capture.regex.dart + + + include + #regex.dart + + + + + match + \*|\+|\?|\.|\| + name + keyword.other.regex.dart + + + match + \^|\$ + name + keyword.other.regex.dart + + + match + \. + name + constant.other.regex.dart + + + begin + \[(\^)? + beginCaptures + + 1 + + name + keyword.other.negation.regex.dart + + + end + \] + name + constant.character.range.regex.dart + patterns + + + match + \\[^"'] + name + constant.character.escaped.regex.dart + + + + + match + \{(?:\d+)?,(?:\d+)?\} + name + keyword.other.regex.dart + + + + string-interp + + patterns + + + begin + (\$)(\{) + beginCaptures + + 1 + + name + keyword.other.dart + + 2 + + name + keyword.other.dart + + + contentName + source.dart + end + (\}) + endCaptures + + 1 + + name + keyword.other.dart + + + name + interpolation.dart + patterns + + + include + $self + + + + + captures + + 1 + + name + keyword.other.dart + + 2 + + name + variable.parameter.dart + + + match + (\$)(\w+) + + + match + \\. + name + constant.character.escape.dart + + + + strings + + patterns + + + begin + (?<!r)""" + end + """(?!") + name + string.interpolated.triple.double.dart + patterns + + + include + #string-interp + + + + + begin + (?<!r)''' + end + '''(?!') + name + string.interpolated.triple.single.dart + patterns + + + include + #string-interp + + + + + begin + r""" + end + """(?!") + name + string.quoted.triple.double.dart + + + begin + r''' + end + '''(?!') + name + string.quoted.triple.single.dart + + + begin + (?<!\\|r)" + end + " + name + string.interpolated.double.dart + patterns + + + match + \n + name + invalid.string.newline + + + include + #string-interp + + + + + begin + r" + end + " + name + string.quoted.double.dart + patterns + + + include + #regexp + + + + + begin + (?<!\|r)' + end + ' + name + string.interpolated.single.dart + patterns + + + include + #string-interp + + + + + begin + r' + end + ' + name + string.quoted.single.dart + patterns + + + include + #regexp + + + + + + + scopeName + source.dart + uuid + 958518BC-799F-477A-99F9-5B28EBF230F6 + + diff --git a/TextmateGrammar/src/Grammars/LICENSE b/TextmateGrammar/src/Grammars/LICENSE new file mode 100644 index 00000000..bb713aaf --- /dev/null +++ b/TextmateGrammar/src/Grammars/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2014, Guillermo López-Anglada. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of this software nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/TextmateGrammar/src/Resources/Icon.png b/TextmateGrammar/src/Resources/Icon.png new file mode 100644 index 00000000..766ec709 Binary files /dev/null and b/TextmateGrammar/src/Resources/Icon.png differ diff --git a/TextmateGrammar/src/TextmateSample.csproj b/TextmateGrammar/src/TextmateSample.csproj new file mode 100644 index 00000000..f48dbe53 --- /dev/null +++ b/TextmateGrammar/src/TextmateSample.csproj @@ -0,0 +1,114 @@ + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {C5A73D2F-95F0-4037-B3FD-AE8F231A1A5A} + Library + TextmateSample + TextmateSample + v4.6.2 + false + true + false + false + false + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + true + + + true + + + Resources\LICENSE + true + + + + Designer + + + + + Always + true + + + Always + true + + + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.6.27413\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + True + + + ..\packages\Microsoft.VisualStudio.Language.Intellisense.15.6.27413\lib\net45\Microsoft.VisualStudio.Language.Intellisense.dll + True + + + ..\packages\Microsoft.VisualStudio.Language.StandardClassification.15.6.27413\lib\net45\Microsoft.VisualStudio.Language.StandardClassification.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.Data.15.6.27413\lib\net45\Microsoft.VisualStudio.Text.Data.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.Logic.15.6.27413\lib\net45\Microsoft.VisualStudio.Text.Logic.dll + True + + + ..\packages\Microsoft.VisualStudio.Text.UI.15.6.27413\lib\net45\Microsoft.VisualStudio.Text.UI.dll + True + + + ..\packages\Microsoft.VisualStudio.Threading.15.4.4\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Validation.15.3.15\lib\net45\Microsoft.VisualStudio.Validation.dll + True + + + + + + + \ No newline at end of file diff --git a/TextmateGrammar/src/languages.pkgdef b/TextmateGrammar/src/languages.pkgdef new file mode 100644 index 00000000..4bb39386 --- /dev/null +++ b/TextmateGrammar/src/languages.pkgdef @@ -0,0 +1,12 @@ +; Registers the language grammar files with Visual Studio +; Replace "TextmateSample" with a name of your choice. +[$RootKey$\TextMate\Repositories] +"TextmateSample"="$PackageFolder$\Grammars" + +; Associate icons with file extensions in Solution Explorer +; Find more icons at http://glyphlist.azurewebsites.net/knownmonikers/ +[$RootKey$\ShellFileAssociations\.dart] +"DefaultIconMoniker"="KnownMonikers.ClassFile" +; Add an icon for each file extension supported by the .tmLanguage grammar file +[$RootKey$\ShellFileAssociations\.dart6] +"DefaultIconMoniker"="KnownMonikers.ClassFile" \ No newline at end of file diff --git a/TextmateGrammar/src/packages.config b/TextmateGrammar/src/packages.config new file mode 100644 index 00000000..9e35878d --- /dev/null +++ b/TextmateGrammar/src/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/TextmateGrammar/src/source.extension.vsixmanifest b/TextmateGrammar/src/source.extension.vsixmanifest new file mode 100644 index 00000000..8ce6f4c2 --- /dev/null +++ b/TextmateGrammar/src/source.extension.vsixmanifest @@ -0,0 +1,26 @@ + + + + + Textmate Sample + An example of how to ship Textmate bundles as part of a Visual Studio extension + https://github.com/madskristensen/TextmateSample + Resources\LICENSE + Resources\Icon.png + Resources\Icon.png + textmate, bundle, sample + + + + + + + + + + + + + + + diff --git a/VisibilityConstraints/.gitattributes b/VisibilityConstraints/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/VisibilityConstraints/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/VisibilityConstraints/.gitignore b/VisibilityConstraints/.gitignore new file mode 100644 index 00000000..24ee378c --- /dev/null +++ b/VisibilityConstraints/.gitignore @@ -0,0 +1,262 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.pubxml +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/VisibilityConstraints/LICENSE b/VisibilityConstraints/LICENSE new file mode 100644 index 00000000..49d21669 --- /dev/null +++ b/VisibilityConstraints/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/VisibilityConstraints/README.md b/VisibilityConstraints/README.md new file mode 100644 index 00000000..e2fca73c --- /dev/null +++ b/VisibilityConstraints/README.md @@ -0,0 +1,71 @@ +# VisibilityConstraints example + +[![Build status](https://ci.appveyor.com/api/projects/status/k9x55sgxjyjsay0a?svg=true)](https://ci.appveyor.com/project/madskristensen/visibilityconstraintssample) + +**Applies to Visual Studio 2015 and newer** + +This sample shows how to use the `` element in a Visual Studio extension to remove the need to use the `ProvideAutoload` attribute on a package class. + +Clone the repo to test out the sample in Visual Studio 2017 yourself. + +## What is VisibilityConstraints? +Often a package is being loaded to run a `BeforeQueryStatus` method for a button to determine its visibility. With `` we can determine the visibility of a button without running `BeforeQueryStatus` and therefore don't need to load the package before the user clicks the button. + +It is a best practice to never load a package before it is needed, and `` allow us to load the package only when requested and not before. + +## Limit use of ProvideAutoload +It is very common to autoload a package when Visual Studio starts up or when a solution is being loaded. It is done by putting an attribute on the `Package` or `AsyncPackage` class like so: + +```c# +[ProvideAutoLoad(UIContextGuids80.SolutionExists)] +``` + +This is often a bad practice because the features in the package usually only applies to certain file or project types. It is much better to only load the package when those files or projects are loaded and not before. + +The general rule of thumb is to only load the package when aboslutely needed and never before. There is [great documentation][uicontext] on how to specify auto loading rules that causes loading to happen only when needed. + +Some extensions that today use the `ProvideAutoload` attribute don't actually need it at all, since `` can toggle the visibility of commands/buttons without loading the package. + +If you have to use `ProvideAutoload`, make sure you do so in the background using an `AsyncPackage` as [documented here][asyncpackage]. + +## Let's get started +First we must specify a rule for when a button should be visible. In this example, the rule is that the button should be visible when the user right-clicks a .cs or .vb file in Solution Explorer. We can express that in an attribute on the `Package` or `AsyncPackage` class like so: + +```csharp +[ProvideUIContextRule(_uiContextSupportedFiles, + name: "Supported Files", + expression: "CSharp | VisualBasic", + termNames: new[] { "CSharp", "VisualBasic" }, + termValues: new[] { "HierSingleSelectionName:.cs$", "HierSingleSelectionName:.vb$" })] +``` + +See [sample package class](src/MyPackage.cs) and more info about using the [ProvideUXContextRule][uicontext] attribute. + +Then we must register a ` based on that rule in the .vsct file like so: + +```xml + + + +``` + +...and remember to mark the button itself as dynamic visible: + +```xml +DynamicVisibility +``` + +[See sample .vsct file](src/VsCommandTable.vsct) + +That's it. The project in the `/src/` folder shows a working example of how this all fits together. + +## Further reading +Read the docs for all the details surrounding these scenarios. + +* [Use Rule-based UI Context for Visual Studio Extensions][uicontext] +* [Use AsyncPackage to Load VSPackages in the Background][asyncpackage] +* [VisibilityItem element][visibilityitem] + +[uicontext]: https://docs.microsoft.com/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions +[asyncpackage]: https://docs.microsoft.com/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background +[visibilityitem]: https://docs.microsoft.com/en-us/visualstudio/extensibility/visibilityitem-element \ No newline at end of file diff --git a/VisibilityConstraints/VisibilityConstraintsSample.sln b/VisibilityConstraints/VisibilityConstraintsSample.sln new file mode 100644 index 00000000..94416d89 --- /dev/null +++ b/VisibilityConstraints/VisibilityConstraintsSample.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27522.3005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisibilityConstraintsSample", "src\VisibilityConstraintsSample.csproj", "{2482BAFF-27B9-46D4-A1D8-B9EE94B495CC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ACBB488A-0CF4-4D94-9B05-3277AD16646A}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2482BAFF-27B9-46D4-A1D8-B9EE94B495CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2482BAFF-27B9-46D4-A1D8-B9EE94B495CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2482BAFF-27B9-46D4-A1D8-B9EE94B495CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2482BAFF-27B9-46D4-A1D8-B9EE94B495CC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B4A55C92-803C-4EF8-8A3A-E7EF0B66F26B} + EndGlobalSection +EndGlobal diff --git a/VisibilityConstraints/appveyor.yml b/VisibilityConstraints/appveyor.yml new file mode 100644 index 00000000..9b6ecfff --- /dev/null +++ b/VisibilityConstraints/appveyor.yml @@ -0,0 +1,14 @@ +image: Visual Studio 2017 + +install: +- ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex + +before_build: + - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion + +build_script: + - nuget restore -Verbosity quiet + - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m + +after_test: + - ps: Vsix-PushArtifacts diff --git a/VisibilityConstraints/src/MyButton.cs b/VisibilityConstraints/src/MyButton.cs new file mode 100644 index 00000000..41b428ba --- /dev/null +++ b/VisibilityConstraints/src/MyButton.cs @@ -0,0 +1,98 @@ +using System; +using System.ComponentModel.Design; +using System.Globalization; +using System.IO; +using System.Linq; +using EnvDTE; +using EnvDTE80; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; + +namespace VisibilityConstraintsSample +{ + internal sealed class MyButton + { + // CommandId must match the MyButtonId specified in the .vsct file + public const int CommandId = 0x0100; + + // Guid must match the guidMyButtonPackageCmdSet specified in the .vsct file + public static readonly Guid CommandSet = new Guid("497de1d3-ed31-4519-a864-bbcd992fa57d"); + + private readonly AsyncPackage _package; + + private MyButton(AsyncPackage package, IMenuCommandService commandService) + { + _package = package ?? throw new ArgumentNullException(nameof(package)); + commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); + + var cmdID = new CommandID(CommandSet, CommandId); + var command = new OleMenuCommand(Execute, cmdID) + { + // This defers the visibility logic back to the VisibilityConstraints in the .vsct file + Supported = false + }; + + // The MyQueryStatus method makes the exact same check as the ProvideUIContextRule attribute + // does on the MyPackage class. When that is the case, there is no need to specify + // a QueryStatus method and we can set command.Supported=false to defer the logic back + // to the VisibilityConstraint in the .vsct file. + //command.BeforeQueryStatus += MyQueryStatus; + + commandService.AddCommand(command); + } + + public static MyButton Instance + { + get; + private set; + } + + private IServiceProvider ServiceProvider + { + get { return _package; } + } + + public static void Initialize(AsyncPackage package, IMenuCommandService commandService) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + Instance = new MyButton(package, commandService); + } + + private void MyQueryStatus(object sender, EventArgs e) + { + var button = (MenuCommand)sender; + + // Make the button invisible by default + button.Visible = false; + + var dte = ServiceProvider.GetService(typeof(DTE)) as DTE2; + ProjectItem item = dte.SelectedItems.Item(1)?.ProjectItem; + + if (item != null) + { + string fileExtension = Path.GetExtension(item.Name).ToLowerInvariant(); + string[] supportedFiles = new[] { ".cs", ".vb" }; + + // Show the button only if a supported file is selected + button.Visible = supportedFiles.Contains(fileExtension); + } + } + + private void Execute(object sender, EventArgs e) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", GetType().FullName); + string title = nameof(MyButton); + + VsShellUtilities.ShowMessageBox( + _package, + message, + title, + OLEMSGICON.OLEMSGICON_INFO, + OLEMSGBUTTON.OLEMSGBUTTON_OK, + OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); + } + } +} diff --git a/VisibilityConstraints/src/MyPackage.cs b/VisibilityConstraints/src/MyPackage.cs new file mode 100644 index 00000000..ec2616f7 --- /dev/null +++ b/VisibilityConstraints/src/MyPackage.cs @@ -0,0 +1,37 @@ +using System; +using System.ComponentModel.Design; +using System.Runtime.InteropServices; +using System.Threading; +using Microsoft.VisualStudio.Shell; +using Task = System.Threading.Tasks.Task; + +namespace VisibilityConstraintsSample +{ + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] + [ProvideMenuResource("Menus.ctmenu", 1)] + [Guid("f76ae46c-c4e7-43cf-ac05-f6fd3cd699f1")] + // Read more about ProvideUIContextRule and VisibilityConstraints here + // https://docs.microsoft.com/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions + [ProvideUIContextRule(_uiContextSupportedFiles, + name: "Supported Files", + expression: "CSharp | VisualBasic", + termNames: new[] { "CSharp", "VisualBasic" }, + termValues: new[] { "HierSingleSelectionName:.cs$", "HierSingleSelectionName:.vb$" })] + public sealed class MyPackage : AsyncPackage + { + private const string _uiContextSupportedFiles = "24551deb-f034-43e9-a279-0e541241687e"; // Must match guid in VsCommandTable.vsct + + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + // Request any services while on the background thread + var commandService = await GetServiceAsync((typeof(IMenuCommandService))) as IMenuCommandService; + + // Switch to the main thread before initializing the MyButton command + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + // Now initialize the MyButton command and pass it the commandService + MyButton.Initialize(this, commandService); + } + } +} diff --git a/VisibilityConstraints/src/Properties/AssemblyInfo.cs b/VisibilityConstraints/src/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9b7151be --- /dev/null +++ b/VisibilityConstraints/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VisibilityConstraintsSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VisibilityConstraintsSample")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VisibilityConstraints/src/Resources/MyButton.png b/VisibilityConstraints/src/Resources/MyButton.png new file mode 100644 index 00000000..b22d975c Binary files /dev/null and b/VisibilityConstraints/src/Resources/MyButton.png differ diff --git a/VisibilityConstraints/src/Resources/MyButtonPackage.ico b/VisibilityConstraints/src/Resources/MyButtonPackage.ico new file mode 100644 index 00000000..d323b07f Binary files /dev/null and b/VisibilityConstraints/src/Resources/MyButtonPackage.ico differ diff --git a/VisibilityConstraints/src/VSPackage.resx b/VisibilityConstraints/src/VSPackage.resx new file mode 100644 index 00000000..d6025d1f --- /dev/null +++ b/VisibilityConstraints/src/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + MyButton Extension + + + MyButton Visual Studio Extension Detailed Info + + + Resources\MyButtonPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/VisibilityConstraints/src/VisibilityConstraintsSample.csproj b/VisibilityConstraints/src/VisibilityConstraintsSample.csproj new file mode 100644 index 00000000..1b48feb8 --- /dev/null +++ b/VisibilityConstraints/src/VisibilityConstraintsSample.csproj @@ -0,0 +1,204 @@ + + + + + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + true + + + false + + + + + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {2482BAFF-27B9-46D4-A1D8-B9EE94B495CC} + Library + Properties + VisibilityConstraintsSample + VisibilityConstraintsSample + v4.6 + true + true + true + true + true + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + Designer + + + + + False + + + False + + + False + + + False + + + + False + + + ..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26201\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + True + + + ..\packages\Microsoft.VisualStudio.Imaging.15.0.26201\lib\net45\Microsoft.VisualStudio.Imaging.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26201\lib\Microsoft.VisualStudio.Shell.15.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll + True + + + True + ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll + True + + + ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + True + + + ..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll + + + ..\packages\Microsoft.VisualStudio.Utilities.15.0.26201\lib\net45\Microsoft.VisualStudio.Utilities.dll + True + + + ..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll + + + False + + + + + + + + + + + Menus.ctmenu + + + + + true + VSPackage + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + \ No newline at end of file diff --git a/VisibilityConstraints/src/VsCommandTable.vsct b/VisibilityConstraints/src/VsCommandTable.vsct new file mode 100644 index 00000000..a061de14 --- /dev/null +++ b/VisibilityConstraints/src/VsCommandTable.vsct @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisibilityConstraints/src/packages.config b/VisibilityConstraints/src/packages.config new file mode 100644 index 00000000..a680234d --- /dev/null +++ b/VisibilityConstraints/src/packages.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VisibilityConstraints/src/source.extension.vsixmanifest b/VisibilityConstraints/src/source.extension.vsixmanifest new file mode 100644 index 00000000..a378d3a4 --- /dev/null +++ b/VisibilityConstraints/src/source.extension.vsixmanifest @@ -0,0 +1,21 @@ + + + + + VisibilityConstraintsSample + Empty VSIX Project. + + + + + + + + + + + + + + + diff --git a/Basic_Source_Control_Provider/C#/BasicSccProvider.cs b/_Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/BasicSccProvider.cs rename to _Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.cs diff --git a/Basic_Source_Control_Provider/C#/BasicSccProvider.csproj b/_Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.csproj similarity index 100% rename from Basic_Source_Control_Provider/C#/BasicSccProvider.csproj rename to _Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.csproj diff --git a/Basic_Source_Control_Provider/C#/BasicSccProvider.sln b/_Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.sln similarity index 100% rename from Basic_Source_Control_Provider/C#/BasicSccProvider.sln rename to _Archive/Basic_Source_Control_Provider/C#/BasicSccProvider.sln diff --git a/Basic_Source_Control_Provider/C#/CommandId.cs b/_Archive/Basic_Source_Control_Provider/C#/CommandId.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/CommandId.cs rename to _Archive/Basic_Source_Control_Provider/C#/CommandId.cs diff --git a/Basic_Source_Control_Provider/C#/Example.BasicSccProvider.jpg b/_Archive/Basic_Source_Control_Provider/C#/Example.BasicSccProvider.jpg similarity index 100% rename from Basic_Source_Control_Provider/C#/Example.BasicSccProvider.jpg rename to _Archive/Basic_Source_Control_Provider/C#/Example.BasicSccProvider.jpg diff --git a/Basic_Source_Control_Provider/C#/PkgCmd.vsct b/_Archive/Basic_Source_Control_Provider/C#/PkgCmd.vsct similarity index 100% rename from Basic_Source_Control_Provider/C#/PkgCmd.vsct rename to _Archive/Basic_Source_Control_Provider/C#/PkgCmd.vsct diff --git a/Basic_Source_Control_Provider/C#/Properties/AssemblyInfo.cs b/_Archive/Basic_Source_Control_Provider/C#/Properties/AssemblyInfo.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/Properties/AssemblyInfo.cs rename to _Archive/Basic_Source_Control_Provider/C#/Properties/AssemblyInfo.cs diff --git a/Basic_Source_Control_Provider/C#/Properties/Guids.cs b/_Archive/Basic_Source_Control_Provider/C#/Properties/Guids.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/Properties/Guids.cs rename to _Archive/Basic_Source_Control_Provider/C#/Properties/Guids.cs diff --git a/Basic_Source_Control_Provider/C#/ProvideSourceControlProvider.cs b/_Archive/Basic_Source_Control_Provider/C#/ProvideSourceControlProvider.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/ProvideSourceControlProvider.cs rename to _Archive/Basic_Source_Control_Provider/C#/ProvideSourceControlProvider.cs diff --git a/Basic_Source_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs b/_Archive/Basic_Source_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs rename to _Archive/Basic_Source_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs diff --git a/Basic_Source_Control_Provider/C#/Resources.Designer.cs b/_Archive/Basic_Source_Control_Provider/C#/Resources.Designer.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/Resources.Designer.cs rename to _Archive/Basic_Source_Control_Provider/C#/Resources.Designer.cs diff --git a/Basic_Source_Control_Provider/C#/Resources.resx b/_Archive/Basic_Source_Control_Provider/C#/Resources.resx similarity index 100% rename from Basic_Source_Control_Provider/C#/Resources.resx rename to _Archive/Basic_Source_Control_Provider/C#/Resources.resx diff --git a/Basic_Source_Control_Provider/C#/Resources/Product.ico b/_Archive/Basic_Source_Control_Provider/C#/Resources/Product.ico similarity index 100% rename from Basic_Source_Control_Provider/C#/Resources/Product.ico rename to _Archive/Basic_Source_Control_Provider/C#/Resources/Product.ico diff --git a/Basic_Source_Control_Provider/C#/SccProviderOptions.cs b/_Archive/Basic_Source_Control_Provider/C#/SccProviderOptions.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderOptions.cs rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderOptions.cs diff --git a/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.cs b/_Archive/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderOptionsControl.cs rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.cs diff --git a/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.resx b/_Archive/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.resx similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderOptionsControl.resx rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderOptionsControl.resx diff --git a/Basic_Source_Control_Provider/C#/SccProviderService.cs b/_Archive/Basic_Source_Control_Provider/C#/SccProviderService.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderService.cs rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderService.cs diff --git a/Basic_Source_Control_Provider/C#/SccProviderToolWindow.cs b/_Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindow.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderToolWindow.cs rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindow.cs diff --git a/Basic_Source_Control_Provider/C#/SccProviderToolWindow.resx b/_Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindow.resx similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderToolWindow.resx rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindow.resx diff --git a/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.cs b/_Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.cs similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.cs rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.cs diff --git a/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.resx b/_Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.resx similarity index 100% rename from Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.resx rename to _Archive/Basic_Source_Control_Provider/C#/SccProviderToolWindowControl.resx diff --git a/Basic_Source_Control_Provider/C#/app.config b/_Archive/Basic_Source_Control_Provider/C#/app.config similarity index 100% rename from Basic_Source_Control_Provider/C#/app.config rename to _Archive/Basic_Source_Control_Provider/C#/app.config diff --git a/Basic_Source_Control_Provider/C#/packages.config b/_Archive/Basic_Source_Control_Provider/C#/packages.config similarity index 100% rename from Basic_Source_Control_Provider/C#/packages.config rename to _Archive/Basic_Source_Control_Provider/C#/packages.config diff --git a/Basic_Source_Control_Provider/C#/source.extension.vsixmanifest b/_Archive/Basic_Source_Control_Provider/C#/source.extension.vsixmanifest similarity index 100% rename from Basic_Source_Control_Provider/C#/source.extension.vsixmanifest rename to _Archive/Basic_Source_Control_Provider/C#/source.extension.vsixmanifest diff --git a/Basic_Source_Control_Provider/Readme.md b/_Archive/Basic_Source_Control_Provider/Readme.md similarity index 100% rename from Basic_Source_Control_Provider/Readme.md rename to _Archive/Basic_Source_Control_Provider/Readme.md diff --git a/Build_Progress_Bar/C#/BuildProgressBar.sln b/_Archive/Build_Progress_Bar/C#/BuildProgressBar.sln similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar.sln rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar.sln diff --git a/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.csproj b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.csproj similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.csproj rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.csproj diff --git a/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.vsct b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.vsct similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.vsct rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressBar.vsct diff --git a/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressToolWindow.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressToolWindow.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/BuildProgressToolWindow.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/BuildProgressToolWindow.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Example.BuildProgressBar.png b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Example.BuildProgressBar.png similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Example.BuildProgressBar.png rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Example.BuildProgressBar.png diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Key.snk b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Key.snk similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Key.snk rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Key.snk diff --git a/Build_Progress_Bar/C#/BuildProgressBar/PkgCmdID.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/PkgCmdID.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/PkgCmdID.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/PkgCmdID.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml diff --git a/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarControl.xaml.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarPackage.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarPackage.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/ProgressBarPackage.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/ProgressBarPackage.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Properties/AssemblyInfo.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/AssemblyInfo.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Properties/AssemblyInfo.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/AssemblyInfo.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Properties/GlobalSuppressions.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/GlobalSuppressions.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Properties/GlobalSuppressions.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/GlobalSuppressions.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Properties/Guids.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/Guids.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Properties/Guids.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Properties/Guids.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Resources.Designer.cs b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources.Designer.cs similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Resources.Designer.cs rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources.Designer.cs diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Resources.resx b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources.resx similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Resources.resx rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources.resx diff --git a/Build_Progress_Bar/C#/BuildProgressBar/Resources/Package.ico b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources/Package.ico similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/Resources/Package.ico rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/Resources/Package.ico diff --git a/Build_Progress_Bar/C#/BuildProgressBar/VSPackage.resx b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/VSPackage.resx similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/VSPackage.resx rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/VSPackage.resx diff --git a/Build_Progress_Bar/C#/BuildProgressBar/packages.config b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/packages.config similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/packages.config rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/packages.config diff --git a/Build_Progress_Bar/C#/BuildProgressBar/source.extension.vsixmanifest b/_Archive/Build_Progress_Bar/C#/BuildProgressBar/source.extension.vsixmanifest similarity index 100% rename from Build_Progress_Bar/C#/BuildProgressBar/source.extension.vsixmanifest rename to _Archive/Build_Progress_Bar/C#/BuildProgressBar/source.extension.vsixmanifest diff --git a/Build_Progress_Bar/Readme.md b/_Archive/Build_Progress_Bar/Readme.md similarity index 100% rename from Build_Progress_Bar/Readme.md rename to _Archive/Build_Progress_Bar/Readme.md diff --git a/CommandTargetRGB/C#/CommandTargetRGB.sln b/_Archive/CommandTargetRGB/C#/CommandTargetRGB.sln similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB.sln rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB.sln diff --git a/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.csproj b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.csproj similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.csproj rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.csproj diff --git a/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.resx b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.resx similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.resx rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.resx diff --git a/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.vsct b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.vsct similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.vsct rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGB.vsct diff --git a/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGBPackage.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGBPackage.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGBPackage.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/CommandTargetRGBPackage.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Key.snk b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Key.snk similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Key.snk rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Key.snk diff --git a/CommandTargetRGB/C#/CommandTargetRGB/PkgCmdID.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/PkgCmdID.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/PkgCmdID.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/PkgCmdID.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Properties/AssemblyInfo.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/AssemblyInfo.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Properties/AssemblyInfo.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/AssemblyInfo.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Properties/GlobalSuppressions.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/GlobalSuppressions.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Properties/GlobalSuppressions.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/GlobalSuppressions.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Properties/Guids.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/Guids.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Properties/Guids.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Properties/Guids.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml diff --git a/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBControl.xaml.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/RGBToolWindow.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBToolWindow.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/RGBToolWindow.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/RGBToolWindow.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources.Designer.cs b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources.Designer.cs similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources.Designer.cs rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources.Designer.cs diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources.resx b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources.resx similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources.resx rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources.resx diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources/Package.ico b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/Package.ico similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources/Package.ico rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/Package.ico diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources/blue.png b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/blue.png similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources/blue.png rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/blue.png diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources/green.png b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/green.png similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources/green.png rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/green.png diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources/red.png b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/red.png similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources/red.png rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/red.png diff --git a/CommandTargetRGB/C#/CommandTargetRGB/Resources/rgb.png b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/rgb.png similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/Resources/rgb.png rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/Resources/rgb.png diff --git a/CommandTargetRGB/C#/CommandTargetRGB/app.config b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/app.config similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/app.config rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/app.config diff --git a/CommandTargetRGB/C#/CommandTargetRGB/packages.config b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/packages.config similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/packages.config rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/packages.config diff --git a/CommandTargetRGB/C#/CommandTargetRGB/source.extension.vsixmanifest b/_Archive/CommandTargetRGB/C#/CommandTargetRGB/source.extension.vsixmanifest similarity index 100% rename from CommandTargetRGB/C#/CommandTargetRGB/source.extension.vsixmanifest rename to _Archive/CommandTargetRGB/C#/CommandTargetRGB/source.extension.vsixmanifest diff --git a/CommandTargetRGB/C#/Example.CommandTargetRGB.png b/_Archive/CommandTargetRGB/C#/Example.CommandTargetRGB.png similarity index 100% rename from CommandTargetRGB/C#/Example.CommandTargetRGB.png rename to _Archive/CommandTargetRGB/C#/Example.CommandTargetRGB.png diff --git a/CommandTargetRGB/Readme.md b/_Archive/CommandTargetRGB/Readme.md similarity index 100% rename from CommandTargetRGB/Readme.md rename to _Archive/CommandTargetRGB/Readme.md diff --git a/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.cpp b/_Archive/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.cpp similarity index 100% rename from High-DPI_Images_Icons/Cpp/VsUIDpiHelper.cpp rename to _Archive/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.cpp diff --git a/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.h b/_Archive/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.h similarity index 100% rename from High-DPI_Images_Icons/Cpp/VsUIDpiHelper.h rename to _Archive/High-DPI_Images_Icons/Cpp/VsUIDpiHelper.h diff --git a/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.cpp b/_Archive/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.cpp similarity index 100% rename from High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.cpp rename to _Archive/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.cpp diff --git a/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.h b/_Archive/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.h similarity index 100% rename from High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.h rename to _Archive/High-DPI_Images_Icons/Cpp/VsUIGdiplusImage.h diff --git a/High-DPI_Images_Icons/Readme.md b/_Archive/High-DPI_Images_Icons/Readme.md similarity index 100% rename from High-DPI_Images_Icons/Readme.md rename to _Archive/High-DPI_Images_Icons/Readme.md diff --git a/Options_Page/C#/Example.OptionsPage1.png b/_Archive/Options_Page/C#/Example.OptionsPage1.png similarity index 100% rename from Options_Page/C#/Example.OptionsPage1.png rename to _Archive/Options_Page/C#/Example.OptionsPage1.png diff --git a/Options_Page/C#/OptionsCompositeControl.cs b/_Archive/Options_Page/C#/OptionsCompositeControl.cs similarity index 100% rename from Options_Page/C#/OptionsCompositeControl.cs rename to _Archive/Options_Page/C#/OptionsCompositeControl.cs diff --git a/Options_Page/C#/OptionsPageCS.csproj b/_Archive/Options_Page/C#/OptionsPageCS.csproj similarity index 100% rename from Options_Page/C#/OptionsPageCS.csproj rename to _Archive/Options_Page/C#/OptionsPageCS.csproj diff --git a/Options_Page/C#/OptionsPageCS.sln b/_Archive/Options_Page/C#/OptionsPageCS.sln similarity index 100% rename from Options_Page/C#/OptionsPageCS.sln rename to _Archive/Options_Page/C#/OptionsPageCS.sln diff --git a/Options_Page/C#/OptionsPageCustom.cs b/_Archive/Options_Page/C#/OptionsPageCustom.cs similarity index 100% rename from Options_Page/C#/OptionsPageCustom.cs rename to _Archive/Options_Page/C#/OptionsPageCustom.cs diff --git a/Options_Page/C#/OptionsPageGeneral.cs b/_Archive/Options_Page/C#/OptionsPageGeneral.cs similarity index 100% rename from Options_Page/C#/OptionsPageGeneral.cs rename to _Archive/Options_Page/C#/OptionsPageGeneral.cs diff --git a/Options_Page/C#/OptionsPagePackage.cs b/_Archive/Options_Page/C#/OptionsPagePackage.cs similarity index 100% rename from Options_Page/C#/OptionsPagePackage.cs rename to _Archive/Options_Page/C#/OptionsPagePackage.cs diff --git a/Options_Page/C#/Properties/AssemblyInfo.cs b/_Archive/Options_Page/C#/Properties/AssemblyInfo.cs similarity index 100% rename from Options_Page/C#/Properties/AssemblyInfo.cs rename to _Archive/Options_Page/C#/Properties/AssemblyInfo.cs diff --git a/Options_Page/C#/Properties/GuidStrings.cs b/_Archive/Options_Page/C#/Properties/GuidStrings.cs similarity index 100% rename from Options_Page/C#/Properties/GuidStrings.cs rename to _Archive/Options_Page/C#/Properties/GuidStrings.cs diff --git a/Options_Page/C#/Resources.Designer.cs b/_Archive/Options_Page/C#/Resources.Designer.cs similarity index 100% rename from Options_Page/C#/Resources.Designer.cs rename to _Archive/Options_Page/C#/Resources.Designer.cs diff --git a/Options_Page/C#/Resources.resx b/_Archive/Options_Page/C#/Resources.resx similarity index 100% rename from Options_Page/C#/Resources.resx rename to _Archive/Options_Page/C#/Resources.resx diff --git a/Options_Page/C#/Resources/300.png b/_Archive/Options_Page/C#/Resources/300.png similarity index 100% rename from Options_Page/C#/Resources/300.png rename to _Archive/Options_Page/C#/Resources/300.png diff --git a/Options_Page/C#/Resources/400.ico b/_Archive/Options_Page/C#/Resources/400.ico similarity index 100% rename from Options_Page/C#/Resources/400.ico rename to _Archive/Options_Page/C#/Resources/400.ico diff --git a/Options_Page/C#/VsPackage.resx b/_Archive/Options_Page/C#/VsPackage.resx similarity index 100% rename from Options_Page/C#/VsPackage.resx rename to _Archive/Options_Page/C#/VsPackage.resx diff --git a/Options_Page/C#/packages.config b/_Archive/Options_Page/C#/packages.config similarity index 100% rename from Options_Page/C#/packages.config rename to _Archive/Options_Page/C#/packages.config diff --git a/Options_Page/C#/source.extension.vsixmanifest b/_Archive/Options_Page/C#/source.extension.vsixmanifest similarity index 100% rename from Options_Page/C#/source.extension.vsixmanifest rename to _Archive/Options_Page/C#/source.extension.vsixmanifest diff --git a/Options_Page/Readme.md b/_Archive/Options_Page/Readme.md similarity index 100% rename from Options_Page/Readme.md rename to _Archive/Options_Page/Readme.md diff --git a/Reference_Package/C#/BasicPackage.cs b/_Archive/Reference_Package/C#/BasicPackage.cs similarity index 100% rename from Reference_Package/C#/BasicPackage.cs rename to _Archive/Reference_Package/C#/BasicPackage.cs diff --git a/Reference_Package/C#/Example.Package.png b/_Archive/Reference_Package/C#/Example.Package.png similarity index 100% rename from Reference_Package/C#/Example.Package.png rename to _Archive/Reference_Package/C#/Example.Package.png diff --git a/Reference_Package/C#/GenericPackage.ico b/_Archive/Reference_Package/C#/GenericPackage.ico similarity index 100% rename from Reference_Package/C#/GenericPackage.ico rename to _Archive/Reference_Package/C#/GenericPackage.ico diff --git a/Reference_Package/C#/Package.csproj b/_Archive/Reference_Package/C#/Package.csproj similarity index 100% rename from Reference_Package/C#/Package.csproj rename to _Archive/Reference_Package/C#/Package.csproj diff --git a/Reference_Package/C#/Package.sln b/_Archive/Reference_Package/C#/Package.sln similarity index 100% rename from Reference_Package/C#/Package.sln rename to _Archive/Reference_Package/C#/Package.sln diff --git a/Reference_Package/C#/Properties/AssemblyInfo.cs b/_Archive/Reference_Package/C#/Properties/AssemblyInfo.cs similarity index 100% rename from Reference_Package/C#/Properties/AssemblyInfo.cs rename to _Archive/Reference_Package/C#/Properties/AssemblyInfo.cs diff --git a/Reference_Package/C#/Properties/GlobalSuppressions.cs b/_Archive/Reference_Package/C#/Properties/GlobalSuppressions.cs similarity index 100% rename from Reference_Package/C#/Properties/GlobalSuppressions.cs rename to _Archive/Reference_Package/C#/Properties/GlobalSuppressions.cs diff --git a/Reference_Package/C#/VSPackage.resx b/_Archive/Reference_Package/C#/VSPackage.resx similarity index 100% rename from Reference_Package/C#/VSPackage.resx rename to _Archive/Reference_Package/C#/VSPackage.resx diff --git a/Reference_Package/C#/packages.config b/_Archive/Reference_Package/C#/packages.config similarity index 100% rename from Reference_Package/C#/packages.config rename to _Archive/Reference_Package/C#/packages.config diff --git a/Reference_Package/C#/source.extension.vsixmanifest b/_Archive/Reference_Package/C#/source.extension.vsixmanifest similarity index 100% rename from Reference_Package/C#/source.extension.vsixmanifest rename to _Archive/Reference_Package/C#/source.extension.vsixmanifest diff --git a/Reference_Package/Readme.md b/_Archive/Reference_Package/Readme.md similarity index 100% rename from Reference_Package/Readme.md rename to _Archive/Reference_Package/Readme.md diff --git a/Single_File_Generator/C#/AssemblyInfo.cs b/_Archive/Single_File_Generator/C#/AssemblyInfo.cs similarity index 100% rename from Single_File_Generator/C#/AssemblyInfo.cs rename to _Archive/Single_File_Generator/C#/AssemblyInfo.cs diff --git a/Single_File_Generator/C#/BaseCodeGenerator.cs b/_Archive/Single_File_Generator/C#/BaseCodeGenerator.cs similarity index 100% rename from Single_File_Generator/C#/BaseCodeGenerator.cs rename to _Archive/Single_File_Generator/C#/BaseCodeGenerator.cs diff --git a/Single_File_Generator/C#/BaseCodeGeneratorWithSite.cs b/_Archive/Single_File_Generator/C#/BaseCodeGeneratorWithSite.cs similarity index 100% rename from Single_File_Generator/C#/BaseCodeGeneratorWithSite.cs rename to _Archive/Single_File_Generator/C#/BaseCodeGeneratorWithSite.cs diff --git a/Single_File_Generator/C#/Example.SingleFileGenerator.png b/_Archive/Single_File_Generator/C#/Example.SingleFileGenerator.png similarity index 100% rename from Single_File_Generator/C#/Example.SingleFileGenerator.png rename to _Archive/Single_File_Generator/C#/Example.SingleFileGenerator.png diff --git a/Single_File_Generator/C#/Example.XmlFile.xml b/_Archive/Single_File_Generator/C#/Example.XmlFile.xml similarity index 100% rename from Single_File_Generator/C#/Example.XmlFile.xml rename to _Archive/Single_File_Generator/C#/Example.XmlFile.xml diff --git a/Single_File_Generator/C#/GeneratorSample.csproj b/_Archive/Single_File_Generator/C#/GeneratorSample.csproj similarity index 100% rename from Single_File_Generator/C#/GeneratorSample.csproj rename to _Archive/Single_File_Generator/C#/GeneratorSample.csproj diff --git a/Single_File_Generator/C#/GeneratorSample.sln b/_Archive/Single_File_Generator/C#/GeneratorSample.sln similarity index 100% rename from Single_File_Generator/C#/GeneratorSample.sln rename to _Archive/Single_File_Generator/C#/GeneratorSample.sln diff --git a/Single_File_Generator/C#/Overview.xml b/_Archive/Single_File_Generator/C#/Overview.xml similarity index 100% rename from Single_File_Generator/C#/Overview.xml rename to _Archive/Single_File_Generator/C#/Overview.xml diff --git a/Single_File_Generator/C#/Package.ico b/_Archive/Single_File_Generator/C#/Package.ico similarity index 100% rename from Single_File_Generator/C#/Package.ico rename to _Archive/Single_File_Generator/C#/Package.ico diff --git a/Single_File_Generator/C#/SourceCodeGenerator.cs b/_Archive/Single_File_Generator/C#/SourceCodeGenerator.cs similarity index 100% rename from Single_File_Generator/C#/SourceCodeGenerator.cs rename to _Archive/Single_File_Generator/C#/SourceCodeGenerator.cs diff --git a/Single_File_Generator/C#/Strings.Designer.cs b/_Archive/Single_File_Generator/C#/Strings.Designer.cs similarity index 100% rename from Single_File_Generator/C#/Strings.Designer.cs rename to _Archive/Single_File_Generator/C#/Strings.Designer.cs diff --git a/Single_File_Generator/C#/Strings.resx b/_Archive/Single_File_Generator/C#/Strings.resx similarity index 100% rename from Single_File_Generator/C#/Strings.resx rename to _Archive/Single_File_Generator/C#/Strings.resx diff --git a/Single_File_Generator/C#/Thumbs.db b/_Archive/Single_File_Generator/C#/Thumbs.db similarity index 100% rename from Single_File_Generator/C#/Thumbs.db rename to _Archive/Single_File_Generator/C#/Thumbs.db diff --git a/Single_File_Generator/C#/XmlClassGenerator.cs b/_Archive/Single_File_Generator/C#/XmlClassGenerator.cs similarity index 100% rename from Single_File_Generator/C#/XmlClassGenerator.cs rename to _Archive/Single_File_Generator/C#/XmlClassGenerator.cs diff --git a/Single_File_Generator/C#/XmlClassGeneratorSchema.xsd b/_Archive/Single_File_Generator/C#/XmlClassGeneratorSchema.xsd similarity index 100% rename from Single_File_Generator/C#/XmlClassGeneratorSchema.xsd rename to _Archive/Single_File_Generator/C#/XmlClassGeneratorSchema.xsd diff --git a/Single_File_Generator/C#/XmlClassGeneratorSchema.xsx b/_Archive/Single_File_Generator/C#/XmlClassGeneratorSchema.xsx similarity index 100% rename from Single_File_Generator/C#/XmlClassGeneratorSchema.xsx rename to _Archive/Single_File_Generator/C#/XmlClassGeneratorSchema.xsx diff --git a/Single_File_Generator/C#/app.config b/_Archive/Single_File_Generator/C#/app.config similarity index 100% rename from Single_File_Generator/C#/app.config rename to _Archive/Single_File_Generator/C#/app.config diff --git a/Single_File_Generator/C#/packages.config b/_Archive/Single_File_Generator/C#/packages.config similarity index 100% rename from Single_File_Generator/C#/packages.config rename to _Archive/Single_File_Generator/C#/packages.config diff --git a/Single_File_Generator/C#/source.extension.vsixmanifest b/_Archive/Single_File_Generator/C#/source.extension.vsixmanifest similarity index 100% rename from Single_File_Generator/C#/source.extension.vsixmanifest rename to _Archive/Single_File_Generator/C#/source.extension.vsixmanifest diff --git a/Single_File_Generator/Readme.md b/_Archive/Single_File_Generator/Readme.md similarity index 100% rename from Single_File_Generator/Readme.md rename to _Archive/Single_File_Generator/Readme.md diff --git a/Source_Code_Control_Provider/C#/CommandId.cs b/_Archive/Source_Code_Control_Provider/C#/CommandId.cs similarity index 100% rename from Source_Code_Control_Provider/C#/CommandId.cs rename to _Archive/Source_Code_Control_Provider/C#/CommandId.cs diff --git a/Source_Code_Control_Provider/C#/DataStreamFromComStream.cs b/_Archive/Source_Code_Control_Provider/C#/DataStreamFromComStream.cs similarity index 100% rename from Source_Code_Control_Provider/C#/DataStreamFromComStream.cs rename to _Archive/Source_Code_Control_Provider/C#/DataStreamFromComStream.cs diff --git a/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.Designer.cs b/_Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.Designer.cs similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.Designer.cs rename to _Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.Designer.cs diff --git a/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.cs b/_Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.cs similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.cs rename to _Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.cs diff --git a/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.resx b/_Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.resx similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.resx rename to _Archive/Source_Code_Control_Provider/C#/DlgQueryEditCheckedInFile.resx diff --git a/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.Designer.cs b/_Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.Designer.cs similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.Designer.cs rename to _Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.Designer.cs diff --git a/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.cs b/_Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.cs similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.cs rename to _Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.cs diff --git a/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.resx b/_Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.resx similarity index 100% rename from Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.resx rename to _Archive/Source_Code_Control_Provider/C#/DlgQuerySaveCheckedInFile.resx diff --git a/Source_Code_Control_Provider/C#/Key.snk b/_Archive/Source_Code_Control_Provider/C#/Key.snk similarity index 100% rename from Source_Code_Control_Provider/C#/Key.snk rename to _Archive/Source_Code_Control_Provider/C#/Key.snk diff --git a/Source_Code_Control_Provider/C#/PkgCmd.vsct b/_Archive/Source_Code_Control_Provider/C#/PkgCmd.vsct similarity index 100% rename from Source_Code_Control_Provider/C#/PkgCmd.vsct rename to _Archive/Source_Code_Control_Provider/C#/PkgCmd.vsct diff --git a/Source_Code_Control_Provider/C#/Properties/AssemblyInfo.cs b/_Archive/Source_Code_Control_Provider/C#/Properties/AssemblyInfo.cs similarity index 100% rename from Source_Code_Control_Provider/C#/Properties/AssemblyInfo.cs rename to _Archive/Source_Code_Control_Provider/C#/Properties/AssemblyInfo.cs diff --git a/Source_Code_Control_Provider/C#/Properties/Guids.cs b/_Archive/Source_Code_Control_Provider/C#/Properties/Guids.cs similarity index 100% rename from Source_Code_Control_Provider/C#/Properties/Guids.cs rename to _Archive/Source_Code_Control_Provider/C#/Properties/Guids.cs diff --git a/Source_Code_Control_Provider/C#/ProvideSolutionProps.cs b/_Archive/Source_Code_Control_Provider/C#/ProvideSolutionProps.cs similarity index 100% rename from Source_Code_Control_Provider/C#/ProvideSolutionProps.cs rename to _Archive/Source_Code_Control_Provider/C#/ProvideSolutionProps.cs diff --git a/Source_Code_Control_Provider/C#/ProvideSourceControlProvider.cs b/_Archive/Source_Code_Control_Provider/C#/ProvideSourceControlProvider.cs similarity index 100% rename from Source_Code_Control_Provider/C#/ProvideSourceControlProvider.cs rename to _Archive/Source_Code_Control_Provider/C#/ProvideSourceControlProvider.cs diff --git a/Source_Code_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs b/_Archive/Source_Code_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs similarity index 100% rename from Source_Code_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs rename to _Archive/Source_Code_Control_Provider/C#/ProvideToolsOptionsPageVisibility.cs diff --git a/Source_Code_Control_Provider/C#/Resources.Designer.cs b/_Archive/Source_Code_Control_Provider/C#/Resources.Designer.cs similarity index 100% rename from Source_Code_Control_Provider/C#/Resources.Designer.cs rename to _Archive/Source_Code_Control_Provider/C#/Resources.Designer.cs diff --git a/Source_Code_Control_Provider/C#/Resources.resx b/_Archive/Source_Code_Control_Provider/C#/Resources.resx similarity index 100% rename from Source_Code_Control_Provider/C#/Resources.resx rename to _Archive/Source_Code_Control_Provider/C#/Resources.resx diff --git a/Source_Code_Control_Provider/C#/Resources/Example.SccProvider.png b/_Archive/Source_Code_Control_Provider/C#/Resources/Example.SccProvider.png similarity index 100% rename from Source_Code_Control_Provider/C#/Resources/Example.SccProvider.png rename to _Archive/Source_Code_Control_Provider/C#/Resources/Example.SccProvider.png diff --git a/Source_Code_Control_Provider/C#/Resources/Product.ico b/_Archive/Source_Code_Control_Provider/C#/Resources/Product.ico similarity index 100% rename from Source_Code_Control_Provider/C#/Resources/Product.ico rename to _Archive/Source_Code_Control_Provider/C#/Resources/Product.ico diff --git a/Source_Code_Control_Provider/C#/SccProvider.cs b/_Archive/Source_Code_Control_Provider/C#/SccProvider.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProvider.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProvider.cs diff --git a/Source_Code_Control_Provider/C#/SccProvider.csproj b/_Archive/Source_Code_Control_Provider/C#/SccProvider.csproj similarity index 100% rename from Source_Code_Control_Provider/C#/SccProvider.csproj rename to _Archive/Source_Code_Control_Provider/C#/SccProvider.csproj diff --git a/Source_Code_Control_Provider/C#/SccProvider.sln b/_Archive/Source_Code_Control_Provider/C#/SccProvider.sln similarity index 100% rename from Source_Code_Control_Provider/C#/SccProvider.sln rename to _Archive/Source_Code_Control_Provider/C#/SccProvider.sln diff --git a/Source_Code_Control_Provider/C#/SccProviderOptions.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderOptions.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderOptions.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderOptions.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderOptionsControl.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderOptionsControl.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderOptionsControl.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderOptionsControl.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderOptionsControl.resx b/_Archive/Source_Code_Control_Provider/C#/SccProviderOptionsControl.resx similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderOptionsControl.resx rename to _Archive/Source_Code_Control_Provider/C#/SccProviderOptionsControl.resx diff --git a/Source_Code_Control_Provider/C#/SccProviderService.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderService.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderService.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderService.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderStorage.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderStorage.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderStorage.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderStorage.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderToolWindow.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderToolWindow.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderToolWindow.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderToolWindow.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderToolWindow.resx b/_Archive/Source_Code_Control_Provider/C#/SccProviderToolWindow.resx similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderToolWindow.resx rename to _Archive/Source_Code_Control_Provider/C#/SccProviderToolWindow.resx diff --git a/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.cs b/_Archive/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.cs similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderToolWindowControl.cs rename to _Archive/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.cs diff --git a/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.resx b/_Archive/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.resx similarity index 100% rename from Source_Code_Control_Provider/C#/SccProviderToolWindowControl.resx rename to _Archive/Source_Code_Control_Provider/C#/SccProviderToolWindowControl.resx diff --git a/Source_Code_Control_Provider/C#/packages.config b/_Archive/Source_Code_Control_Provider/C#/packages.config similarity index 100% rename from Source_Code_Control_Provider/C#/packages.config rename to _Archive/Source_Code_Control_Provider/C#/packages.config diff --git a/Source_Code_Control_Provider/C#/source.extension.vsixmanifest b/_Archive/Source_Code_Control_Provider/C#/source.extension.vsixmanifest similarity index 100% rename from Source_Code_Control_Provider/C#/source.extension.vsixmanifest rename to _Archive/Source_Code_Control_Provider/C#/source.extension.vsixmanifest diff --git a/Source_Code_Control_Provider/Readme.md b/_Archive/Source_Code_Control_Provider/Readme.md similarity index 100% rename from Source_Code_Control_Provider/Readme.md rename to _Archive/Source_Code_Control_Provider/Readme.md diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/CommandId.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/CommandId.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/CommandId.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/CommandId.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DataStreamFromComStream.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DataStreamFromComStream.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DataStreamFromComStream.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DataStreamFromComStream.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.Designer.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.Designer.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.Designer.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.Designer.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQueryEditCheckedInFile.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.Designer.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.Designer.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.Designer.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.Designer.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/DlgQuerySaveCheckedInFile.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Example.SourceControlStatus.png b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Example.SourceControlStatus.png similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Example.SourceControlStatus.png rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Example.SourceControlStatus.png diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Guids.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Guids.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Guids.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Guids.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Key.snk b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Key.snk similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Key.snk rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Key.snk diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/PkgCmd.vsct b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/PkgCmd.vsct similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/PkgCmd.vsct rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/PkgCmd.vsct diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Properties/AssemblyInfo.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Properties/AssemblyInfo.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Properties/AssemblyInfo.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Properties/AssemblyInfo.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/ProvideSolutionProps.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/ProvideSolutionProps.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/ProvideSolutionProps.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/ProvideSolutionProps.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/ProvideToolsOptionsPageVisibility.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/ProvideToolsOptionsPageVisibility.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/ProvideToolsOptionsPageVisibility.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/ProvideToolsOptionsPageVisibility.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources.Designer.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources.Designer.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources.Designer.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources.Designer.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Example.SourceControlStatus.png b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Example.SourceControlStatus.png similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources/Example.SourceControlStatus.png rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Example.SourceControlStatus.png diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images.png b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images.png similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images.png rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images.png diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images_24bit.bmp b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images_24bit.bmp similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images_24bit.bmp rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Images_24bit.bmp diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Product.ico b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Product.ico similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/Resources/Product.ico rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/Resources/Product.ico diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.csproj b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.csproj similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.csproj rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.csproj diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.sln b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.sln similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.sln rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProvider.sln diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptions.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptions.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptions.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptions.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderOptionsControl.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccChanges.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccChanges.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccChanges.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccChanges.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentBranch.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentBranch.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentBranch.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentBranch.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentRepository.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentRepository.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentRepository.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccCurrentRepository.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccPublish.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccPublish.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccPublish.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccPublish.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccUnpublishedCommits.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccUnpublishedCommits.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccUnpublishedCommits.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService-IVsSccUnpublishedCommits.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderService.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderStorage.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderStorage.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderStorage.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderStorage.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindow.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.cs b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.cs similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.cs rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.cs diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.resx b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.resx similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.resx rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/SccProviderToolWindowControl.resx diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/packages.config b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/packages.config similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/packages.config rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/packages.config diff --git a/Source_Control_Provider_Status_Bar_Integration/C#/source.extension.vsixmanifest b/_Archive/Source_Control_Provider_Status_Bar_Integration/C#/source.extension.vsixmanifest similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/C#/source.extension.vsixmanifest rename to _Archive/Source_Control_Provider_Status_Bar_Integration/C#/source.extension.vsixmanifest diff --git a/Source_Control_Provider_Status_Bar_Integration/Readme.md b/_Archive/Source_Control_Provider_Status_Bar_Integration/Readme.md similarity index 100% rename from Source_Control_Provider_Status_Bar_Integration/Readme.md rename to _Archive/Source_Control_Provider_Status_Bar_Integration/Readme.md diff --git a/WPF_Toolwindow/C#/CommandId.cs b/_Archive/WPF_Toolwindow/C#/CommandId.cs similarity index 100% rename from WPF_Toolwindow/C#/CommandId.cs rename to _Archive/WPF_Toolwindow/C#/CommandId.cs diff --git a/WPF_Toolwindow/C#/CustomTypeDescriptor.cs b/_Archive/WPF_Toolwindow/C#/CustomTypeDescriptor.cs similarity index 100% rename from WPF_Toolwindow/C#/CustomTypeDescriptor.cs rename to _Archive/WPF_Toolwindow/C#/CustomTypeDescriptor.cs diff --git a/WPF_Toolwindow/C#/DynamicWindowPane.cs b/_Archive/WPF_Toolwindow/C#/DynamicWindowPane.cs similarity index 100% rename from WPF_Toolwindow/C#/DynamicWindowPane.cs rename to _Archive/WPF_Toolwindow/C#/DynamicWindowPane.cs diff --git a/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml b/_Archive/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml similarity index 100% rename from WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml rename to _Archive/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml diff --git a/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml.cs b/_Archive/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml.cs similarity index 100% rename from WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml.cs rename to _Archive/WPF_Toolwindow/C#/DynamicWindowWPFControl.xaml.cs diff --git a/WPF_Toolwindow/C#/Example.ToolWindow.png b/_Archive/WPF_Toolwindow/C#/Example.ToolWindow.png similarity index 100% rename from WPF_Toolwindow/C#/Example.ToolWindow.png rename to _Archive/WPF_Toolwindow/C#/Example.ToolWindow.png diff --git a/WPF_Toolwindow/C#/ListViewStyle.xaml b/_Archive/WPF_Toolwindow/C#/ListViewStyle.xaml similarity index 100% rename from WPF_Toolwindow/C#/ListViewStyle.xaml rename to _Archive/WPF_Toolwindow/C#/ListViewStyle.xaml diff --git a/WPF_Toolwindow/C#/Misc/Example.WPFToolWindows.png b/_Archive/WPF_Toolwindow/C#/Misc/Example.WPFToolWindows.png similarity index 100% rename from WPF_Toolwindow/C#/Misc/Example.WPFToolWindows.png rename to _Archive/WPF_Toolwindow/C#/Misc/Example.WPFToolWindows.png diff --git a/WPF_Toolwindow/C#/Misc/GlobalSuppressions.cs b/_Archive/WPF_Toolwindow/C#/Misc/GlobalSuppressions.cs similarity index 100% rename from WPF_Toolwindow/C#/Misc/GlobalSuppressions.cs rename to _Archive/WPF_Toolwindow/C#/Misc/GlobalSuppressions.cs diff --git a/WPF_Toolwindow/C#/Misc/Guids.cs b/_Archive/WPF_Toolwindow/C#/Misc/Guids.cs similarity index 100% rename from WPF_Toolwindow/C#/Misc/Guids.cs rename to _Archive/WPF_Toolwindow/C#/Misc/Guids.cs diff --git a/WPF_Toolwindow/C#/PackageToolWindow.cs b/_Archive/WPF_Toolwindow/C#/PackageToolWindow.cs similarity index 100% rename from WPF_Toolwindow/C#/PackageToolWindow.cs rename to _Archive/WPF_Toolwindow/C#/PackageToolWindow.cs diff --git a/WPF_Toolwindow/C#/PersistedWindowPane.cs b/_Archive/WPF_Toolwindow/C#/PersistedWindowPane.cs similarity index 100% rename from WPF_Toolwindow/C#/PersistedWindowPane.cs rename to _Archive/WPF_Toolwindow/C#/PersistedWindowPane.cs diff --git a/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml b/_Archive/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml similarity index 100% rename from WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml rename to _Archive/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml diff --git a/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml.cs b/_Archive/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml.cs similarity index 100% rename from WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml.cs rename to _Archive/WPF_Toolwindow/C#/PersistedWindowWPFControl.xaml.cs diff --git a/WPF_Toolwindow/C#/PkgCmd.vsct b/_Archive/WPF_Toolwindow/C#/PkgCmd.vsct similarity index 100% rename from WPF_Toolwindow/C#/PkgCmd.vsct rename to _Archive/WPF_Toolwindow/C#/PkgCmd.vsct diff --git a/WPF_Toolwindow/C#/PkgCmdId.cs b/_Archive/WPF_Toolwindow/C#/PkgCmdId.cs similarity index 100% rename from WPF_Toolwindow/C#/PkgCmdId.cs rename to _Archive/WPF_Toolwindow/C#/PkgCmdId.cs diff --git a/WPF_Toolwindow/C#/Resources.Designer.cs b/_Archive/WPF_Toolwindow/C#/Resources.Designer.cs similarity index 100% rename from WPF_Toolwindow/C#/Resources.Designer.cs rename to _Archive/WPF_Toolwindow/C#/Resources.Designer.cs diff --git a/WPF_Toolwindow/C#/Resources.resx b/_Archive/WPF_Toolwindow/C#/Resources.resx similarity index 100% rename from WPF_Toolwindow/C#/Resources.resx rename to _Archive/WPF_Toolwindow/C#/Resources.resx diff --git a/WPF_Toolwindow/C#/SelectionProperties.cs b/_Archive/WPF_Toolwindow/C#/SelectionProperties.cs similarity index 100% rename from WPF_Toolwindow/C#/SelectionProperties.cs rename to _Archive/WPF_Toolwindow/C#/SelectionProperties.cs diff --git a/WPF_Toolwindow/C#/ToolWindow.csproj b/_Archive/WPF_Toolwindow/C#/ToolWindow.csproj similarity index 100% rename from WPF_Toolwindow/C#/ToolWindow.csproj rename to _Archive/WPF_Toolwindow/C#/ToolWindow.csproj diff --git a/WPF_Toolwindow/C#/ToolWindow.sln b/_Archive/WPF_Toolwindow/C#/ToolWindow.sln similarity index 100% rename from WPF_Toolwindow/C#/ToolWindow.sln rename to _Archive/WPF_Toolwindow/C#/ToolWindow.sln diff --git a/WPF_Toolwindow/C#/WindowList.cs b/_Archive/WPF_Toolwindow/C#/WindowList.cs similarity index 100% rename from WPF_Toolwindow/C#/WindowList.cs rename to _Archive/WPF_Toolwindow/C#/WindowList.cs diff --git a/WPF_Toolwindow/C#/WindowStatus.cs b/_Archive/WPF_Toolwindow/C#/WindowStatus.cs similarity index 100% rename from WPF_Toolwindow/C#/WindowStatus.cs rename to _Archive/WPF_Toolwindow/C#/WindowStatus.cs diff --git a/WPF_Toolwindow/C#/packages.config b/_Archive/WPF_Toolwindow/C#/packages.config similarity index 100% rename from WPF_Toolwindow/C#/packages.config rename to _Archive/WPF_Toolwindow/C#/packages.config diff --git a/WPF_Toolwindow/C#/source.extension.vsixmanifest b/_Archive/WPF_Toolwindow/C#/source.extension.vsixmanifest similarity index 100% rename from WPF_Toolwindow/C#/source.extension.vsixmanifest rename to _Archive/WPF_Toolwindow/C#/source.extension.vsixmanifest diff --git a/WPF_Toolwindow/Readme.md b/_Archive/WPF_Toolwindow/Readme.md similarity index 100% rename from WPF_Toolwindow/Readme.md rename to _Archive/WPF_Toolwindow/Readme.md