Don't write files in CompilerPackage if not needed
Don't write files in CompilerPackage if not needed

CompilerPackage was previously being lazy and would just delete and
rewrite files as needed when the package was loaded, even if the
machine would ultimately be left in the same state at the end.
For the old project system (which didn't monitor such file changes)
this wasn't bad, but with the new project system it now reloads projects
in response to changes which can be quite expensive.

Fixes dotnet/roslyn#21838.

AlekseyTs/roslyn,CyrusNajmabadi/roslyn,pdelvo/roslyn,physhi/roslyn,robinsedlaczek/roslyn,AlekseyTs/roslyn,gafter/roslyn,khyperia/roslyn,agocke/roslyn,mmitche/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,eriawan/roslyn,diryboy/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,Giftednewt/roslyn,MichalStrehovsky/roslyn,heejaechang/roslyn,tannergooding/roslyn,TyOverby/roslyn,CyrusNajmabadi/roslyn,swaroop-sridhar/roslyn,Hosch250/roslyn,VSadov/roslyn,physhi/roslyn,jcouv/roslyn,heejaechang/roslyn,tmat/roslyn,wvdd007/roslyn,Hosch250/roslyn,AmadeusW/roslyn,abock/roslyn,mattscheffer/roslyn,jasonmalinowski/roslyn,jamesqo/roslyn,mattscheffer/roslyn,KirillOsenkov/roslyn,CaptainHayashi/roslyn,nguerrera/roslyn,jkotas/roslyn,orthoxerox/roslyn,Giftednewt/roslyn,mmitche/roslyn,khyperia/roslyn,cston/roslyn,dpoeschl/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,genlu/roslyn,srivatsn/roslyn,mavasani/roslyn,gafter/roslyn,tmeschter/roslyn,paulvanbrenk/roslyn,lorcanmooney/roslyn,abock/roslyn,lorcanmooney/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,TyOverby/roslyn,VSadov/roslyn,tvand7093/roslyn,sharwell/roslyn,jkotas/roslyn,mavasani/roslyn,abock/roslyn,wvdd007/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AnthonyDGreen/roslyn,tvand7093/roslyn,bartdesmet/roslyn,jmarolf/roslyn,DustinCampbell/roslyn,diryboy/roslyn,AnthonyDGreen/roslyn,davkean/roslyn,orthoxerox/roslyn,cston/roslyn,TyOverby/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,jamesqo/roslyn,mavasani/roslyn,dotnet/roslyn,reaction1989/roslyn,dotnet/roslyn,heejaechang/roslyn,stephentoub/roslyn,bkoelman/roslyn,KevinRansom/roslyn,tvand7093/roslyn,KirillOsenkov/roslyn,tmeschter/roslyn,aelij/roslyn,stephentoub/roslyn,agocke/roslyn,davkean/roslyn,bkoelman/roslyn,eriawan/roslyn,mmitche/roslyn,swaroop-sridhar/roslyn,AlekseyTs/roslyn,sharwell/roslyn,cston/roslyn,MichalStrehovsky/roslyn,robinsedlaczek/roslyn,bkoelman/roslyn,dpoeschl/roslyn,AmadeusW/roslyn,MichalStrehovsky/roslyn,eriawan/roslyn,pdelvo/roslyn,KevinRansom/roslyn,reaction1989/roslyn,dpoeschl/roslyn,swaroop-sridhar/roslyn,brettfo/roslyn,xasx/roslyn,tannergooding/roslyn,DustinCampbell/roslyn,CaptainHayashi/roslyn,MattWindsor91/roslyn,nguerrera/roslyn,nguerrera/roslyn,davkean/roslyn,MattWindsor91/roslyn,khyperia/roslyn,srivatsn/roslyn,mattscheffer/roslyn,genlu/roslyn,panopticoncentral/roslyn,brettfo/roslyn,AnthonyDGreen/roslyn,Giftednewt/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,tmat/roslyn,orthoxerox/roslyn,wvdd007/roslyn,reaction1989/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,jkotas/roslyn,xasx/roslyn,aelij/roslyn,ErikSchierboom/roslyn,VSadov/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,OmarTawfik/roslyn,gafter/roslyn,jcouv/roslyn,jamesqo/roslyn,paulvanbrenk/roslyn,jmarolf/roslyn,stephentoub/roslyn,srivatsn/roslyn,sharwell/roslyn,diryboy/roslyn,MattWindsor91/roslyn,lorcanmooney/roslyn,pdelvo/roslyn,xasx/roslyn,tmat/roslyn,MattWindsor91/roslyn,panopticoncentral/roslyn,DustinCampbell/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,robinsedlaczek/roslyn,tmeschter/roslyn,CaptainHayashi/roslyn,jasonmalinowski/roslyn,OmarTawfik/roslyn,brettfo/roslyn,agocke/roslyn,OmarTawfik/roslyn,Hosch250/roslyn,KirillOsenkov/roslyn,jcouv/roslyn,dotnet/roslyn,tannergooding/roslyn,bartdesmet/roslyn,jmarolf/roslyn,paulvanbrenk/roslyn,panopticoncentral/roslyn