Why doesn't AutogenerateBindingRedirects work for a Web.config in Visual Studio 2017

前端 未结 3 1240
攒了一身酷
攒了一身酷 2021-02-19 20:31

I have a reference to a .Net Standard 2.0 library that requires Microsoft.AspNet.WebApi.Client 5.2.4. This has a lot of dependencies that need to be redirected to use newer vers

3条回答
  •  有刺的猬
    2021-02-19 20:54

    For iis express: In Web.config replace section assemblyBinding with

      
        
      
    

    For iis and iis express:

    add to project Scripts\CopyRuntimeSection.ps1

    param ($from, $to)
    $projectPath = Resolve-Path "$($PSScriptRoot)\..\"
    
    $fromFilePath = "$projectPath\$from";
    $toFilePath = "$projectPath\$to";
    
    $fromFileXml = [xml](Get-Content -Path $fromFilePath -Raw)
    $toFileXml = [xml](Get-Content -Path $toFilePath -Raw)
    
    $toFileXml.configuration.runtime.InnerXml = $fromFileXml.configuration.runtime.InnerXml
    $toFileXml.Save($toFilePath)
    

    add to csproj

      
        
      
    

提交回复
热议问题