Skip to content

How to Enable a command based on the name of a Solution Folder #566

@GFlisch

Description

@GFlisch

I have a Command appearing when a user right click on a Solution Folder in the Solution Explorer.

I would like to activate this menu only when the Solution Folder is named 'BE'.

I have tried with this code but it doesn't work. Any idea?

        public override CommandConfiguration CommandConfiguration => new("%Arc4u.Blueprint.OutOfProcComponent.AddMicroServiceToSolutionCommand.DisplayName%")
        {
            Icon = new(ImageMoniker.Custom("Arc4u"), IconSettings.IconAndText),
            VisibleWhen = ActivationConstraint.And(
                            ActivationConstraint.SolutionState(SolutionState.FullyLoaded),
                            ActivationConstraint.ClientContext(ClientContextKey.Shell.ActiveSelectionFileName, @"^BE$")),
            Placements =
            [
                // Place in IDG_VS_CTXT_SLNFLDR_ADD (0x0264) -- the "Add" group on the Solution Folder right-click context menu
                CommandPlacement.VsctParent(new Guid("{d309f791-903f-11d0-9efc-00a0c911004f}"), id: 0x0264, priority: 0x0601),
            ],
        };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions