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,

rootwebconfig32.netfxversion=2,rootwebconfig64.netfxversion=2 -dest:apphostconfig="WebSite1",machineconfig32.netfxversion=2,machineconfig64.netfxversion=2,

computername= -enablelink:AppPoolExtension -verbose –whatif

Synchronization completed without an issue.



Comments (3)

  1. Simon says:

    Hi Eric
    Nice work. Do you know how to get this working with the PowerShell Snapin for WebDeploy? I get the same error in PowerShell but can’t figure out how to solve it. the workaround with changing the structure of the config files doesn’t work for me. I don’t even know how I get this error, because our developers say everything is at least on .NET 4.0

    1. Simon says:

      Nevermind, i got it. you can pass it as a hashtable to the -sourcesettings and -destinationsettings parameter:

      [hashtable]$settings = @{
      ‘machineconfig32.netfxversion’ = 2
      ‘machineconfig64.netfxversion’ = 2
      ‘rootwebconfig32.netfxversion’ = 2
      ‘rootwebconfig64.netfxversion’ = 2

      $sync = Sync-WDSite $Name $Name -sitephysicalpath $spp `
      -SourcePublishSettings $publishsettings `
      -IncludeApppool `
      -sourcesettings $settings `
      -destinationsettings $settings `

Skip to main content