Deductions & credits

No. the tax law that allowed deferral of gain on the sale of primary residence by using the proceeds to buy another primary residence hasn't been in effect since 1997.  so any gain on the sale of your second home will be taxed. using the proceeds for improvements to your primary home will add to its cost basis which may help reduce any taxable gain when it is sold.