Unable to compile 3.5 sp1 or lower framework (win 7 64 bit) RRS feed

  • Question

  • Before, it was working when I compiled programs in c# with framework 3.5 or lower, but now I cannot. I however, still can compile with 4.0 (and only 4.0).


    Here is the error log i get:


    Error 1 Failed to execute command: ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe" /useSourcePath /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /compile FormMain.resx,obj\Debug\FileChangeNotifier.frmNotifier.resources Properties\Resources.resx,obj\Debug\FileSystemWatcher.Properties.Resources.resources". The handle is invalid. C:\VS-2010\Languages\C#\Projects\FileSystemWatcher\FileSystemWatcher\TRACKER FileChangeNotifier

    Note: I can compile this and all other programs on a win vista with the same codes with 3.5 or lower.




    From: Zananok

    • Moved by SamAgain Tuesday, August 3, 2010 10:08 AM related to msbuild process (From:64-Bit .NET Framework Development.)
    Thursday, July 29, 2010 9:07 AM


  • Hello Zananok,

    This is a known issue with Windows 7 64-bit. The problem is that resgen.exe sitting in the \Microsoft SDKs\Windows\v7.0A\bin directory is not marked as a 32-bit compliant executable. Compare the results of that to running corflags against the resgen.exe found in the \Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools directory.  You'll see that version is marked as 32-bit.  Your builds targeting .NET 4 that are succeeding are using the latter, while 3.5 builds use the former. 

    So I would suggest you try two potential solutions Mike Johnson gave in following thread:

    Best Regards,

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Nancy Shao Friday, August 6, 2010 9:53 AM
    Wednesday, August 4, 2010 1:23 AM