Windows – How to update machineConfig64 .Net Framework-configuration provider

iismsdeploynetpowershellwindows

I'm trying to synchronize an IIS Site from an old Windows Server 2008 R2 with IIS7.5 to a new Windows Server 2012 R2 with IIS8.5. I'm doing that with the WDeploySnapin3.0 PowerShell Snapin

now I got the following error:

Sync-WDSite : the versions of the .NET Framework-configuration provider
(machineConfig64) differ from source (2.0) and destination (4.0). More 
information on: http://go.microsoft.com/fwlink
/?LinkId=221672#ERROR_FRAMEWORK_VERSIONS_DO_NOT_MATCH.

Two solutions for this error can be found here: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FRAMEWORK_VERSIONS_DO_NOT_MATCH.

The first solution doesn't fit my needs because I dont use the msdeploy.exe tool.

The second solution tells me to edit the config files on the source machine which I did. I changed the msdepsvc.exe.config from this:

<configuration>
  <startup  useLegacyV2RuntimeActivationPolicy="true" >
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
</configuration>

to this:

<configuration>
  <startup  useLegacyV2RuntimeActivationPolicy="true" >
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
</configuration>

and also the msdeploy.exe.config from this:

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0" />
  </startup>
</configuration>

to this:

<configuration>
  <startup>
    <supportedRuntime version="v4.0" />
  </startup>
</configuration>

and after that I restarted the wmsvc service net stop wmsvc ; net start wmsvc but it did not work, the error still occurs

Now I just want to update the version of my source server. How do I do that? .NET Framework 4.6 is installed on the source server, do I just need to edit a config somewhere? Or is it the Management Framework I need to update?

Thanks!

Edit: I also tried to just use the v2.0 entry in the config files (as suggested by microsoft) but it also didn't work. I also don't get why it says that the source server uses .NET 2.0 – the apppool and the app itself use 4.0+

Best Answer

the answer to this problem is to not "update" the machineConfig64 provider, but to tell PowerShell exactly which provider to take, in form of a hashtable. place the hashtable as -sourcesettings and -destinationsettings parameter

[hashtable]$settings = @{
    'machineconfig32.netfxversion' = 2
    'machineconfig64.netfxversion' = 2
    'rootwebconfig32.netfxversion' = 2
    'rootwebconfig64.netfxversion' = 2
}

[...] # some more code

$sync = Sync-WDSite $Name $Name -sitephysicalpath $spp `
                                -SourcePublishSettings $publishsettings `
                                -IncludeApppool `
                                -WarningAction Continue `
                                -ErrorAction Stop `
                                -sourcesettings $settings `
                                -destinationsettings $settings `
                                -debug