Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions NiftyPerforce/NiftyPerforce.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.props')" />
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Expand Down Expand Up @@ -238,10 +238,10 @@
<PropertyGroup>
<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>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.14.0.23107\build\Microsoft.VSSDK.BuildTools.targets')" />
<Import Project="..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.16.4.21\build\Microsoft.VSSDK.BuildTools.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
34 changes: 20 additions & 14 deletions NiftyPerforce/NiftyPerforcePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
using Aurora;
using System.Windows.Forms;

using System.Threading;
using Task = System.Threading.Tasks.Task;

namespace NiftyPerforce
{
/// <summary>
Expand All @@ -39,13 +42,13 @@ namespace NiftyPerforce
/// To get loaded into VS, the package must be referred by &lt;Asset Type="Microsoft.VisualStudio.VsPackage" ...&gt; in .vsixmanifest file.
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true)]
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About
[ProvideAutoLoad(Microsoft.VisualStudio.VSConstants.UICONTEXT.NoSolution_string)] // Note: the package must be loaded on startup to create and bind commands
[ProvideAutoLoad(Microsoft.VisualStudio.VSConstants.UICONTEXT.NoSolution_string, PackageAutoLoadFlags.BackgroundLoad)] // Note: the package must be loaded on startup to create and bind commands
[Guid(NiftyPerforcePackage.PackageGuidString)]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
public sealed class NiftyPerforcePackage : Package
{
public sealed class NiftyPerforcePackage : AsyncPackage
{
/// <summary>
/// Package GUID string.
/// </summary>
Expand All @@ -69,18 +72,21 @@ public NiftyPerforcePackage()
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
base.Initialize();
await base.InitializeAsync(cancellationToken, progress);

// Load up the options from file.
string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml");
Config options = Config.Load(optionsFileName);
// Every plugin needs a command bar.
DTE2 application = await base.GetServiceAsync(typeof(DTE)).ConfigureAwait(false) as DTE2;
IVsProfferCommands3 profferCommands3 = await base.GetServiceAsync(typeof(SVsProfferCommands)) as IVsProfferCommands3;
OleMenuCommandService oleMenuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

// Every plugin needs a command bar.
DTE2 application = GetGlobalService(typeof(DTE)) as DTE2;
IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3;
OleMenuCommandService oleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
// Switches to the UI thread in order to consume some services used in command initialization
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

// Load up the options from file.
string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml");
Config options = Config.Load(optionsFileName);

ImageList icons = new ImageList();
icons.Images.AddStrip(Properties.Resources.Icons);
Expand Down Expand Up @@ -176,7 +182,7 @@ protected override void Initialize()
/// </summary>
private void Cleanup()
{
IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3;
IVsProfferCommands3 profferCommands3 = base.GetServiceAsync(typeof(SVsProfferCommands)) as IVsProfferCommands3;
RemoveCommandBar("NiftyPerforceCmdBar", profferCommands3);
RemoveCommandBar("NiftyPerforce", profferCommands3);

Expand Down
2 changes: 1 addition & 1 deletion NiftyPerforce/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
<package id="Microsoft.VisualStudio.Threading" version="14.0.50702" targetFramework="net452" />
<package id="Microsoft.VisualStudio.Utilities" version="14.0.23107" targetFramework="net452" />
<package id="Microsoft.VisualStudio.Validation" version="14.0.50702" targetFramework="net452" />
<package id="Microsoft.VSSDK.BuildTools" version="14.0.23107" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.VSSDK.BuildTools" version="16.4.21" targetFramework="net452" developmentDependency="true" />
</packages>
9 changes: 6 additions & 3 deletions NiftyPerforce/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="NiftyPerforce.Tilander.eb29cef1-a8b5-41b1-922d-6ba8cec91ef4" Version="2.0.2" Language="en-US" Publisher="Jim Tilander" />
<Identity Id="NiftyPerforce.Tilander.eb29cef1-a8b5-41b1-922d-6ba8cec91ef4" Version="2.0.3" Language="en-US" Publisher="Jim Tilander" />
<DisplayName>NiftyPerforce</DisplayName>
<Description xml:space="preserve">Simple Perforce integration for Visual Studio</Description>
<MoreInfo>https://github.com/jtilander/niftyplugins</MoreInfo>
<License>COPYING</License>
<Tags>perforce</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[11.0,15.0]" />
<InstallationTarget Version="[11.0,15.0)" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[11.0,17.0]" />
<InstallationTarget Version="[11.0,17.0)" Id="Microsoft.VisualStudio.Pro" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[11.0,17.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>