Encountered the error message ERROR_FRAMEWORK_VERSIONS_DO_NOT_MATCH during a website sync operation to create the web site on a new server .
Completed a quick Bing search and found a great listing of Web Deploy error message here. Based on the description of the issue, it appears Web Deploy is attempting to synchronize the website from the source to the destination with the .Net 4.0 framework as the version of the CLR to use for the application pool even though the application on the source server uses .Net 2.0.
I checked the msdeploy.exe.config configuration file and sure enough, the v4.0 runtime was listed first:
<startup useLegacyV2RuntimeActivationPolicy="true" >
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
<supportedRuntime version="v2.0.50727" />
A work around to the issue is to move the v2.0.50727 above the v4.0 in the configuration file to force Web Deploy to use the v2.0 CLR. Decided not to use this option and proceed with the second one, add the version of the CLR into the Web Deploy command:
msdeploy -verb:sync -source:apphostconfig="WebSite1",machineconfig32.netfxversion=2,machineconfig64.netfxversion=2,
computername=10.1.1.19 -enablelink:AppPoolExtension -verbose –whatif
Synchronization completed without an issue.