none
Windows From Control Library with Vs 2010.

    Question

  • Hello,

    I have a problem when I try to build a windows form control library project using visual studio 2010 under Windows 7 64bits with Framework .NET 3.5 SP1.

    If I create a blank "windows forms control library" projet, I can build it without any problem.

    If I change the default UserControl (for exemple if I modify the size of the control) I got this error :

    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:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.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 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /compile UserControl1.resx,obj\Debug\WindowsFormsControlLibrary1.UserControl1.resources". The handle is invalid. C:\TEMP\WindowsFormsControlLibrary1\WindowsFormsControlLibrary1\TRACKER WindowsFormsControlLibrary1

    I build 3 other projects (Class Library) on this machine (VS 2010, .NET 3.5 SP1) and after force 32Bit on resgen.exe, I can build them without any problem.

    However each time I create a Windows Form control Library project, I can't build it if I modify/add a userControl or if I had a resource file in the project.

    How can I fix this problem ?

    Wednesday, May 29, 2013 11:08 AM

All replies

  • Hi Skerdreux,

    Welcome to the MSDN Forum.

    Do you mean by any "windows forms control library"?

    I didn't reproduce this scenario.

    Would you like to try a new project and make a reproduce steps.

    Thanks.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 30, 2013 8:27 AM
  • Hi Mike,

    Here, all my steps to create my project (Windows 7 64bits, VS 2010 :

    Run VS2010 as Administrator,

    File>New Project

    Visual C# > Windows > Windows Forms Control Library

    Name (default) : WindowsFormsControlLibrary2

    Location : c:\temp\

    Change Target Framework to ".NET Framework 3.5"

    Build > Build solution

    ==> OK

    then properties on UserControl1 and I Change BackColor properties from "Control Color" to "DeepSkyBlue" (horrible color !)

    Save Change and then 

    Build > Build solution

    I get this : 

    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:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.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 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /compile UserControl1.resx,obj\Debug\WindowsFormsControlLibrary2.UserControl1.resources". The handle is invalid. C:\TEMP\WindowsFormsControlLibrary2\WindowsFormsControlLibrary2\TRACKER WindowsFormsControlLibrary2

    I try on another laptop (Win 7 64 bits, VS2010) and I got the same error

    Thursday, May 30, 2013 3:49 PM
  • Hi Skerdreuk,

    Thank you for providing such information.

    I followed the exactly what you do, and still have no error.

    Based on the error message, this issue is related to the resource. And you didn't change any resource in above steps, so would you like to restore your VS settings:http://msdn.microsoft.com/en-us/library/ms247075(v=vs.100).aspx  And try again?

    In addition, here is a similar thread on this topic, would you like to check it, too: http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/58386669-c50a-4966-8ab5-b1abe6321476  

    That workaround seems to be the same workaround listed on the Microsoft connect bug for this issue(https://connect.microsoft.com/VisualStudio/feedback/details/552575/build-fails-when-targeted-for-3-5-but-succeeds-with-4-0).  I decided that since the trouble is not worth the benefit, I will just delete the resources.resx files and to create my own resources dictionary.  Surpisingly this approach has more benefits than the project resources (cross project reuseablity).

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by skerdreux Wednesday, June 05, 2013 7:50 AM
    • Unmarked as answer by skerdreux Friday, June 07, 2013 2:11 PM
    Friday, May 31, 2013 12:14 AM
  • Sorry but in fact it does not work (I build the project using .NET framework 4.0 instead of 3.5).

    I build a new VMware (Win7 64bits and VS2010) but I still have problem while I'm build a "User control library project" (resgen.exe - handle is invalid).

    I force 32bit on resgen.exe but it does not change anything on this project (on other .NET 3.5 project I can compile after forcing 32bit).

     

    Anyone to test my project  ?

    dl . dropboxusercontent . com/u/55416080/WindowsFormsControlLibrary2.zip

    Friday, June 07, 2013 3:29 PM
  • Hi Skerdreux,

    I have tried your test project.

    It works fine, without any exception, errors.

    What have you try? Restore the VS settings?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 11, 2013 2:08 AM