Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property page default values are not correctly display #347

Open
pepone opened this issue Nov 28, 2021 · 2 comments
Open

Property page default values are not correctly display #347

pepone opened this issue Nov 28, 2021 · 2 comments

Comments

@pepone
Copy link

pepone commented Nov 28, 2021

Hi,

I have created a custom property page as documented in https://github.com/dotnet/project-system/blob/main/docs/repo/property-pages/how-to-add-a-new-project-property-page.md#option-1-xaml-file-on-diskg

See: https://github.com/zeroc-ice/ice-builder-msbuild/blob/fcaa91b6c2a0ddff40b1d7931baddd914568728b/msbuild/SliceCompile.CSharp.xaml

The default value for OutputDir is defined in https://github.com/zeroc-ice/ice-builder-msbuild/blob/fcaa91b6c2a0ddff40b1d7931baddd914568728b/msbuild/zeroc.icebuilder.msbuild.csharp.props#L4-L9

When the property page is render the Output Directory field is empty and is expanded value is rendered below
property-page

I would expect that the default value $(MSBuildProjectDirectory)\generated would be rendered in the field.

Then if I add a value to any of the other properties, and reload the property page, the default value is now rendered in the field

property-page2

The only modification I see on the project file when editing the IncludeDirectories is

  <ItemDefinitionGroup Label="IceBuilder">
    <SliceCompile>
      <IncludeDirectories>slice</IncludeDirectories>
    </SliceCompile>
  </ItemDefinitionGroup>

Any ideas why the rendering of the default values is behaving differently here?

@drewnoakes
Copy link
Member

Hi @pepone, apologies for the delay in responding here. We generally track issues related to this UI in the dotnet/project-system repo.

@tmeschter, do you have a sense of what's going on here? Would you expect values in ItemDefinitionGroups to be picked up? I don't think I've seen an example of a XAML DataSource having an ItemType before.

@tmeschter
Copy link
Member

The short answer is that we're in unexplored territory here. We didn't design the system with ItemDefinitionGroups in mind and we haven't tested this scenario.

The longer answer is that reading or writing property values in CPS is always done in some context (defined by the IProjectPropertiesContext type) that tells us where to look for those properties. The context can represent things like:

  • Project-level properties in the .csproj file.
  • Project-level properties in some other imported .props/.targets file
  • ItemDefinitionGroup properties for some particular item type, as defined in some specific file
  • Item properties for a specific item in a specific file
  • Etc.

The Rule file makes it clear that you want to read and write properties to the "SliceCompile" ItemDefinitionGroup in the main project file. The problem is that the project properties UI always works in a context representing project-level properties in the main project file. So there's a mismatch here, and I'm not sure what the correct behavior should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants