By the time of the Boshin War, the shogunate had recognized the value of foreign weapons and foreign military weapons, and they'd begun a rapid program of modernization that took advantage of the new Western trade. One of the reasons the shogunate lost favor with the southern daimyo was that they were seen as too quick to acquiesce to foreign demands for trade. When the emperor gave the order to "expel the barbarians" in 1863, it was mostly southerners from Satsuma and Choshu who attacked British nationals... but the British were displeased by the shogunate's handling of the situation. The British ambassador (Harry Smith Parkes, the same guy who was ambassador to China during the Second Opium War) had his own vision for a Japan united under an (ideally pliant) monarch, so he ended up throwing British support behind the southern rebels anyway. Merchants who had come to Japan intending to trade in tea and silk quickly realized that there was a civil war brewing, and selling weapons would be much more profitable (and it wasn't like a couple minor treaty violations were going to stand in the way).
So the shogunate turned to French support. The Americans had "opened" Japan to foreign trade, but, being busy with their own Civil War at the time, they couldn't capitalize on it. England and France had plenty of imperialist experience in Asia, though, and they both wanted a piece of Japanese trade. Some historians see the Boshin War as a proxy war between France and Britain, but I don't know if I'd go that far. Neither Western country wanted to get too directly involved (that's expensive) but they both saw potential profits both during and after the coming war. The shogunate was aware of (and extremely wary of) these imperialist aspirations, but they needed military trade and the British were more interested in arming their rivals. The French had recently invaded Vietnam, they had a presence in China, and they'd started eying up Korea... so, they were seen as a growing foreign power in the region. Better to ally with them and reap the rewards of modernization than to get played in the diplomatic shenanigans that France and Britain had been playing everywhere else, right? Modernization was seen as a defense against another large-scale foreign invasion and another round of foreign demands that would further weaken the status of the shogunate. By 1865, Japan had several modern warships, and the French were building a naval arsenal in Yokosuka. Shogunate armies were using French guns. In 1867, France sent a military mission to begin training the shogun's elite officers in French methods of land warfare. Not all Japanese military units were modernized by the time of the Boshin War - many retained their traditional samurai weapons and clothing, especially as supplies dwindled and the situation of the shogunate loyalists became increasingly desperate. While the shogunate forces had structured their push for modernization around having a superior navy, they generally had inferior guns and artillery compared to the rebels. That ended up being one of the big factors that really sunk the shogunate. They just hadn't put enough into their land game.
The shogunate had warmed quickly to the idea of foreign trade (at a time when southern powers were far less enthusiastic) and there were plans for large-scale, non-military modernization. I don't know if the planned modernization of the mining industry ever took off, but the construction of the Yokosuka naval arsenal required rapid industrialization. Brickworks, metalworks, lighthouses, gunpowder factories, western-style buildings, an aqueduct and hydropower turbines were established at Yokosuka, and by 1866, Japan had built its first new warship. The French engineer in charge of the Yokosuka project, Leonce Verny, started a technical school to train Japanese engineers, and a Franco-Japanese college was set up in Yokohama. The shogunate expressed interest in building an Edo-Yokoyama railroad with American assistance in 1868, shortly before its fall. The shogunate had a popular pavilion at the 1867 World's Fair in Paris (so did Satsuma and the Ryukyuan Kingdom of Naha), which encouraged interest in cultural trade. Had the Tokugawa side won the Boshin War, modernization of the military, resource development, manufacturing industries, construction, transportation and education would likely have continued.
Really, the only major shogunate resistance to modernization after about 1860 was the halfhearted Japanese mission to Europe in 1863, which was intended to secure French support in closing Yokohama to foreign trade... but the real goal of the mission was probably just to placate Imperial supporters (and to do some sightseeing). In any case, Ikeda Nagaoki, the young ambassador in charge of the mission, was so impressed by France that he became an advocate of modernization. He returned to Japan with books on Western science and manufacturing. He even envisioned a Japanese wine industry. The shogunate briefly placed him under house arrest when he returned as punishment for neglecting his mission, but since interest in modernization increased rapidly after that, they probably weren't too mad.
Once an Imperial victory became likely, the new Emperor Meiji and his supporters quickly adopted a pro-Western stance for pretty much the same reasons that the shogunate had. Although relations with France were strained for a bit, the French modernization efforts were allowed to continue.