During DXC deployment to PREP or PROD environments the following error message is seen when application starts: error CS0006: Metadata file 'D:\local\Temporary ASP.NET Files\root\X\X.dll' could not be found. The dll is most often App_Code.dll or App_global.asax.dll but can be any Top-level file.
(Top-level files include the global.asax file and all files in the bin and App_Code folders)
Restart the app service.
Set the optimizeCompilations attribute of the compilation element in the Web.config file to false.
For DXC Service optimizeCompilations doesn't improve anything as one cannot update individual files without doing an app service restart because of the App Service Local Cache feature is enabled. Also the deployment flow always deploy to an empty wwwroot in the slot which is in stop state and after files have been deployed it starts up and does the warmup which will start the compilation (PREP and PROD envs).