I have another option. We don't need to replace anything. I am using below connection string without any replace and it's working fine.
Main change is data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\ProjectManagementDB.mdf;integrated security=True;
I hope this will save someone.