The "EnsureBindingRedirects" task failed unexpectedly

Ivan Lewis picture Ivan Lewis · May 30, 2013 · Viewed 23.2k times · Source

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

Error 1 The "EnsureBindingRedirects" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies) at Roxel.BuildTasks.EnsureBindingRedirects.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()

Answer

Henrik Fransas picture Henrik Fransas · May 30, 2013

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>