none
VsPackage: ProvideAutoLoad only works in VS experimental hive

    Question

  • Hello.
    I'm using VS & VS SDK 2008 and .NET 3.5.

    This is my previous question about the topic:
    "VsPackage: How to start a VsPackage when VS starts?"
    http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/636978df-057d-433a-9c0c-0e4cde655f95

    According to the answers, I modified my code like this:
    (The 'ProvideAutoLoad' attribute line is added)

    [PackageRegistration(UseManagedResourcesOnly = true)]  
    [DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\9.0")]  
    [InstalledProductRegistration(false, "#110", "#112", "1.0", IconResourceID = 400)]  
    [ProvideLoadKey("Standard", "1.0", "My Package", "My Company", 104)]  
    [ProvideMenuResource(1000, 1)]  
    [ProvideToolWindow(typeof(MyToolWindow))]  
    [Guid(GuidList.guidRpccPackagePkgString)]  
     
    [ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.SolutionExists)]  
     
    public sealed class MyPackage : Package {  
      ...  


    And it worked in VS experimental hive. My package was loaded when I opened a solution. And I created a Setup project for my VsPackage, and installed my package using setup.msi created by the Setup project.
    The package seemed installed successfully, and it works the same as it did in VS experimental hive. But the only different thing is the package is not loaded when I open a solution. It is loaded when I select a custom tool window or a custom menu item, as if the 'ProvideAutoLoad' attribute is not provided.

    Anybody experienced the same problem?
    Waiting for help.

    Thanks!
    Wednesday, March 04, 2009 1:12 PM

Answers

  • Make sure that the setup is placing all the registry entries that are needed.  This particular registry entry will be found under:

    HKLM\Software\Microsoft\VisualStudio\9.0\AutoLoadPackages\{adfc4e64-0397-11d1-9f4e-00a0c911004f}

    {adfc4e64-0397-11d1-9f4e-00a0c911004f} is the guid for NoSolution.  Under this, there needs to an entry for your guid and the value being a dword = 0.

    Below is an example cut from a .reg file:

    [HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\AutoLoadPackages\{adfc4e64-0397-11d1-9f4e-00a0c911004f}]
    "{7B711C6E-434C-4e1b-8E71-0767CBD081D8}"=dword:00000000

    In the above example, you would substitue {7B711C6E-434C-4e1b-8E71-0767CBD081D8} for the guid of your package.

    To check to make sure all settings are being placed in the registry, I generate a .reg file using regpkg.exe (under the VisualStudioIntegration\Tools\Bin dir in the sdk install).  Example:

    regpkg.exe /regfile:<outputfile.reg> /codebase <yourvspackage.dll>
    • Proposed as answer by Darren Stokes Wednesday, March 04, 2009 4:19 PM
    • Marked as answer by nyam Thursday, March 05, 2009 6:53 AM
    Wednesday, March 04, 2009 1:37 PM

All replies

  • Make sure that the setup is placing all the registry entries that are needed.  This particular registry entry will be found under:

    HKLM\Software\Microsoft\VisualStudio\9.0\AutoLoadPackages\{adfc4e64-0397-11d1-9f4e-00a0c911004f}

    {adfc4e64-0397-11d1-9f4e-00a0c911004f} is the guid for NoSolution.  Under this, there needs to an entry for your guid and the value being a dword = 0.

    Below is an example cut from a .reg file:

    [HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\AutoLoadPackages\{adfc4e64-0397-11d1-9f4e-00a0c911004f}]
    "{7B711C6E-434C-4e1b-8E71-0767CBD081D8}"=dword:00000000

    In the above example, you would substitue {7B711C6E-434C-4e1b-8E71-0767CBD081D8} for the guid of your package.

    To check to make sure all settings are being placed in the registry, I generate a .reg file using regpkg.exe (under the VisualStudioIntegration\Tools\Bin dir in the sdk install).  Example:

    regpkg.exe /regfile:<outputfile.reg> /codebase <yourvspackage.dll>
    • Proposed as answer by Darren Stokes Wednesday, March 04, 2009 4:19 PM
    • Marked as answer by nyam Thursday, March 05, 2009 6:53 AM
    Wednesday, March 04, 2009 1:37 PM
  • It works!
    I didn't know I needed to configure registry values.

    Thanks!
    Thursday, March 05, 2009 6:53 AM