I encountered an error today trying to publish a Visual Studio web site via the "Build->Publish Web Site" method with a profile I had imported. The specific error that was:
Applying transformations to web.config failed.
I went through all of the steps located in this Microsoft help article to try to disable the transforms but non of them worked. I then deleted publish temp data located in my "C:\Users\MyUsername\AppData\Local\Temp\WebSitePublish" also to no avail. I re-imported the publish profile, this also did not help. I could not find the code or tags that was supposed to be executing this transform.
In a final last ditch effort I went to deploy the entire site through the publish wizard and I noticed that the "Preview Changes" option failed complaining about a filename that was too long (unrelated to the web.config mind you). I shortened the length of the file name and sure enough both the preview worked AND publishing the web.config again worked. The lesson here is the "applying transformations to <filename> failed" could occur because of unrelated errors. The temporary work around is to go through the wizard steps of doing a full deploy (Build->Publish Web Site).