C# Tip Article
Error: The "GenerateResource" task failed unexpectedly
When I tried to build a C# project, I ran into the following error.
The "GenerateResource" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Build.Tasks.ResGenDependencies.GetResXFileInfo(String resxFile) at Microsoft.Build.Tasks.GenerateResource.ShouldRebuildResgenOutputFile(String sourceFilePath, String outputFilePath) at Microsoft.Build.Tasks.GenerateResource.GetResourcesToProcess(List`1& inputsToProcess, List`1& outputsToProcess, List`1& cachedOutputFiles) at Microsoft.Build.Tasks.GenerateResource.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() MyApp
Without paying attention too much, I ran Clean Build and then Rebuild Project. But it surprisingly didn't work.
Final solution was to remove .\obj folder and rebuild the project. Worked great!