Posting this for the benefit of several others who had this issue.
To fix this follow these steps:
- Login to azure portal and go to the azure function
- go to Advanced tools in the left panel
- open “debug tools” on top
- Check the version of bad file and if it is older than the minimum version required for net6 then delete it and redeploy
- if that does not fix then go to configuration
- check the value of variables called “Framework version” make sure it is ~4 https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#functions_extension_version