3

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.

4

1 回答 1

4

包类、包定义文件和扩展清单上提供的属性似乎没问题。我猜扩展仅由实验性配置单元加载的原因是因为 Visual Studio 在构建扩展时注册了扩展(至少在按 F5 时通过调试器运行扩展之前)。

当您通过安装扩展时,MSI您必须以编程方式注册扩展...仅将扩展程序集文件复制到 Visual Studio 安装目录中的扩展文件夹是行不通的。如果您使用WiX工具集来组装 Windows 安装程序包,则可以使用该VsixPackage元素来注册扩展。

您可以在以下位置找到文档:http ://wixtoolset.org/documentation/manual/v3/xsd/vs/vsixpackage.html

如果您的扩展不需要任何特殊的安装任务(例如写入注册表或设置其他工具和/或第三方组件),MSI则不需要安装,您可以通过从 Windows 执行 vsix 文件来安装扩展探险家;这将显示一个对话框,您必须在其中确认安装。

我从未尝试手动设置扩展,但您可以尝试设置以下键(可能需要更多键;只需检查实验配置单元的配置以计算所有必需的键和值)...

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"
于 2013-10-14T10:52:30.203 回答