I get this error when building an MVC project in a solution. No references to those files exists in my solution at all.
C:\\Program Files (x86)\\MSBuild\\14.
Having VS 2015 14.0.25431.01 Update 3, without Xamarin, neither DotNetCompilerPlatform nuget package, and having more build configurations (eg. Debug and RCDebug), i get the unexpected copy which would be coming from another build (eg. copy corresponding to RCDebug but i Rebuild on Debug). It did not worked by deleting all the Bin folders, or Clean on every build config then Build. It builds fine BUT turns bad when Run.
I have fixed the problem by upgrading 'Mocrosoft.Net.Compilers' to 2.6.1.
I used to have the same issue but I just removed Microsoft.CodeDom.Providers.DotNetCompilerPlatform
and then installed 1.0.0. I found that after that it all looks good.
Just uninstalling Microsoft.CodeDom.Providers.DotNetCompilerPlatform from one of our projects fixed this issue for me in Visual Studio 2017.
I had the exact same problem. I didn't upgrade DotNetCompilerPlatform to 1.0.1.
My solution was...
As other's have mentioned it's the upgrade from version 1.0.0 to 1.0.1 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform that causes this problem.
It's possible to solve this without downgrading, see my explanation in this answer. To summarise, what solved it for me was removing all references to the offending libraries manually (simply removing them in VS was not enough) and then re-adding the latest versions.
On further investigation this appears to be due to the 1.0.1 nuget package not clearing up all of the references to 1.0.0 in the csproj. Why this is causing it try and copy the pagefile however is anyone's guess.