mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 02:02:30 +00:00
Project system fixes for VS 2019.
This commit is contained in:
parent
420ca1c715
commit
5cf4dbd990
6 changed files with 65 additions and 11 deletions
|
|
@ -0,0 +1,17 @@
|
|||
using System.ComponentModel.Composition;
|
||||
using Microsoft.VisualStudio.ProjectSystem;
|
||||
|
||||
namespace Cosmos.VS.ProjectSystem.CompatMocks
|
||||
{
|
||||
[Export]
|
||||
internal sealed class ConfiguredProjectMock
|
||||
{
|
||||
[ImportingConstructor]
|
||||
public ConfiguredProjectMock(ConfiguredProjectServicesMock configuredProjectServicesMock)
|
||||
{
|
||||
Services = configuredProjectServicesMock;
|
||||
}
|
||||
|
||||
public ConfiguredProjectServicesMock Services { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using System.ComponentModel.Composition;
|
||||
using Microsoft.VisualStudio.Composition;
|
||||
using Microsoft.VisualStudio.ProjectSystem;
|
||||
using Microsoft.VisualStudio.ProjectSystem.Properties;
|
||||
|
||||
namespace Cosmos.VS.ProjectSystem.CompatMocks
|
||||
{
|
||||
[Export]
|
||||
internal sealed class ConfiguredProjectServicesMock
|
||||
{
|
||||
[ImportingConstructor]
|
||||
public ConfiguredProjectServicesMock(
|
||||
IAdditionalRuleDefinitionsService additionalRuleDefinitions,
|
||||
IPropertyPagesCatalogProvider propertyPagesCatalog)
|
||||
{
|
||||
AdditionalRuleDefinitions = additionalRuleDefinitions;
|
||||
PropertyPagesCatalog = propertyPagesCatalog;
|
||||
}
|
||||
|
||||
public IAdditionalRuleDefinitionsService AdditionalRuleDefinitions { get; }
|
||||
|
||||
public IPropertyPagesCatalogProvider PropertyPagesCatalog { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
<XamlPropertyRule Include="BuildSystem\Rules\LaunchConfiguration.xaml" />
|
||||
<XamlPropertyRule Include="BuildSystem\Rules\PackageReference.xaml" />
|
||||
<XamlPropertyRule Include="BuildSystem\Rules\ResolvedPackageReference.xaml" />
|
||||
<XamlPropertyRule Update="@(XamlPropertyRule)" ConfiguredProjectTypeName="Cosmos.VS.ProjectSystem.CompatMocks.ConfiguredProjectMock" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,25 @@
|
|||
using System.Composition;
|
||||
using Microsoft.VisualStudio.Composition;
|
||||
using Microsoft.VisualStudio.ProjectSystem;
|
||||
using Microsoft.VisualStudio.ProjectSystem.Properties;
|
||||
|
||||
using Cosmos.VS.ProjectSystem.CompatMocks;
|
||||
|
||||
namespace Cosmos.VS.ProjectSystem
|
||||
{
|
||||
[Export]
|
||||
internal partial class ProjectProperties : StronglyTypedPropertyAccess
|
||||
{
|
||||
public new ConfiguredProjectMock ConfiguredProject { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ProjectProperties"/> class.
|
||||
/// </summary>
|
||||
[ImportingConstructor]
|
||||
public ProjectProperties(ConfiguredProject configuredProject)
|
||||
public ProjectProperties(ConfiguredProject configuredProject, ConfiguredProjectMock configuredProjectMock)
|
||||
: base(configuredProject)
|
||||
{
|
||||
ConfiguredProject = configuredProjectMock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -22,18 +22,23 @@ namespace Cosmos.VS.ProjectSystem.VS.Debug
|
|||
{
|
||||
private static readonly Guid CosmosDebugEngineGuid = new Guid("fa1da3a6-66ff-4c65-b077-e65f7164ef83");
|
||||
|
||||
private ProjectProperties _projectProperties;
|
||||
private IBootableProperties _bootableProperties;
|
||||
private readonly ProjectProperties _projectProperties;
|
||||
private readonly IBootableProperties _bootableProperties;
|
||||
|
||||
private readonly IProjectLockService _projectLockService;
|
||||
|
||||
[ImportingConstructor]
|
||||
public DebugLaunchProvider(
|
||||
ConfiguredProject configuredProject,
|
||||
ProjectProperties projectProperties,
|
||||
IBootableProperties bootableProperties)
|
||||
IBootableProperties bootableProperties,
|
||||
IProjectLockService projectLockService)
|
||||
: base(configuredProject)
|
||||
{
|
||||
_projectProperties = projectProperties;
|
||||
_bootableProperties = bootableProperties;
|
||||
|
||||
_projectLockService = projectLockService;
|
||||
}
|
||||
|
||||
public override Task<bool> CanLaunchAsync(DebugLaunchOptions aLaunchOptions) => TplExtensions.TrueTask;
|
||||
|
|
@ -110,9 +115,7 @@ namespace Cosmos.VS.ProjectSystem.VS.Debug
|
|||
|
||||
private async Task<string> GetPropertyAsync(string propertyName)
|
||||
{
|
||||
var projectLockService = ConfiguredProject.UnconfiguredProject.ProjectService.Services.ProjectLockService;
|
||||
|
||||
using (var projectReadLock = await projectLockService.ReadLockAsync())
|
||||
using (var projectReadLock = await _projectLockService.ReadLockAsync())
|
||||
{
|
||||
var project = await projectReadLock.GetProjectAsync(ConfiguredProject);
|
||||
return project.GetPropertyValue(propertyName);
|
||||
|
|
|
|||
|
|
@ -17,14 +17,18 @@ namespace Cosmos.VS.ProjectSystem.VS
|
|||
private static readonly ProjectTreeFlags PlugsProjectTreeFlags = ProjectTreeFlags.Create(
|
||||
ProjectTreeFlags.Common.BubbleUp | ProjectTreeFlags.Common.VirtualFolder);
|
||||
|
||||
private readonly IActiveConfiguredProjectSubscriptionService _activeConfiguredProjectSubscriptionService;
|
||||
|
||||
private IDisposable _itemsSubscriptionLink;
|
||||
|
||||
[ImportingConstructor]
|
||||
protected PlugsProjectTreeProvider(
|
||||
IProjectThreadingService threadingService,
|
||||
UnconfiguredProject unconfiguredProject)
|
||||
UnconfiguredProject unconfiguredProject,
|
||||
IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService)
|
||||
: base(threadingService, unconfiguredProject)
|
||||
{
|
||||
_activeConfiguredProjectSubscriptionService = activeConfiguredProjectSubscriptionService;
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
|
|
@ -37,8 +41,7 @@ namespace Cosmos.VS.ProjectSystem.VS
|
|||
return Task.FromResult(new TreeUpdateResult(CreatePlugsFolder(), true));
|
||||
});
|
||||
|
||||
var subscriptionService = UnconfiguredProject.Services.ActiveConfiguredProjectSubscription;
|
||||
var itemsBlock = subscriptionService.ProjectCatalogSource.SourceBlock;
|
||||
var itemsBlock = _activeConfiguredProjectSubscriptionService.ProjectCatalogSource.SourceBlock;
|
||||
var targetBlock = new ActionBlock<IProjectVersionedValue<IProjectCatalogSnapshot>>(ItemsChangedAsync);
|
||||
|
||||
_itemsSubscriptionLink = itemsBlock.LinkTo(
|
||||
|
|
@ -95,7 +98,7 @@ namespace Cosmos.VS.ProjectSystem.VS
|
|||
{
|
||||
var tree = oldTree.ClearChildren();
|
||||
|
||||
foreach (var reference in snapshot.Project.Value.GetItems("PlugsReference"))
|
||||
foreach (var reference in snapshot.Project.ProjectInstance.GetItems("PlugsReference"))
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue