Dozens of firefighters, rescue teams, and ambulances promptly arrived at the building, where there were about 20 people at the time of the fire, according to the police.
"There were more than 20 people in the building. Most were evacuated by the fire brigade, but for six people, including children, the help came too late," Solothurn police said in a statement.
The fire started in the lower part of the building, causing it to fill with smoke that later billowed out of the windows, the police reported.
A neighbouring building was also evacuated as a precaution, officials said, although its residents were later able to return to their apartments.