The “EnsureBindingRedirects” task failed unexpectedly

后端 未结 14 2152
甜味超标
甜味超标 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:47

    Update Microsoft.Bcl.Build to fix this.

    Run this on Package Manager console:

    Update-Package Microsoft.Bcl.Build
    
    0 讨论(0)
  • 2021-02-06 21:47

    My problem was due to an appSettings value in web.config which contained a url with a & character.

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

    The following steps can be performed to solve the issue:

    1. Update the "Microsoft.Bcl.Build" package to the latest version.
    2. Make sure you have an App.config/Web.config file under your project and it also exists physically in a relevant folder on your machine.
    3. Make sure there are no special characters in the App.config/Web.config file. If they exist you need to replace them. Look at this article -> https://support.crossref.org/hc/en-us/articles/215652783-Special-characters-in-your-XML
    4. In App.config/Web.config file under each <dependentAssembly> add the following key-value pair: culture="neutral" to <assemblyIdentity ... />.
    5. Another step that describes how to fix your unique case and has been not described above :)

    I hope this helps.

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

    I had a similar issue but mine was caused by having xml transform directives in web.config

    Error The "EnsureBindingRedirects" task failed unexpectedly. System.Xml.XmlException: 'xdt' is an undeclared prefix. Line 27, position 59. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos)

    I had copied and pasted an appsetting from one of the transforms. The solution was to remove the transform attributes

    (granted this is not the exact issue the OP had, but could help someone else)

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

    For me it happened because App.Config wasn't in the folder and there were other app.configs meant for different env. So I copied it.

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

    A new version of Microsoft.Bcl.Build (1.0.6) has been pushed up to NuGet.org to fix this problem. The workaround to add the culture to the assemblyIdentity is no longer necessary but won't hurt if you leave it in.

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