Reputation: 1874
My package is only loaded in Experimental Instance. I have the following package class attributes:
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "3.6.1365", IconResourceID = 400)]
[ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(GuidList.guidVSPackage2012PkgString)]
public sealed class VSixPackage : Package
pkgdef file content:
[$RootKey$\InstalledProducts\VSixPackage]
@="#110"
"Package"="{011cc127-af13-4974-903a-9e6518b2b641}"
"PID"="3.6.1365"
"ProductDetails"="#112"
"LogoID"="#400"
[$RootKey$\Packages\{011cc127-af13-4974-903a-9e6518b2b641}]
@="VSixPackage"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Vsix3_6_1365.VSixPackage"
"CodeBase"="$PackageFolder$\Vsix3_6_1365.dll"
[$RootKey$\Menus]
"{011cc127-af13-4974-903a-9e6518b2b641}"=", Menus.ctmenu, 1"
extension.vsixmanifest :
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011">
<Metadata>
<Identity Id="011cc127-af13-4974-903a-9e6518b2b641" Version="3.6.1365" Language="en-US" Publisher="Ltd." />
<DisplayName>Package 3.6.1365</DisplayName>
<Description>etc...</Description>
<Icon>Resources\Package.ico</Icon>
</Metadata>
<Installation InstalledByMsi="true" AllUsers="true">
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[11.0,12.0)" />
<InstallationTarget Version="[11.0,12.0)" Id="Microsoft.VisualStudio.Premium" />
<InstallationTarget Version="[11.0,12.0)" Id="Microsoft.VisualStudio.Ultimate" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" Version="4.5" />
<Dependency Id="Microsoft.VisualStudio.MPF.11.0" DisplayName="Visual Studio MPF 11.0" Version="11.0" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="Vsix3_6_1365.pkgdef" />
</Assets>
</PackageManifest>
These files (including Vsix3_6_1365.dll) are installed to
"%VSInstallDir%\Common7\Ide\Extensions\Your Company\Your Product\Version"
folder. When .vsix file is created it registers the Package successfully but I need to do this automatically with msi. How can it be registered for original Visual Studio (not Experimental Instance)?
Update1:
I have several packages (different versions) with
[$RootKey$\InstalledProducts\VSixPackage]
in .pkgdef file. Can it be the reason of the problem?
Update2:
I tried different names instead of "VSixPackage" (added version like VSixPackage3_6_1382) but this did not help. Strange thing these VSPackages - they were working for a while - I used VSExtension:VsixPackage to install my package - it ceased to delete it during uninstall. And it could not register the Package for VS2013. Now this problem.
Upvotes: 3
Views: 1368
Reputation: 5518
The provided attributes on the package class, package definition file and extension manifest seem to be okay. I guess the reason why the extension is only loaded by the experimental hive is because Visual Studio registers the extension when you build it (at least before you run the extension through the debugger when pressing F5).
When you install your extension via MSI
you must register the extension programmatically... just copying the extension assembly files to the extensions folder within Visual Studio´s installation directory does not work. If you´re using the WiX
toolset to assemble the Windows installer package, you can use the VsixPackage
element to register the extension.
You´ll find the documentation at: http://wixtoolset.org/documentation/manual/v3/xsd/vs/vsixpackage.html
If your extension does not require any special installation tasks (like writing to the registry or setting up other tools and/or third-party components), an MSI
installation is not needed, instead you can install the extension by just executing the vsix file from Windows Explorer; this will show a dialog where you´ve to confirm the installation.
I never tried to setup an extension manually, but you could try to set the following keys (maybe some more might be required; just examine the configuration of the experimental hive to figure all required keys and values)...
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\InstalledProducts\<package-name>
REGSZ: (Default) = #110
REGSZ: LogoId = #400
REGSZ: Package = <package-guid>
REGSZ: PID = <package-product-id>
REGSZ: ProductDetails = #112
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\BindingPaths\<package-guid>
REGSZ: <package-installation-folder-path> = ""
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Packages\<package-guid>
REGSZ: (Default) = <package-name>
REGSZ: Class = <package-class-fullname>
REGSZ: CodeBase = <package-assembly-fullpath>
REGSZ: InprocServer32 = "C:\Windows\SYSTEM32\MSCOREE.DLL"
Upvotes: 4