How to Publish two Sitecore projects on one sitecore instance in inetpub/wwwroot

I  have two Sitecore projects, i want to publish the them in to one publish folder or in one sitecore instance in inetpub/wwwroot.

All things are published,but Web.config files are replaced by one another and It makes problem to start the Sitecore.

 

Is there any dynamic way to handle the projects web.config files to publish in one inetpub/wwwroot Sitecore instance?