It is interesting that the crossbow and the pike are in fact the complementary weapons of the "Infantry Revolution", both weapons allowing relatively untrained men (with the proper tactics) to effectively take to the field against highly trained knights and men at arms.
Understanding why these are complementary weapons also explains why a bayonet was never mounted on a crossbow in real life.
The mass of pikemen in a square presented a forest of blades which was difficult for mounted or dismounted fighters to penetrate. it is essentially defensive in nature, (pikes are set to repel charges and prevent dismounted men from penetrating the line), although highly trained men who are capable of moving together as a unit and aggressively led can use pikes offensively (as leaders from Alexander III to the Swiss confederacy well knew).
Modern re-enactors demonstrate a pike square
Crossbows allowed men with limited training to effectively shoot projectiles at armoured knights and men at arms, and in great numbers. Longbows and recurve bows as used by the English and Ottomans could be as effective as crossbows, but required far more training to use effectively than a crossbow, and in the case of recurve bows were also difficult and expensive to make due to the use of multiple materials, glues and careful setting and drying/curing times. Crossbows ultimately provided much more striking power as well, a spanned steel crossbow could have a draw weight of 1200 lbs / 600kg (far more than any unaided man could provide) and deliver a quarrel with lethal force even against an armoured opponent.
Crossbowman in the late Middle Ages
So the crossbowman can shoot quarrels capable of dealing death and injury to even armoured knights, but has a slow rate of fire due to the need to span the bow. The pike square is essentially defensive, but provides the "stand off" distance to prevent knights and men at arms form closing with the troops. The ideal combination (and this was carried on even into the gunpowder age) was to mass blocks of pikemen and put the missile armed troops in between the blocks of pikes.
Although this is a diagram from the age of "shot and pike", substituting crossbows for the arquebuses gives you the idea
Crossbows by themselves are far too short to provide the "stand off distance" needed to protect yourself from a mounted man, and you would be well within the reach of anyone with a sword, pole arm or even a mace or war hammer to effectively defend yourself, unless you had extensive training (which of course defeats the entire notion of the Infantry Revolution in the first place). A crossbow on a stock long enough to effectively act as a "pike" when the bayonet was mounted would likely be too unwieldy to use effectively (the weight of the bow arms on the front of such a long stock would make it difficult to aim, and running forward to place the spanning mechanism on the bowstring would reduce the rate of fire even more).
So short answer is "no", a bayonet would not be very effective on a crossbow. If if comes to blows, the bowman could start swinging the bow, or drop it and pull a long knife. Of course if it really does come to that, it means the pike square has collapsed and your side is pretty much done anyway.....