I was given the task to update some of our projects target frameworks from .Net 4.5 to .Net 4.8. While updating the projects some references broke. Visual Studio also showed warnings about certain packages not targeting the correct framework.
I ended up running Update-Package <packagename> -reinstall -ProjectName <projectname>
. So those packages had their target framework updated to say net48. The warnings went away and I was also able to fix some of the references that broke.
My questions are:
What about all the other packages in the packages.config that have a targetFramework="net45"
? Is it necessary to update them so they all target 4.8?
How does one determine when to update them?
I have read here: https://docs.microsoft.com/en-us/nuget/consume-packages/reinstalling-and-updating-packages under the When to Reinstall a Package section that you may want to reinstall during a project upgrade. However, only "if the package requires reinstallation due to the change in target framework" or Nuget shows build errors.
Which makes me think that if there are no build errors or a package requiring a reinstallation then it is fine to leave those other packages targeting net45.
Any comments or insight on how you determine if an update is necessary would be greatly appreciated. Thank you!