question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set collapsed project icon using IProjectTreePropertiesProvider

See original GitHub issue

This issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard.


When setting the icon of the project tree using IProjectTreePropertiesProvider the Icon property doesn’t change the icon that is showned. It’s always the default C# proect.

Here’s the code I’m using:

[Export(typeof(IProjectTreePropertiesProvider))]
[AppliesTo(NanoCSharpProjectUnconfigured.UniqueCapability)]
internal class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider
{
    /// <summary>
    /// Calculates new property values for each node in the project tree.
    /// </summary>
    /// <param name="propertyContext">Context information that can be used for the calculation.</param>
    /// <param name="propertyValues">Values calculated so far for the current node by lower priority tree properties providers.</param>
    public void CalculatePropertyValues(
        IProjectTreeCustomizablePropertyContext propertyContext,
        IProjectTreeCustomizablePropertyValues propertyValues)
    {
        // set the icon for the root project node
        if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot))
        {
            propertyValues.Icon = KnownMonikers.AbstractCube.ToProjectSystemType(); ;// NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
            propertyValues.ExpandedIcon = NanoFrameworkMonikers.NanoFrameworkProject.ToProjectSystemType();
        }
    }
}

To rule out any issues with the icon format on my resources, I’ve momentarily replaced it with one of VS stock icons, as can be seen from the above. The result is the same.

The ExpandedIcon property does work.

Attaching screenshots of a project tree expanded and colapsed for illustration.

Worth noting that this happens in both VS2017 and VS2019.


Original Comments

Visual Studio Feedback System (6/10/2019, 04:18 PM)

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

José Simões (7/17/2019, 06:09 PM)

Hi,

Any update on this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
drewnoakescommented, Jul 26, 2019

Glad to hear you got it working. I agree the comment is confusing. Take a look at https://github.com/microsoft/VSProjectSystem/pull/327 and see if you find it an improvement.

Thanks again for your feedback and helping to improve the project system!

1reaction
drewnoakescommented, Jul 26, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Icon property in IProjectTreePropertiesProvider is not working
When setting the icon of the project tree using IProjectTreePropertiesProvider the "Icon" property doesn't change the icon that is showned.
Read more >
Cannot Expand/Collapse tasks in Microsoft Project 2010
I am able to expand and collapse using the 'View->Outline' ribbon icon. However when I attempt to do this using the mouse on...
Read more >
Visual Studio Installer Project - shortcut icons not set
I resolved it in VSI, by using the Properties window for the shortcut, on the Icon property, select Browse from the DDL, then...
Read more >
Expand Collapse only a select portion of the project
I just want to be able to expand one summary item at a time without having to press the little icons next to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found