Skip to content

Commit 9cfc8c4

Browse files
committed
Added GtmPackage.
1 parent 62ac154 commit 9cfc8c4

8 files changed

Lines changed: 377 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
/.vs/
33
bin/
44
obj/
5+
6+
# NuGet
7+
/packages/

src/GtmExtension/GtmExtension.csproj

Lines changed: 129 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.props')" />
34
<PropertyGroup>
45
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
56
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
7+
<NuGetPackageImportStamp>
8+
</NuGetPackageImportStamp>
9+
<UseCodebase>true</UseCodebase>
10+
</PropertyGroup>
11+
<PropertyGroup>
12+
<SignAssembly>true</SignAssembly>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
616
</PropertyGroup>
717
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
818
<PropertyGroup>
@@ -16,11 +26,11 @@
1626
<RootNamespace>GtmExtension</RootNamespace>
1727
<AssemblyName>GtmExtension</AssemblyName>
1828
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
19-
<GeneratePkgDefFile>false</GeneratePkgDefFile>
20-
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
21-
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
22-
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
23-
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
29+
<GeneratePkgDefFile>true</GeneratePkgDefFile>
30+
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
31+
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
32+
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment>
33+
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
2434
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
2535
<StartAction>Program</StartAction>
2636
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
@@ -44,19 +54,133 @@
4454
<WarningLevel>4</WarningLevel>
4555
</PropertyGroup>
4656
<ItemGroup>
57+
<Compile Include="GtmPackage.cs" />
4758
<Compile Include="Properties\AssemblyInfo.cs" />
4859
</ItemGroup>
4960
<ItemGroup>
61+
<None Include="Key.snk" />
62+
<None Include="packages.config" />
5063
<None Include="source.extension.vsixmanifest">
5164
<SubType>Designer</SubType>
5265
</None>
5366
</ItemGroup>
5467
<ItemGroup>
5568
<Content Include="index.html" />
69+
<Content Include="Resources\GtmPackage.ico" />
5670
<Content Include="stylesheet.css" />
5771
</ItemGroup>
72+
<ItemGroup>
73+
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
74+
<EmbedInteropTypes>False</EmbedInteropTypes>
75+
</Reference>
76+
<Reference Include="EnvDTE100, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
77+
<EmbedInteropTypes>False</EmbedInteropTypes>
78+
</Reference>
79+
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
80+
<EmbedInteropTypes>False</EmbedInteropTypes>
81+
</Reference>
82+
<Reference Include="EnvDTE90, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
83+
<EmbedInteropTypes>False</EmbedInteropTypes>
84+
</Reference>
85+
<Reference Include="Microsoft.CSharp" />
86+
<Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
87+
<EmbedInteropTypes>False</EmbedInteropTypes>
88+
</Reference>
89+
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
90+
<HintPath>..\..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26228\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
91+
</Reference>
92+
<Reference Include="Microsoft.VisualStudio.Imaging, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
93+
<HintPath>..\..\packages\Microsoft.VisualStudio.Imaging.15.0.26228\lib\net45\Microsoft.VisualStudio.Imaging.dll</HintPath>
94+
</Reference>
95+
<Reference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
96+
<HintPath>..\..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.25408\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll</HintPath>
97+
<EmbedInteropTypes>True</EmbedInteropTypes>
98+
</Reference>
99+
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
100+
<HintPath>..\..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
101+
</Reference>
102+
<Reference Include="Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
103+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26228\lib\Microsoft.VisualStudio.Shell.15.0.dll</HintPath>
104+
</Reference>
105+
<Reference Include="Microsoft.VisualStudio.Shell.Framework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
106+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26228\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll</HintPath>
107+
</Reference>
108+
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
109+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
110+
</Reference>
111+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
112+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll</HintPath>
113+
<EmbedInteropTypes>True</EmbedInteropTypes>
114+
</Reference>
115+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
116+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll</HintPath>
117+
<EmbedInteropTypes>True</EmbedInteropTypes>
118+
</Reference>
119+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
120+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll</HintPath>
121+
<EmbedInteropTypes>True</EmbedInteropTypes>
122+
</Reference>
123+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
124+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll</HintPath>
125+
<EmbedInteropTypes>True</EmbedInteropTypes>
126+
</Reference>
127+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
128+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
129+
</Reference>
130+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
131+
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
132+
</Reference>
133+
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
134+
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
135+
</Reference>
136+
<Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
137+
<HintPath>..\..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>
138+
</Reference>
139+
<Reference Include="Microsoft.VisualStudio.Threading, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
140+
<HintPath>..\..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
141+
</Reference>
142+
<Reference Include="Microsoft.VisualStudio.Utilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
143+
<HintPath>..\..\packages\Microsoft.VisualStudio.Utilities.15.0.26228\lib\net46\Microsoft.VisualStudio.Utilities.dll</HintPath>
144+
</Reference>
145+
<Reference Include="Microsoft.VisualStudio.Validation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
146+
<HintPath>..\..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
147+
</Reference>
148+
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
149+
<EmbedInteropTypes>False</EmbedInteropTypes>
150+
</Reference>
151+
<Reference Include="System" />
152+
<Reference Include="System.Data" />
153+
<Reference Include="System.Design" />
154+
<Reference Include="System.Drawing" />
155+
<Reference Include="System.Windows.Forms" />
156+
<Reference Include="System.Xml" />
157+
</ItemGroup>
158+
<ItemGroup>
159+
<Analyzer Include="..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\analyzers\cs\Microsoft.VisualStudio.SDK.Analyzers.dll" />
160+
<Analyzer Include="..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.dll" />
161+
</ItemGroup>
162+
<ItemGroup>
163+
<EmbeddedResource Include="VSPackage.resx">
164+
<MergeWithCTO>true</MergeWithCTO>
165+
<ManifestResourceName>VSPackage</ManifestResourceName>
166+
</EmbeddedResource>
167+
</ItemGroup>
58168
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59169
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
170+
<Import Project="..\..\packages\Microsoft.VisualStudio.SDK.EmbedInteropTypes.15.0.10\build\Microsoft.VisualStudio.SDK.EmbedInteropTypes.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.SDK.EmbedInteropTypes.15.0.10\build\Microsoft.VisualStudio.SDK.EmbedInteropTypes.targets')" />
171+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
172+
<PropertyGroup>
173+
<ErrorText>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}.</ErrorText>
174+
</PropertyGroup>
175+
<Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.SDK.EmbedInteropTypes.15.0.10\build\Microsoft.VisualStudio.SDK.EmbedInteropTypes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.SDK.EmbedInteropTypes.15.0.10\build\Microsoft.VisualStudio.SDK.EmbedInteropTypes.targets'))" />
176+
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.props'))" />
177+
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.targets'))" />
178+
<Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets'))" />
179+
<Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets'))" />
180+
</Target>
181+
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.8.3246\build\Microsoft.VSSDK.BuildTools.targets')" />
182+
<Import Project="..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.SDK.Analyzers.15.8.33\build\Microsoft.VisualStudio.SDK.Analyzers.targets')" />
183+
<Import Project="..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.122\build\Microsoft.VisualStudio.Threading.Analyzers.targets')" />
60184
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
61185
Other similar extension points exist, see Microsoft.Common.targets.
62186
<Target Name="BeforeBuild">

src/GtmExtension/GtmPackage.cs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using System;
2+
using System.ComponentModel.Design;
3+
using System.Diagnostics;
4+
using System.Diagnostics.CodeAnalysis;
5+
using System.Globalization;
6+
using System.Runtime.InteropServices;
7+
using System.Threading;
8+
using System.Threading.Tasks;
9+
using Microsoft.VisualStudio;
10+
using Microsoft.VisualStudio.OLE.Interop;
11+
using Microsoft.VisualStudio.Shell;
12+
using Microsoft.VisualStudio.Shell.Interop;
13+
using Microsoft.Win32;
14+
using Task = System.Threading.Tasks.Task;
15+
16+
namespace GtmExtension
17+
{
18+
/// <summary>
19+
/// This is the class that implements the package exposed by this assembly.
20+
/// </summary>
21+
/// <remarks>
22+
/// <para>
23+
/// The minimum requirement for a class to be considered a valid package for Visual Studio
24+
/// is to implement the IVsPackage interface and register itself with the shell.
25+
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
26+
/// to do it: it derives from the Package class that provides the implementation of the
27+
/// IVsPackage interface and uses the registration attributes defined in the framework to
28+
/// register itself and its components with the shell. These attributes tell the pkgdef creation
29+
/// utility what data to put into .pkgdef file.
30+
/// </para>
31+
/// <para>
32+
/// To get loaded into VS, the package must be referred by &lt;Asset Type="Microsoft.VisualStudio.VsPackage" ...&gt; in .vsixmanifest file.
33+
/// </para>
34+
/// </remarks>
35+
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
36+
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About
37+
[Guid(GtmPackage.PackageGuidString)]
38+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
39+
public sealed class GtmPackage : AsyncPackage
40+
{
41+
/// <summary>
42+
/// GtmPackage GUID string.
43+
/// </summary>
44+
public const string PackageGuidString = "208330cb-08c8-4105-b9b2-8f010fbeaf49";
45+
46+
/// <summary>
47+
/// Initializes a new instance of the <see cref="GtmPackage"/> class.
48+
/// </summary>
49+
public GtmPackage()
50+
{
51+
// Inside this method you can place any initialization code that does not require
52+
// any Visual Studio service because at this point the package object is created but
53+
// not sited yet inside Visual Studio environment. The place to do all the other
54+
// initialization is the Initialize method.
55+
}
56+
57+
#region Package Members
58+
59+
/// <summary>
60+
/// Initialization of the package; this method is called right after the package is sited, so this is the place
61+
/// where you can put all the initialization code that rely on services provided by VisualStudio.
62+
/// </summary>
63+
/// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
64+
/// <param name="progress">A provider for progress updates.</param>
65+
/// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
66+
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
67+
{
68+
// When initialized asynchronously, the current thread may be a background thread at this point.
69+
// Do any initialization that requires the UI thread after switching to the UI thread.
70+
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
71+
}
72+
73+
#endregion
74+
}
75+
}

src/GtmExtension/Key.snk

596 Bytes
Binary file not shown.
418 KB
Binary file not shown.

0 commit comments

Comments
 (0)