@@ -63,36 +63,18 @@ $startupFolder.ProjectItems |
6363# Add App.config file with binding redirects
6464$appConfigProjectItem = $project.ProjectItems | Where-Object { $_.Name -eq " App.config" } | Select-Object - First 1
6565if ($appConfigProjectItem -eq $null ) {
66- Write-Host " Opening Web.config to update binding redirects"
67- $webConfigProjectItem = $project.ProjectItems | Where-Object { $_.Name -eq " Web.config" } | Select-Object - First 1
68- $webConfigPath = ($webConfigProjectItem.Properties | Where-Object { $_.Name -eq " LocalPath" } | Select-Object - First 1 ).Value
69- $webConfig = [xml ] (Get-Content $webConfigPath )
70- $runtimeNode = $webConfig.configuration.runtime
71-
72- Write-Host " Adding an explicit binding redirect for WindowsAzure.Storage"
73- $packagesConfigProjectItem = $project.ProjectItems | Where-Object { $_.Name -eq " packages.config" } | Select-Object - First 1
74- $packagesConfigPath = ($packagesConfigProjectItem.Properties | Where-Object { $_.Name -eq " LocalPath" } | Select-Object - First 1 ).Value
75- $packagesConfig = [xml ] (Get-Content $packagesConfigPath )
76- $azureStorageConfig = $packagesConfig.SelectNodes (' /packages/package[@id="WindowsAzure.Storage"]' ) | Select-Object - First 1
77- $azureStorageVersion = $azureStorageConfig.version
78- $bindingRedirectXml = [xml ](' <dependentAssembly>' +
79- ' <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />' +
80- ' <bindingRedirect oldVersion="0.0.0.0-' + $azureStorageVersion + ' " newVersion="' + $azureStorageVersion + ' " />' +
81- ' </dependentAssembly>' );
82- $bindingRedirect = $bindingRedirectXml.SelectNodes (' /dependentAssembly' ) | Select-Object - First 1
83- $bindingRedirectNode = $webConfig.ImportNode ($bindingRedirect , $true )
84- $runtimeNode.assemblyBinding.AppendChild ($bindingRedirectNode )
85- $webConfig = [xml ] ($webconfig.OuterXml.Replace (' xmlns=""' , ' ' ))
86- $webConfig.Save ($webConfigPath )
87-
8866 Write-Host " Adding binding redirects to update Web.config"
8967 Add-BindingRedirect
9068
9169 Write-Host " Creating an App.config file for use by the RoleEntryPoint with the binding redirects in Web.config"
70+ $webConfigProjectItem = $project.ProjectItems | Where-Object { $_.Name -eq " Web.config" } | Select-Object - First 1
71+ $webConfigPath = ($webConfigProjectItem.Properties | Where-Object { $_.Name -eq " LocalPath" } | Select-Object - First 1 ).Value
72+ $webConfig = [xml ] (Get-Content $webConfigPath )
73+ $runtimeNode = $webConfig.configuration.runtime
9274 $appConfig = [xml ]" <?xml version=`" 1.0`" ?><configuration />"
9375 $newRuntimeNode = $appConfig.ImportNode ($runtimeNode , $true )
9476 $appConfig.DocumentElement.AppendChild ($newRuntimeNode )
9577 $appConfigPath = Join-Path $projectPath " App.config"
9678 $appConfig.Save ($appConfigPath )
9779 $project.ProjectItems.AddFromFile ($appConfigPath )
98- }
80+ }
0 commit comments