Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "GenerateResource" task failed unexpectedly null reference exception

Tags:

asp.net-mvc

This is my friend's his project that I need, it works perfectly fine but here it struggles to start up, giving this error:

Severity    Code    Description Project File    Line
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.<ExecuteInstantiatedTask>d__26.MoveNext() RecipesApp  

I've read many solutions: this is my Obj folder if this helps any:

enter image description here

like image 552
Maxim Avatar asked Jan 05 '16 20:01

Maxim


2 Answers

Deleted my entire 'obj' folder and it seems to work.

like image 157
Maxim Avatar answered Sep 27 '22 17:09

Maxim


The temporary solution seems to be this:

completely delete all build outputs and build again (bin and obj directories)

This seems to be a known bug in the RTM of Visual Studio 2015 (or better said in the MSBuild tool which Visual Studio uses). changing files from windows explorer or overwriting Solution parts or even changing the directory of project are known cases of this incident.

the issue is that an internal cache gets interpreted incorrectly on the old bits, causing this crash. So delete the bin and obj folder from your project and try again.

The fix seems to be deployed in Visual Studio 2015 Update 1. If you haven't installed that yet, I would give that a try.

like image 28
AmiNadimi Avatar answered Sep 27 '22 17:09

AmiNadimi