Hi Gail
Would say it depends on the hotels policy.
We have stayed in numerous all-inclusive hotels, and each of them have a formal dress code, ie. men must wear long trousers.
My husband always takes a pair of long trousers to wear for dinner and then changes back into shorts or 3/4 afterwards.
Better to be safe than sorry and wouldn't like the embarrassment of being turned away for being improperly dressed
Part of the fun of holidays is dressing for dinner.
Have a lovely holiday
Carol