“RG0000: is not a valid Win32 application”

Resource compiler had been throwing this at me since this morning after I added an ImageList to a form. Looking up the above error message on Google provided some answers none of which worked in this case.

In my particular case I had to remove references to Managed DirectX DLLs from the command line that was being passed to ResGen.exe. Now I need to find a way to remove these references from the command-line that MS-Build puts together from the project file.

PS: Managed DirectX is no longer supported nor is it being developed. Try SlimDX instead.