如何在安装时自动启用 VSIX 扩展?
我创建了一个 VSIX 包,通过 WIX 生成的 MSI 进行安装。
然而,当我安装它,并在VS2010中查看它时,在工具>中查看它。扩展管理器菜单,它是[禁用],我需要手动启用它。
我怎样才能避免这种情况?
** 编辑 **
这就是我所做的:
我尝试添加从注册表捕获 VSInstallDir,如下所示:
<Property Id="VSINSTALLER">
<RegistrySearch Id="VSInstallRegistry" Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="directory" />
我在 target-dir 下添加了目录结构,如下所示:
<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>
我将 CopyFile 元素添加到安装文件夹中的组件,如下所示:
<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>
我将 true 元素添加到清单中。
当我这样做时,扩展未安装。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果将扩展文件安装到在 %VSInstallDir%\Common7\IDE\Extensions 下创建的目录中,它将自动为所有用户启用。这是针对 MSI 安装的扩展的建议。
另外,请务必将
true
添加到您的 vsixmanifest 中。无需运行 VSIXInstaller.exe 或编写注册表项来启用扩展(事实上,您确实不应该这样做。)。
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.).
使用 VS2010\Common7\IDE 中的“VSIXInstaller.exe”工具。
您还可以通过添加注册表值来手动启用扩展
HKCU\Software\Microsoft\VisualStudio\10.0Exp\ExtensionManager\EnabledExtensions
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