Skip to content

Setting EnableDefaultCompileItems=True in a file-based app results in CS2002 as app file is included multiple times #51785

@DamianEdwards

Description

@DamianEdwards

If you set EnableDefaultCompileItems to true via a directive in a file-based app, in order to re-enable the default compilation items (like a regular project), you end up with a CS2002 warning being raised because the main file-based app .cs file is still explicitly included in the virtual project.

  1. Add #:property EnableDefaultCompileItems=True to a file-based app
  2. Build or run the file-based app
  3. See CS2002 emitted for the app

We should consider conditioning the explicitly added compile item so that it's not added if EnableDefaultCompileItems is already true.

Metadata

Metadata

Labels

Area-run-fileItems related to the "dotnet run <file>" effort

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions