dotnet / dotnet/project-system

Implicit configuration syntax support

Open
#5,599 3 comments 1 reaction 1 assignee Assigned to @davkean View on GitHub
Feature-Configurations Parity-Legacy-Feature Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

(Written by @davkean)

# Background

Legacy projects detect their configuration dimensions by inspecting `Condition` attributes.

For example given the following constructs:

```xml


```

The project would be considered as having the following dimensions and values:

Configuration|Platform
---|---
Debug|AnyCPU
Release|AnyCPU

This is contrast to the new project system that declares its dimensions and values via properties.

For example, the above configurations would be declared using the following:

```xml

Debug;Release
AnyCPU

```

Currently, whether a project opts into either of these configuration systems is determined at the project factory level via "fixed" capabilities (ProjectConfigurationsInferredFromUsage, ProjectConfigurationsDeclaredDimensions respectively), well before the project file itself has been parsed or evaluated by CPS.

As we start opting legacy projects automatically into the new project system, we will need a mechanism to transparently pick configuration system based on the contents of the project file. Given live reload of a project from on-disk changes (due to a something like a Git branch switch), we will also likely need to support changing configurations _while_ a project is loaded.

# Issues

- ~Legacy project uses Project.ConditionedProperties, which will not return correct value when with `ProjectLoadSettings.DoNotEvaluateElementsWithFalseCondition` setting which when turned on, [has other performance implications](https://github.com/microsoft/msbuild/issues/2502). We need a mechanism for ConditionedProperties to be populated without the other negative downsides.~ Unneeded.

# Proposal

Combine [CoreProjectConfigurationsDimensionProvider](http://index/?query=%60ConditionedProperties&rightProject=Microsoft.VisualStudio.ProjectSystem.Implementation&file=Configurations%5CCoreProjectConfigurationsDimensionsProvider.cs&line=24) with our [PlatformProjectConfigurationDimensionProvider](https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Configuration/PlatformProjectConfigurationDimensionProvider.cs) and [ConfigurationProjectConfigurationDimensionProvider](https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Configuration/ConfigurationProjectConfigurationDimensionProvider.cs) so that we can support both configuration syntaxes at the same time.

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.