Don't Use Chemical Propellants
The advantages there are to using a case are numerous. The small amount of extra weight you get from the case does more than just give you a place to put your propellant; it helps with bullet alignment, sealing, heat dissipation, etc. The big issue with caseless guns is that they are so similar to firing bullets that it is hard to get much benefit out of removing the case because improvements that make caseless better will generally also be able to be applied to making bullet firing guns work better. So it is very likely that bullets will always be preferable.
So, to get around this, you need a weapon that functions differently than a ballistic gun, but has the potential to outperform bullets in key metrics using innovations that do not directly help bullets get better.
The Solution: Rail Guns
When we look at railguns, we have the potential for a viable weapon system that fires a slug without getting any benefit whatsoever from a case. Large railguns like those being mounted on some modern naval ships have certain advantages over traditional ballistics including a lower cost per shot, and a much higher mussel velocity which gives it a better effective range and armor pentation. A railgun has a higher theoretically possible mussel velocity than a gun because of how it accelerates the shot. A gun exerts a lot of heat and force on the gun in the chamber and these forces quickly fall off as the slug enters the barrel. A railgun however is accelerated evenly across the whole barrel; so, there is no one major stress point or part of the mechanism being superheated to its melting point.
All this said, railguns are heavier than ballistic cannons of similar fire power and with modern technology we do not yet have the ability to miniaturize them into a practical weapon system due to power limitations and weight constraints. Another reason we don't see hand held railguns is that modern firearms already have such a good range and armor penetration that even if you could miniaturize the advantages of a rail gun, the benefits would all be wasted on a fight between human combatants... however, due to the current direction military technology is going in, this fact may not hold for very many more years. Some of the recent/near-future advances I am talking about include:
Better Ballistic Armor: Over the past few decades, improvements in material science have reduced the weight of personal body armor compared to its protective quality about 5 fold! So bullets that used to require 20mm armor can now be stopped by newer armors that weigh as much as 4mm of the older model armor. This has caused arms manufacturers to step up their game with things like saboted and tungsten tipped bullets but it is currently estimated that many materials we make today could be improved another 5 fold as we continue to approach perfect crystalline materials. So, eventually body armor may just get to tough for our slow, chemically propelled bullets to pernitrate.
Exoskeletal Suits: These suits can increase a soldier's carry capacity to several hundred pounds allowing him to carry enough armor to stop pretty much any caliber of modern anti-personnel weapon. Sure you could also scale up your guns to hand-held 20mm autocannons, but ammo costs go up pretty quickly as you make the bullet larger whereas an equally penetrative rail gun sabot could be nothing more than a 10mm tungsten tipped steel rod launched using an amount of electricity that can be measured in cents instead of >100\$ like many modern high caliber AP rounds.
Self Aiming Guns: A few years back someone invented a hunting riffle that used image recognition and environmental sensors to make a self-aim-correcting riffle. With such a weapon, even an untrained shooter can hit targets over 1km away. So, as AI assisted aiming moves into the realm of military use, having mechanically more accurate/highspeed weapons could become important. Even if you are only engaging a target at 100m, a higher mussel velocity could make the difference between an AI being able to predict the target's body position far enough into the future to be able to either put a bullet through someone's eye or glance off the side of their helmet if they make an unexpected movement at the last minute.
Robots: Then there is the combination of all of these technologies which are semi-autonomous robotic combatants like the IDF Jaguar which does not even have a human inside. Not only do these bots have all the advantages I've mentioned so far, but they also have a LOT more internal room to spare than human infantry for carrying the power systems required to host a rail gun.
So, as these technologies mature and warfare replaces human infantry with AI supplemented mini-tanks, chemical propellants may just not be up to the job of future warfare making caseless firearms in the form of railguns the new standard.
What about the "very distant future"
Everything so far answers this question in regards to the near future where science and military technology can be extrapolated based on what is true today, but as JBH's answer points out: the distant future is unknown ... but we may still be able to make some good guesses about it...
One thing I would guess about it is that we're probably not even throwing kinetic projectiles at each other anymore. The most likely weapon class to evolve into a ubiquitous future weapon system is more likely going to be some variation of the High Energy Laser. Kinetic penetrators of any kind just move so slow that an adequately advanced system would have the ability to see it coming and deploy a countermeasure in its path whereas lightspeed weapons arrive at the target at the exact moment you become able to detect its path. This means that at least some energy will always reach you before you can obstruct its path.
Some laser configurations like that studied at the National Ignition Facility in California can heat a material up enough to trigger a fusion reaction in just a few picoseconds; so, we can assume that it is at least conceivable that future beam weapons will do the same. So not only do you get hit at the exact moment your countermeasure systems see it coming, but by the time your AI can process that it is being hit, you've already absorbed enough energy to turn a small area of your surface into a tiny nuclear explosion.
To put this into perspective: think of guns as the modern equivalent of classical era melee weapons (swords, spears, axes...), and lasers are like classical era missile weapons (slings, bows, pilia...). 2000 years ago, both melee and missile weapons had their place on the battlefield, but by in large, it was the melee weapons that really carried armies to victory. Overtime, everything improved: mild steel short swords evolved into spring steel longswords, and bows evolved into muskets. But as things improved, the limitations inherent in melee weapons became more and more pronounced until the very idea of these melee weapons as a primary battlefield weapon disappeared. Likewise, the problems inherent in slower than light weapons will only get worse as time goes on until the absolute most advanced possible kinetic projectiles achievable will be considered about as useful on a far future battlefield as a pike block is today.
To be clear, I'm not saying that far future weapons will actually be lasers. They may not even be electromagnetic in nature. Just like a bow is not an assault riffle and an arrow is not really a bullet. But what I am saying is that distant future weapons will have a lot more in common with a laser than a gun.