dotnet / dotnet/project-system

IProjectProperties contains no API for getting a property value with dimensional conditions

Open
#7,658 2 comments 0 reactions 1 assignee Claimed by @tmeschter View on GitHub
Feature-Project-Properties-Designer Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

## Summary
The [IProjectProperties interface](http://index/?rightProject=Microsoft.VisualStudio.ProjectSystem&file=ProjectProperties%5CIProjectProperties.cs&line=89) contains a function which allows you to set a property value for some dimensional conditions:
`Task SetPropertyValueAsync(string propertyName, string unevaluatedPropertyValue, IReadOnlyDictionary? dimensionalConditions = null);`

However, there is no symmetric function that allows us to get a property value under specific dimensional conditions.

I was expecting something like this to exist and was surprised to learn it doesn't:
`Task GetEvaluatedPropertyValueAsync(string propertyName, IReadOnlyDictionary? dimensionalConditions = null);`

## User Impact
I've encountered a scenario where I need to read/write a property value to the project file for some non-standard dimensional conditions (`"$(RunConfiguration)=='Default'"`) within an intercepting value provider.

I'm able to write just fine using the API mentioned above, but to read from the project file I currently need to use [IProjectLockService](http://index/?rightProject=Microsoft.VisualStudio.ProjectSystem&file=Core%5cProjectLock%5cIProjectLockService.cs&line=96) which allows me to directly parse the xml.

This works fine for now, but it would be much simpler if we could just call Get(Un)EvaluatedPropertyValueAsync with dimensional conditions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.