dotnet / upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
MIT License
1.11k stars 163 forks source link

Provide mechanism to retain properties try-convert removes #650

Open twsouthwick opened 3 years ago

twsouthwick commented 3 years ago

Summary

Some properties are removed from project files by try-convert that a user may in fact want to be kept.

Motivation and goals

try-convert will remove properties that it determines do not need to be kept. However, some people may want to keep them for whatever reason (ie they may have taken a dependency on the ProjectGuid that is removed). This should allow extension authors a way to specify these properties they want to keep, and have them still be there after try-convert finishes.

In scope

  1. Extension point to provide list of properties that should be kept

Out of scope

  1. Any sort of transformation these properties should undergo

Scenarios you explicitly want to exclude.

Risks / unknowns

Examples

A user can define an extension similar to the following:

{
  "RetainedProperties": [
    "ProjectGuid
  ]
}

And then expect that after try-convert finishes, it's still available.

Detailed design

Ideally, this would be applied atomically with try-convert. Thus, we can register an extension option that the project file updater step can grab and cache between try-convert runs.

Open Questions:

  1. Should the cache be done in memory?
  2. Should we put it in the project file in case of an unexpected failure?
sunandabalu commented 3 years ago

Updating try-convert to take a list to not remove would be cleaner.