dotnet/upgrade-assistant

Use EnableDefaultItems and keep Compile/Content/None items when input project contains a nested project

superstrom opened this issue · 0 comments

Summary

Upgrade Assistant should detect nested projects and EnableDefaultItems=false and bring over explicit Compile/@include, instead of incomplete Compile/@remove=Nested\known.cs

Motivation and goals

The solution I was attempting to upgrade has some nested projects. For example:
Project\Project.csproj
Project\Test\Project.Test.csproj

This works fine when including items explictly, and mostly works when Removing the items of the subproject.
Where you run into issues is the automatically included sources in obj.
For example, after you compile the nested project, the outer project starts having duplicate attribute errors:

CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute

This is caused by the outer project automatically including the nested project's obj folder and generated sources.

In scope

A list of major scenarios, perhaps in priority order.

Out of scope

Scenarios you explicitly want to exclude.

Risks / unknowns

How might developers misinterpret/misuse this? How might implementing it restrict us from other enhancements in the future? Also list any perf/security/correctness concerns.

Examples

Give brief examples of possible developer experiences (e.g., code they would write).

Don't be deeply concerned with how it would be implemented yet. Your examples could even be from other technology stacks.