Skip to content

Support resource naming based on DependentUpon source by convention #4488

@nguerrera

Description

@nguerrera

Related issues:

dotnet/winforms#638
dotnet/project-system#4807
https://github.com/dotnet/corefx/issues/34190

In SDK projects and new project system, we have eliminated the need for DependentUpon to make the appropriate file nesting in the IDE tree. However, there is a place where the build actually uses DependentUpon to:

  1. Locate a source file, and parse (!) it to get first class name and namespace
  2. Generate .resources accordingly.

Let first me say that this whole design is terrible and it is absolutely insane that we have code to find the class and namespace name in msbuild:

https://github.com/microsoft/msbuild/blob/f309171ed821eb66cb635403e1fbff41ea22ae9c/src/Tasks/CSharpParserUtilities.cs#L15-L20

But people and features in VS rely on this and it has been a consistent source of feedback in moving to .NET Core 3.0. So I give up and propose:

  1. Add a boolean property that, when true, causes us to look for the source file by convention when DependentUpon metadata is not found.

  2. Set that property by default for .NET Core App 3.0 TFM.

cc @rainersigwald @davkean @livarcocc

Metadata

Metadata

Assignees

Labels

.NET CoreArea: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.triaged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions