Assaf Stone
Assaf Stone

Reputation: 6317

How can I automatically enable a VSIX extension, when installing?

I've created a VSIX package that I install via a WIX-generated MSI.

However, when I install it, and look at it in VS2010, in the Tools > Extension Manager menu, it is [Disabled] and I need to enable it manually.

How can I avoid this?

** EDIT **
Here's what I did:
I tried adding capturing the VSInstallDir from the registry like this:

    <Property Id="VSINSTALLER">
  <RegistrySearch Id="VSInstallRegistry" Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0" Name="InstallDir"  Type="directory" />

I added the directory structure under target-dir like this:

    <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="VSINSTALLER">
    <Directory Id="Extensions" Name="Extensions">
      <Directory Id="Copy_CompanyFolder" Name="my company">
        <Directory Id="INSTALLVSIX" Name="app name">
        </Directory>
      </Directory>
    </Directory>
  </Directory>

And I added a CopyFile element to the component in the installation folder, like this:

            <Component Id="VsPackage" Guid="00000000-0000-some-guid-00000000">
          <File Id="VsPackageInstaller" Source="$(folder.prop)\extensionName.vsix"
                KeyPath="yes" DiskId="1">
            <CopyFile Id="Copy_InstallVsix"
                      DestinationDirectory="INSTALLVSIX" />
          </File>
        </Component>

And I added the true element to the manifest.

When I do this, the extension is not installed.

Any ideas why?

Upvotes: 2

Views: 3135

Answers (2)

Aaron Marten
Aaron Marten

Reputation: 6578

If you install your extension files to a directory you create under %VSInstallDir%\Common7\IDE\Extensions, it will be enabled automatically for all users. This is the recommendation for MSI-installed extensions.

Also, please be sure to add <InstalledByMsi>true</InstalledByMsi> to your vsixmanifest.

There is no need to run VSIXInstaller.exe or write registry keys to enable your extension (In fact, you really shouldn't do this.).

Upvotes: 5

anatoly
anatoly

Reputation: 350

Use "VSIXInstaller.exe" tool from VS2010\Common7\IDE.

Also you can manually enable your extension by adding registry value to HKCU\Software\Microsoft\VisualStudio\10.0Exp\ExtensionManager\EnabledExtensions

Upvotes: 3

Related Questions