【问题标题】:Run a shell command or executable file from a VSIX installer package?从 VSIX 安装程序包运行 shell 命令或可执行文件?
【发布时间】:2014-01-08 07:51:09
【问题描述】:

我正在手动处理 VSIX 扩展包的 vsixmanifest,是这样的:

<?xml version="1.0" encoding="utf-8"?>
<Vsix Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
  <Identifier Id="c669b00e-3746-47bd-bfe7-e6f9d64458ff">
    <Name>RapidDesign</Name>
    <Author>ZUI INFRA sp z o. o.</Author>
    <Version>2.0.1</Version>
    <Description>RapidDesign allows you to use various VisualStudio designers faster.</Description>
    <Locale>1033</Locale>
    <MoreInfoUrl>http://www.rapiddesignaddin.com</MoreInfoUrl>
    <License>EULA.txt</License>
    <Icon>Speedometer.png</Icon>
    <PreviewImage>RapidDesignPreview.png</PreviewImage>
    <InstalledByMsi>false</InstalledByMsi>
    <SupportedProducts>
      <VisualStudio Version="12.0">
        <Edition>Ultimate</Edition>
      </VisualStudio>
    </SupportedProducts>
    <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
  </Identifier>
  <References>
    <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">
      <Name>Visual Studio MPF</Name>
    </Reference>
  </References>
  <Content>
    <VsPackage>RapidDesign.pkgdef</VsPackage>
  </Content>
</Vsix>

有一种方法可以告诉 VSIX 安装程序自动运行 CMD 命令或可执行文件,比如一种安装后步骤?

例如,我想运行/安装一个为我配置一些默认扩展选项的注册表脚本(.reg 文件),但我不知道该过程是否可以通过启动控制台命令的 vsixmanifest 自动完成,或者以前编写的 EXE 进程。

【问题讨论】:

    标签: .net xml visual-studio visual-studio-extensions vsix


    【解决方案1】:

    vsix 包不应依赖注册表进行设置,there is a specific API to access the Visual Studio settings 系统。一个normal vsix package cannot call or start anything after deployment。您可以让包本身在第一次启动时设置默认值。

    如果您在设置过程中确实需要更高级的东西,您可以创建 .msi 而不是 vsix。 You'll need to extract your vsix and include its contents in your Windows Installer package。或者您可以使用 WixToolset 创建一个 MSI 安装程序并使用&lt;VsixInstaller&gt; element 注册 Visual Studio 包,您可以将其他逻辑放在 Wix 安装程序项目中。

    【讨论】:

    • 谢谢,我选择了其他更简单的替代方案,即运行 vsix 包和 regfile 的 SFX 安装程序。真的学习 MSI 只是为了运行一个文件对我来说似乎不是一个好主意,再次感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-06
    • 2017-10-30
    • 1970-01-01
    • 2016-06-24
    • 2010-10-13
    • 1970-01-01
    • 2014-04-25
    相关资源
    最近更新 更多