Could I stil benefit from the capital gains exemption on the sale of my main residence?
Yes, but only on the part that constitutes your principal residence. For you to benefit from the capital gains tax exemption, the sale must relate to your principal residence (art. 150 U, II, 1° CGI), i.e., the buildings or parts of buildings that constitute your usual and effective residence on the day of the sale (BOI-RFPI-PVI-10-40-10 §20).
If part of your property is used for professional purposes, it is not eligible for the exemption (BOI-RFPI-PVI-10-40-10 §80).