For a turbofan to be efficient the gap between the blades and the shroud has to be extremely small. Why don't we just attach the shroud directly to the blades and let it spin as one? Would that decrease the efficiency of the fan or is it just not structurally sound?
This has actually been done, at least on the CFM-56 series at some point.
The image is taken from here, the article is about the F108 engine which is the US military version of the CFM-56.
In newer versions of the engine the blade-tip shrouds have been replaced by mid-span shrouds as below (from Wikipedia), or have been removed.
As pointed out by Camille Goudeseune, turbofans have to accomodate a lot of situations, and a blade-tip shroud adds a lot of mass and therefore increases loads in the blade, further reducing fatigue life.
Among the advantages of this configuration that were not mentioned in the question or in the other answer is that shrouds help reduce vibration amplitudes through frictional damping. This explains why mid-span shrouds are still in play in several engines, while these do not participate in reducing blade-tip losses.
Finally, while this configuration is seemingly not used anymore on fan blades, it is still used in other parts of modern engines, specifically the turbine module. As an example, the picture below is from the GE9X website, see the Low Pressure Turbine blades.
Land-based turbines sometimes use rotating shrouds, with something like a https://en.wikipedia.org/wiki/Labyrinth_seal to reduce leakage. So it's structurally sound in principle.
But turbines in airplanes have to tolerate nonaxial loads, foreign object ingestion, and a broad range of ambient temperature, pressure, and humidity. Affixing the blade tips to the shroud may not tolerate such abuse well, in terms of not exploding, or surviving the next hour, or lengthening the interval between engine overhauls. Better to bang up a few blades than to lose the whole rotor. That would outweigh even a few per cent improved fuel efficiency.
To add to the fine answers:
The rotating shroud woud add extra mass, as the duct would still have to run past it. This mass would also be rotating at high speed, creating substantial gyroscopic forces, and on top of all that, making the engine less responsive.
Then there are the constructional issues: although not at all impossible to engineer, as there are some implementations, the structure would not be as simple as one might think. High rotational speeds, bending of blades, vibrations etc would have to be taken into account and dealt with. Balancing a huge rotating disk would definitely be a pita. there is a Q&A somewhere here about balancing fan blades, I'll try to remember and find it and add it here: adding a disk around the blades would not make the equation simpler. A wide operational temperature range does not help either. We are talking maybe from + 60° C all the way down to - 70°C
All in all, there is a lot of dynamics involved with fan blades, best keep the construction as simple as possible.