As indicated in this answer from Pramod’s comment the problem stems from the Microsoft.CodeDom.Providers.DotNetCompilerPlatform nuget package, specifically upgrading from version 1.0.0 to 1.0.1.
For me however, downgrading using Visual Studio caused further build errors. To solve the problem I had to manually edit my csproj and packages.config files, removing all references to Microsoft.Net.Compilers and Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
Specifically, this meant:
- Removing the relevant
<Import Project="...
sections for all versions of both libraries (usually towards the beginning of the csproj) - Removing the
<Reference Include="...
sections for both versions of both libraries - Removing the
<Error Condition="!Exists(...
sections for both versions of both libraries from within theEnsureNuGetPackageBuildImports
target section - Removing all
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
andMicrosoft.Net.Compilers
packages from the packages.config.
I was then able to manage the projects nuget packages in VS and (in order) :
- Add Microsoft.Net.Compilers version 1.2.2
- Add Microsoft.CodeDom.Providers.DotNetCompilerPlatform version 1.0.1
This solved the pagefile build error, and the runtime error which prompted me to try and upgrade in the first place.