The “EnsureBindingRedirects” task failed unexpectedly

后端 未结 14 2109
甜味超标
甜味超标 2021-02-06 20:56

When I create new ASP.NET 4.5 web forms application from vs2012 and update all nuget packages, I receive this error on build:

相关标签:
14条回答
  • 2021-02-06 21:33
    I resolved this by following these steps:
    

    1.) Delete Microsoft.Bcl.Build.1.0.13 from solution\packages.

    2.) After it Closes the solution, then open the solution.

    3.) Navigate to tools/Nuget package manager.

    4.) Press Restore Packages in right top corner of the window, after it Re-build the solution.

    0 讨论(0)
  • 2021-02-06 21:35

    My problem was that the tag was not on the first line of the file. Fixed that and everything worked ok.

    0 讨论(0)
  • 2021-02-06 21:36

    I had this error but slightly different, took me 45 minutes to figure it out so thought I'd better get this out there.

    Was experiencing the "EnsureBindingRedirects" task failed unexpectedly problem but mine came from an XmlException:

    (...)\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets(97,5): error MSB4018: System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 39, position 175.

    Turns out the cause was that I'd recently added an entry to my web.config's appSettings where the value was a URL that contained an ampersand (&).

    Ampersands need to be escaped in XML, even in attribute values.

    I changed all the & in the URL value to & and it built without issue.

    0 讨论(0)
  • 2021-02-06 21:40

    In general it's Microsoft.Bcl.Build failling. In my case was after a merge and Git add invalid data to my web.config. Just open the web.config file and check for lines like this:

    • <<<<<<< HEAD
    • =======
    • >>>>>>> dev

    Remove them.

    0 讨论(0)
  • 2021-02-06 21:44

    It's a bug in Microsoft.Bcl.Build and to solve it you have to put culture info in the assemblyIdentity-part of web.config or app.config.

    For example if you have:

    <dependentAssembly>
       <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
       <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    

    change it to:

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    
    0 讨论(0)
  • 2021-02-06 21:44

    This happened to me when I had a BIN and OBJ folder marked read only. Remove the read-only on *.dll.config and *.app.config or delete those folders.

    0 讨论(0)
提交回复
热议问题