Cannot use msdeploy to sync 2 websites - ERROR_FRAMEWORK_VERSIONS_DO_NOT_MATCH

I am trying to use the msdeploy v3.0 to sync an iis website. The site is using .net 4.5 and I am having trouble syncing a brand new server.

Step 1) Create a backup of the website. It looks like it works fine.

msdeploy -verb:sync -source:apphostconfig="XXX",computername=XXX -dest:package=c:\temp\test2.zip,encryptPassword=[pass]

Step 2) Run the deployment package on the destination server. Fails!

msdeploy -verb:sync -source:package=C:\temp\test2.zip,encryptPassword=[pass] -dest:apphostconfig="XXX"

I get the following error when I execute step 2.

Error Message

ERROR_FRAMEWORK_VERSIONS_DO_NOT_MATCH More Information: The versions of the .NET Framework Configuration Provider (mac hineConfig64) are different on the source (2.0.50727.5456) and destination (4.0) . Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FRAMEWORK_ VERSIONS_DO_NOT_MATCH. Error count: 1.


This worked for me:

"I checked the msdeploy.exe.config configuration file and sure enough, the v4.0 runtime was listed first:

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."

Taken from:

https://blogs.msdn.microsoft.com/ericparvin/2015/04/03/error_framework_versions_do_not_match/#comment-305