Unlike France or Austria, the Crown of Spain could be inherited through the female line. This allowed Charles' sisters Maria Theresa  and Margaret Theresa  to pass their rights onto the children of their marriages with Louis XIV and Emperor Leopold. Despite being opponents for many years, Louis and William III attempted to resolve the Succession by diplomacy. This resulted in the 1698 Treaty of the Hague and 1700 Treaty of London or the First and Second Partition Treaties between France, Britain and the Dutch Republic.Maria Antonia , daughter of Leopold and Margaret, married Maximillian Emanuel of Bavaria in 1685 and they had one surviving son, Joseph Ferdinand. The 1698 Treaty made the six year old heir to the bulk of the Spanish Monarchy and divided its European territories between France and Austria. Imposing a solution to such an important issue on Spain and Austria always seemed unlikely, even without the deep levels of mutual mistrust between the signatories. The Spanish refused to accept the division of their Empire and on 14 November 1698, Charles published his Will, making Joseph Ferdinand heir to an independent and undivided Spanish Monarchy. When he died of smallpox in February 1699, an alternative was required.
Question: What happened first, Charles published his Will or he died of smallpox?
Answer: published his Will