none
VB.net 2010 Ultimate error comctl32.dll missing as reference.

    Question

  • I have been using the VB IDE for many months on a VB6 translation to vb.net 2010. I have had no troubles building and running in debug,until the message below just appeared. This now prevents me from running in debug. I have not used Publish  in the Build menu or used ClickOnce. 

    The Project - application page has "enable XP visual styles" checked. I do not want this unchecked, which will remove the error message below.

    The error message is:

     

    Error 2 Could not find file 'Microsoft.Windows.Common-Controls, Version=6.0.0.0, Culture=*, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=*, Type=win32'.

    This refers to file comctl32.dll, a copy of which is now in the project directory. I have been unable to add a reference to it in the References page, using browse, the message being:

    "A reference to comctl32.dll could not be added. Please make sure that it is a valid assembly or com component"

    The error list states "Could not find file 'Microsoft.Windows.CommonControls, Version 6.0.0.0, Culture= *, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=*, Type=win32'.

    This version and PublicKeyToken etc comes from the app.manifest  "<assemblyIdentity"

    I am running under Windows 7 64 bit. I have changed the compile/advanced Compiler settings from anyCPU to x86, without effect. Platform remains at active(any CPU), unchangeable.

    App.manifest enclosed.

    <?xml version="1.0" encoding="utf-8"?>
    <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <assemblyIdentity version="5.0.0.0" name="AffinityN" />
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
          <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
            <!-- UAC Manifest Options
                If you want to change the Windows User Account Control level replace the 
                requestedExecutionLevel node with one of the following.
    
            <!requestedExecutionLevel  level="asInvoker" uiAccess="false" />
            <!requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
            <!requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
    
                Specifying requestedExecutionLevel node will disable file and registry virtualization.
                If you want to utilize File and Registry Virtualization for backward 
                compatibility then delete the requestedExecutionLevel node.
            -->
            <requestedExecutionLevel level="asInvoker" uiAccess="false" />
          </requestedPrivileges>
          <applicationRequestMinimum>
            <PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
            <defaultAssemblyRequest permissionSetReference="Custom" />
          </applicationRequestMinimum>
        </security>
      </trustInfo>
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
          <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
          <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--&gt;
        </application>
      </compatibility>
      <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
      <dependency>
        <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> 
      </dependentAssembly>
       </dependency>--&gt;
    
    </asmv1:assembly>
    

     

     

     

     

      


    David W. Macpherson
    Tuesday, January 24, 2012 11:01 AM

All replies

  • The file Comctl32.dll is a Windows system file and can be found in the System32 directory. Under 64-bit Windows it is also in the SysWOW64 folder under the Windows folder.

    This file is not a COM DLL and should not be moved, however; the COM wrapper component is Comctl32.ocx (which is found in the same location). I would suspect this is component the app should be referencing (Add Reference...COM tab...Microsoft Windows Common Controls 6.0).

    Also, keep in mind that there is no 64-bit version of the COM wrapper, so you cannot use this component if your app is running 64-bit. If you cannot find Comctl32.ocx then it will have to be copied to the appropriate System folder and registered using the Regsvr32 utility.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, January 24, 2012 1:30 PM
  • Paul,

    Thanks for the prompt reply.

    Conctl32.ocx is listed as an ActiveX Control, and can only be accessed in References under the Browse tab, not the COM tab. It makes no comment but does not add the .ocx as a reference.

    Any other ideas?

    David.


    David W. Macpherson
    Wednesday, January 25, 2012 1:02 AM
  • Paul,

    Thanks for the prompt reply.

    Conctl32.ocx is listed as an ActiveX Control, and can only be accessed in References under the Browse tab, not the COM tab. It makes no comment but does not add the .ocx as a reference.

    Any other ideas?

    David.


    David W. Macpherson


    Just curious, did you register it using the Regsvr32 utility as Paul suggested and you are still not seeing it under the COM tab?

     

    Wednesday, January 25, 2012 1:37 AM
  • The method I mentioned in my previous post is exactly how you add an ActiveX (COM) control to a project. If you do not see Microsoft Windows Common Controls 6.0 (i.e. Comctl32.ocx), then the ActiveX control needs to be registered as I described.

    Using the Browse method may register the control as well but I cannot recall. Typically this needs to be done with elevated privileges (Run as Administrator).


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, January 25, 2012 2:45 AM
  • Paul,

    No, until reminded by Ding-Boy, I did not register comctl32.ocx with regsvr32.

    I have now done this, with comctl32 copied to AffinityN\obj\debug, and get error 0x8002801c - "Module loaded but entry point was not found".

    Re the original entry in app.manifest, which was:

    "

    <

     

    assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> "

    and came about probably when I copied copied the later version of comctl32.dll from the Windows 7 partition running XP, therefore the publickeytoken would be incorrect - am I right?

    How can I get easily get the publickeytoken of the dll in the Windows 7 partition, and can I manually correct the app.manifest? I have tried to use get a type library of the dll using Tlbexp, but it reports there is no library in the dll.

    David.

      

     
    David W. Macpherson
    Wednesday, January 25, 2012 12:28 PM
  • See the below link. The user apparently removed a reference to this component from the manifest:

    http://social.msdn.microsoft.com/Forums/is/vbgeneral/thread/383f3825-a22c-416c-a08a-a0edc2c392a4

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, January 25, 2012 4:35 PM
  • In addition to what Paul said, you maybe able to just tell your program to compile to x86 (32-bit) if that's an option for you.   To do this go into your project properties, got to compile, then to advanced compile option and change it from "Any CPU" to x86. 

    If 64-bit is not a requirement, this should work assuming the 32-bit ocx is in place.

    Wednesday, January 25, 2012 6:06 PM
  • Paul and bpell,

    That reference was for publishing difficulties, which I am not doing.

    I am still in the debug stage, and this problem is preventing running in debug.

    I am logged on as administrator.

    With regard to Bpell, many thanks for your comment, My project - compile - advanced compile is set at x86 cpu.

    I have tried commenting out the app.manifest <AssemblyIdentity line/>, but the error list message persists and the message after ReBuild is:

    "VS cannot start debugging because the debug target 'AffinityN\bin\AffinityN.exe' is missing. Please build the project and retry, or set the outputPath and AssemblyName properties appropriately to point at the correct location for the target assembly"

    I thought I had done these correctly. The Compile tab reads as follows;

    config - debug  platform - any CPU.

    Build output paths=bin/ ( this path has files AffinityN.vshost<.exe .sln .suo .xml1>)

    Options explicit/on  strict/off  compare/text  infer/off.

    Warnings implicit,late binding, implicit object assumed, all None.

    All other warnings=warn.

    Advanced compile options:

    dll base address=&H00400000  gensrate dubug info=full.

    define debug and trace constants=checked,checked.

    custom constants-win32=true.

    generate serialisation assemblies=auto

    Target cpu=x86

    target framework=.Net framework 4.

    Paul - to assist you, how about enabling users to copy modal error messages, and enabling pages of the compile settings to be copied, instead of the above summaries, which you may find difficult to understand? Also to enable the tab key on this forum? 

    With regard to the error list message "could not find Microsoft.Windows.Common-Controls..", where does this reside, and how do you get rid if it? As stated above,I have commented out the app.manifest for this item. 

    What do I do now to get this back in debug?

    David

     

     


    David W. Macpherson
    Thursday, January 26, 2012 4:28 AM
  • Paul,

    Tried deleting the manifest as reference by you on that site.

    Result on rebuild is error:

    Error 1 Unable to read manifest 'My Project\app.manifest'. Could not find file 'C:\AffinityN\My Project\app.manifest'. AffinityN

    Restoring the app.manifest, on rebuild, gave the message:

    Error 1 Could not find file 'Microsoft.Windows.Common-Controls, Version=6.0.0.0, Culture=*, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=*, Type=win32'. AffinityN

    This is the same message with or without the ! on the '<AssemblyIdentity ' line.

    David.


    David W. Macpherson
    Thursday, January 26, 2012 8:04 PM
  • Paul,

    The mistery depends.

    I was able to register Comctl32.ocx, copied to the project directory, by right clicking the desktop short cut and running as administrator. Previously I was logged in as administrator before clicking the short cut. However, I was not able to add a reference as it was not listed as a COM, and browse does not do it.

    I added a com reference for Windows Common Controls 6.0, the only one listed, in C:\Windows\SysWoW64\Mscomctl.ocx which when added appears as C:\Windows\Assembly\GAC\Mscomctl\10.0.4504.0_31bf3856ad364e35\msconctl.dll.

    Both this and an earlier reference for Common Controls 5.0 listed as AffinityN\obj\debug\Interop.comctlLib.dll 

    appear in the unused references list.

    The App.manifest still contains the entry for v6.0.0.0 etc.

    I have tried altering the manifest line to copy the new version above, substituting the rev and GAC ref, but the project still does not build and retains the same error message.

    More help please,

    David.

     


    David W. Macpherson
    Friday, January 27, 2012 9:01 AM
  • OK, lets back up a bit. I re-read your post and I think I see what you are trying to do.

    First, remove the Reference to Windows Common Controls 6.0 (the ActiveX control MSCOMCTL.OCX) if you added it to your project. For now, leave the manifest as is but verify that the file comctl32.dll is in the Windows System directory, or Windows SysWOW64 folder if you are running 64-bit Windows. Since this is a system file it should not be moved from the Windows System or SysWOW64 folder. There should be no local copies of this file or the ActiveX control in your application folder.

    Once you have done this try running your app again.

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Friday, January 27, 2012 6:57 PM
  • Paul,

    Thanks for the reply.

    Deleted also local moved file comctl32.ocx, and subsequently reference to Windows common controls 5.0.

    Rebuilt project. Message is:

    Error 1 Could not find file 'Microsoft.Windows.Common Controls, Version=10.0.4504.0, Culture=*, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=*, Type=win32'. AffinityN

    This was the data I added to app.manifest by hand.

    Tried to run with error, got previous message:

    "VS cannot start debugging because the debug target 'AffinityN\bin\AffinityN.exe' is missing. Please build the project and retry, or set the outputPath and AssemblyName properties appropriately to point at the correct location for the target assembly"

    I am running 64 bit. The only file in sysWOW64 referring to comctl32 is comctl32.dep.

    What other info can I provide?

    David.

       


    David W. Macpherson
    Saturday, January 28, 2012 12:22 AM
  • It sounds like Comctl32.dll was moved from the SysWOW64 folder. It needs to be restored since other apps and the system itself use it. Also, I think you need to change the version number in the manifest back to 6.0. I found a link that has an example of how to configure for visual styles:

    http://www.codeproject.com/Articles/2907/Windows-XP-Visual-Styles-for-Windows-Forms

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Saturday, January 28, 2012 2:28 AM
  • Paul,

    I am guilty of giving you the wrong info. Comctl32.ocx and .dll are in sysWOW64 folder, in lower case, whereas the .dep file is in caps.

    I have restored app.manifest to v6.0.0.0 and publickeytoken to 6595b64144ccf1df as in email of 26 Jan. The error message remains as modified by this entry in the manifest. This is without and with the sysWOW .ocx reference added.

    I do not have an issue with XP visual styles, which is set in the Application tab. As reported in the first email, the error goes away when the XP styles box is unchecked, but this is not what I want. Quite apart from the n forms I will have to change, I do not like the result.

    How do I check that the publickeytoken is correct?

    I am convinced that Microsoft VB.net has a bug in debug, and I am asking for assistance.

    David.


    David W. Macpherson
    Sunday, January 29, 2012 12:12 AM
  • Paul,

    It is now 12 days since my last post, and I have got no further in reBuilding for debug.

    1. I am puzzled why the new Reference I am adding, a COM shown as file C:\Windows\sysWOW64\MSCOMCTL.OCX:

    "Microsoft Windows Common Controls 6.0 (SP6) type COM Version 2.0.0.0 CopyLocal false

      C:\Windows\assembly\GAC\mscomctl\10.0.4504.0_31bf3856ad364e35"

    although accepted without any message, never appears automatically in My Project app.manifest?

    2. The reference is shown (Windows explorer) in C:\Windows\assembly with the name 'mscomctl', the above version and PublicTokenKey.

    3. I have to add the above reference by hand in the app.manifest as AssemblyIdentity after 'enable themes for Windows Common Controls..'

    4. The error message below after Rebuild is identical with the info I have added by hand, that is, there is no automatic building of the manifest.

    "Error 1 Could not find file 'mscomctl, Version=10.0.4504.0, Culture=*, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=*, Type=win32'. AffinityN"

    5. No change of version number or reducing the entry to name and PublicTokenKey or adding a reference path to the assembly file has any effect. There are no files mscomctl.* in the project directory or subdirectories.

    6. Bearing in mind that the system may be looking for MSCOMCTL.DLL, this is found (VC prompt search)under directory:

    "C:\windows\assembly\GAC\mscomctl\10.0.4504.0_31bf3856ad364e35"

    Please advise urgently.

    Regards,

    David.

     


    David W. Macpherson

    Friday, February 10, 2012 12:49 AM
  • Paul,

    The file path has a double underscore, viz:

    C:\windows\assembly\GAC\mscomctl\10.0.4504.0__31bf3856ad364e35

    The files therein are:

    MSCOMCTL.DLL and __AssemblyInfo__.ini

    The .ini file gives Signature, MVID, displayName=mscomctl,version=10.0.4504.0,culture=neutral and

    PublicKeyToken=31bf3856ad364e35.

    regards,

    David.

     


    David W. Macpherson

    Friday, February 10, 2012 11:00 AM
  • To all visitors,

    Contrary to the impression in the vb app.manifest :

    "Enable themes for Windows common controls and dialogs (Windows XP and later",

    I have come to the conclusion that XP styles are available for XP OS only.

    On deletion of this portion of the manifest, and unchecking this in Project - Application, I have been able to continue this project in dubug mode.

    Tks to those who have assisted.

    David Macpherson.


    David W. Macpherson

    Thursday, February 16, 2012 5:31 AM
  •      I have found that I recieve the same error (Can't find file ...Microsoft.Windows.Common-Controls, Version=6.0.0.0, Culture=*) upon checking off the "Enable Click Once Security Settings" option of the Security tab of my project.  After un-checking this option I no longer recieve the error.  I am using XP Styles on a 64-bit Windows 7 OS.

    Hope yours is the same.

    Glenn


    Glenn T. Kitchen VB.NET Forums

    Wednesday, February 22, 2012 3:38 AM
  • First install the Visual Basic 6.0 Common Controls package:

    http://www.microsoft.com/en-us/download/details.aspx?id=10019

    then Use the ADMIN Command Prompt to run the below command :

    Regsvr32.exe "C:\Windows\SysWOW64\MSCOMCTL.OCX"

    Wednesday, September 05, 2012 5:00 PM