Skip to content
Permalink
Browse files

[VSPackage] Update to new AsyncPackage and upgrade/cleanup unecessary…

… PackageReference
  • Loading branch information
xen2 committed May 5, 2019
1 parent c6a35d6 commit 468faa7de46d2cbdc36aef745f15edacc3f841c0
@@ -25,40 +25,14 @@
<None Remove="NShader\Common\XenkoShaderKeywords.map" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EnvDTE" Version="8.0.1" />
<PackageReference Include="EnvDTE100" Version="10.0.1" />
<PackageReference Include="EnvDTE80" Version="8.0.1" />
<PackageReference Include="EnvDTE90" Version="9.0.1" />
<PackageReference Include="Microsoft.Build" Version="16.0.461" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.0.461" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.VisualStudio.CoreUtility" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Designer.Interfaces" Version="1.1.4322" />
<PackageReference Include="EnvDTE80" Version="8.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Designer.Interfaces" Version="1.1.4323" />
<PackageReference Include="Microsoft.VisualStudio.Editor" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Imaging" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Language.StandardClassification" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="7.10.6071" />
<PackageReference Include="Microsoft.VisualStudio.Package.LanguageService.14.0" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Shell.14.0" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" Version="10.0.30319" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" Version="11.0.50727" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Immutable.12.0" Version="12.0.21003" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Immutable.14.0" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="7.10.6071" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.10.0" Version="10.0.30319" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.8.0" Version="8.0.50727" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.9.0" Version="9.0.30729" />
<PackageReference Include="Microsoft.VisualStudio.Text.Data" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Text.Logic" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.TextManager.Interop" Version="7.10.6070" />
<PackageReference Include="Microsoft.VisualStudio.TextManager.Interop.8.0" Version="8.0.50727" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="14.0.51107" />
<PackageReference Include="Microsoft.VisualStudio.Utilities" Version="14.0.23205" />
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="14.0.51103" />
<PackageReference Include="stdole" Version="7.0.3301" />
<PackageReference Include="VSLangProj" Version="7.0.3300" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.0.26201" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime" Version="14.0.25023" />
<PackageReference Include="VSLangProj" Version="7.0.3301" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.0.26201" />

<Reference Include="Microsoft.CSharp" />
<Reference Include="System.ComponentModel.Composition" />
@@ -71,17 +45,6 @@
<Reference Include="WindowsBase" />
<Reference Include="System.Xaml" />
</ItemGroup>
<ItemGroup>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\assets\Xenko.Core.Assets\PackageSessionHelper.Solution.cs">
<Link>Assets\PackageSessionHelper.Solution.cs</Link>
@@ -27,6 +27,7 @@ public static class XenkoCommands
{
static class ProjectItemKind
{
public static string SolutionFolder = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}";
public static string PhysicalFile = "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}";
public static string PhysicalFolder = "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}";
public static string VirtualFolder = "{6BB5F8F0-4483-11D3-8BCF-00C04F8EC28C}";
@@ -113,7 +114,7 @@ private static IEnumerable<Project> Projects()
if (project == null)
continue;

if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder)
if (project.Kind == ProjectItemKind.SolutionFolder)
{
// Solution folder: recursive call
projects.AddRange(GetSolutionFolderProjects(project));
@@ -138,7 +139,7 @@ private static IEnumerable<Project> GetSolutionFolderProjects(Project solutionFo
if (subProject == null)
continue;

if (subProject.Kind == ProjectKinds.vsProjectKindSolutionFolder)
if (subProject.Kind == ProjectItemKind.SolutionFolder)
{
// Solution folder: recursive call
projects.AddRange(GetSolutionFolderProjects(subProject));
@@ -8,6 +8,8 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using EnvDTE;
using EnvDTE80;
using Microsoft.Build.Evaluation;
@@ -16,10 +18,12 @@
using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Threading;
using NShader;
using Xenko.VisualStudio.BuildEngine;
using Xenko.VisualStudio.Commands;
using Xenko.VisualStudio.Shaders;
using Task = System.Threading.Tasks.Task;

namespace Xenko.VisualStudio
{
@@ -38,7 +42,7 @@ namespace Xenko.VisualStudio
/// </summary>
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
// a package.
[PackageRegistration(UseManagedResourcesOnly = true)]
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
// This attribute is used to register the information needed to show this package
// in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", Version, IconResourceID = 400)]
@@ -48,7 +52,7 @@ namespace Xenko.VisualStudio
//[ProvideToolWindow(typeof (MyToolWindow))]
[Guid(GuidList.guidXenko_VisualStudio_PackagePkgString)]
// Xenko Shader LanguageService
[ProvideService(typeof(NShaderLanguageService), ServiceName = "Xenko Shader Language Service")]
[ProvideService(typeof(NShaderLanguageService), ServiceName = "Xenko Shader Language Service", IsAsyncQueryable = true)]
[ProvideLanguageServiceAttribute(typeof(NShaderLanguageService),
"Xenko Shader Language",
0,
@@ -69,8 +73,8 @@ namespace Xenko.VisualStudio
[CodeGeneratorRegistration(typeof(ShaderKeyFileGenerator), ShaderKeyFileGenerator.DisplayName, GuidList.vsContextGuidVCSNewProject, GeneratorRegKeyName = ShaderKeyFileGenerator.InternalName, GeneratesDesignTimeSource = true, GeneratesSharedDesignTimeSource = true)]
// Temporarily force load for easier debugging
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)]
public sealed class XenkoPackage : Package, IOleComponent
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string, PackageAutoLoadFlags.BackgroundLoad)]
public sealed class XenkoPackage : AsyncPackage, IOleComponent
{
public const string Version = "2.0";

@@ -103,13 +107,17 @@ public XenkoPackage()
/// 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)
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString()));
base.Initialize();
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering InitializeAsync() of: {0}", ToString()));
await base.InitializeAsync(cancellationToken, progress);

IDEBuildLogger.UserRegistryRoot = UserRegistryRoot;

// Switching to main thread to use GetService RPC and cast to service interface (which may involve COM operations)
// Note: most of our work is not supposed to be heavy, mostly registration of services and callbacks
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

solutionEventsListener = new SolutionEventsListener(this);
solutionEventsListener.BeforeSolutionClosed += solutionEventsListener_BeforeSolutionClosed;
solutionEventsListener.AfterSolutionBackgroundLoadComplete += solutionEventsListener_AfterSolutionBackgroundLoadComplete;
@@ -131,7 +139,7 @@ protected override void Initialize()
serviceContainer.AddService(typeof(NShaderLanguageService), langService, true);

// Add our command handlers for menu (commands must exist in the .vsct file)
var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
var mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
XenkoCommands.ServiceProvider = this;
@@ -154,6 +162,9 @@ protected override void Initialize()
crinfo[0].uIdleTimeInterval = 1000;
int hr = mgr.FRegisterComponent(this, crinfo, out m_componentID);
}

// Go back to async thread
await TaskScheduler.Default;
}

public static bool IsProjectExecutable(EnvDTE.Project project)

0 comments on commit 468faa7

Please sign in to comment.
You can’t perform that action at this time.