Monday, May 19, 2014

Why the compilation error 'The "EnsureBindingRedirects" task failed unexpectedly'

Recently I moved to our company's US office located at New Jersey. When I moved to new office, I had to return my laptop to Kochi office. There was arrangement done to upload all my files to company's FTP server so that I can download once I get machine from US office.

When I got the new machine and compile one of my visual studio solution, it showed a wired compilation error as below. It was not associated to any of the projects inside the solution.

Error     66     The "EnsureBindingRedirects" task failed unexpectedly.
System.MissingMethodException: Method not found: 'System.String System.Reflection.AssemblyName.get_CultureName()'.
   at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsForReferences()
   at Roxel.BuildTasks.EnsureBindingRedirects.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)

The google says its because of missing culture name in web.config file. I corrected it, in one of the MVC web project in the solution but the issue still persisted. Then a deep google gave insight to async related dlls of Microsoft. 

At some point, I had installed a nuget package named 'Microsoft.Bcl.Async' which helps to use the async keyword in pre .Net 4.5 versions. I just removed that package and it started working. For me that solution is just a single place testing solution where it contains all types of projects so that I can try any kind of PoCs.

More details about fixing the issue are available in the below link.

No comments: