dotnet / dotnet/project-system

Improve ability to specify a property's default value

Open
#8,152 1 comment 0 reactions 0 assignees View on GitHub
Feature-Project-Properties-Designer Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

(From https://github.com/dotnet/project-system/pull/8142#pullrequestreview-966877877)

Currently we require exporting an `IInterceptingPropertyValueProvider` and using `OnGetUnevaluatedPropertyValueAsync` in order to provide a default value for the property.

The XAML model for properties (in rules) has [`BaseProperty.Default`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.build.framework.xamltypes.baseproperty.default?view=msbuild-17), however we do not honour this property. It would simplify things if we did.

Additionally, the [`ExportInterceptingPropertyValueProviderFile`](https://github.com/dotnet/project-system/blob/e5eba059252e9eb51eb0d074c20b879fee7eae09/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Properties/InterceptedProjectProperties/ExportInterceptingPropertyValueProviderAttribute.cs#L46-L68) enum passed to the `ExportInterceptingPropertyValueProviderAttribute` constructor has `UserFileWithXamlDefaults` but not `ProjectFileWithXamlDefaults`. We should investigate adding that, but equally we should not require the use of an interceptor to specify a default value for a property.

Any change here should be reflected in our documentation.

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.