dotnet/templating

Allow 'add project reference' post action for existing projects

david-acm opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

Not a problem, however, not being able to add project references to existing projects feels like a feature that should work as expressed by #7508 and #7833, and also since a similar behavior is already working for solution files with the add project to solution post action.

Describe the solution you'd like.

The main use case for this feature is to automate the project reference for projects instantiated with the template tool.

Given that:

  • There is an existing project (not generated by the templating engine).
  • And, the project is in its own folder, not the solution root.
  • And the template has a reference project post action.
  • And the post action uses the "targetFiles" pointing to path of the existing project, relative to the solution root.

When:

  • A template is instantiated in the solution root folder

Then:

  • A new project reference is added to the existing project.
  • The following error is not returned Unable to determine which project file to add the reference to. Post action failed.

Additional context

The current behavior and a potential solution is outlined in this comment: #7833 (comment)