Nov*_*Eng 8 vsto add-in wix ms-word setup-deployment
我VSTO Word add in在 VS 2017 Pro 中开发了一个。工作正常,准备部署。但是,我找不到用于打包我的工作程序以VSTO Word add in在我的开发机器以外的机器上使用。对于任何特定的机器,我需要将它部署一次,并让任何可能使用其帐户登录的用户都可以使用它。
第一次遇到这个,但它涉及使用 InstallShield Limited Edition,显然 VS 2017 不再可用。
试过这个,但它的一些步骤似乎缺少部分或说“做x”而不解释如何。
尝试了“InnoSetup”和“bovendor/VstoAddinInstaller”,但遵循“bovendor”过程会导致“Innosetup”编译器抛出错误(bovender 指示的节缺少必需的元素)。无法从 bovendor 获得响应。
搜索Microsoft文档,只是找不到程序。任何人都可以提供打包 VSTO Word 插件以进行部署的过程吗?
更新 使用 WiX 工具集成功打包并部署了我的加载项。看我下面的回答
Nov*_*Eng 12
更新 (11/26/2019):如果您的设置使用 64 位 Office,请参阅如何打包 VSTO Word 插件以部署到使用 WIX 运行 Microsoft Office 64 位的 64 位 Windows 10 计算机?
add-in使用WiX工具集成功打包部署我的
信用:我使用Pieter van der Westhuizen在Add-in Express 博客上的示例学到了大部分内容。
我在我的开发机器(64 位)上使用Visual Studio Pro 2017、.NET 4.6.1和C#来实现我的VSTO Word加载项。
我的要求是将add-in一次部署到 64 位生产机器(即 Citrix 虚拟桌面主映像),以便登录到生产计算机(即基于主映像登录到虚拟桌面)的任何用户都可以使用它)。32 位版本的 Word 2013 安装在主映像上。
据我了解,这意味着“插件”必须安装在“C:\Program Files (x86)”下,原因有两个:
此外,由于所有用户都需要访问add-in,所需的VSTO注册表项设置位于根目录下HKLM(而不是HKCU)。本质上,这种“所有用户”设置与“一个用户”相反Click-Once设置。没什么,我在一个没有连接到互联网的飞地。所以,我使用的所有软件都是在别处下载的,然后携带到飞地中并安装到本地。
我的VSTOword 插件(即 in C:\....\Visual Studio 2017\Projects\FooAddIn\FooAddIn\bin\Release)的发布文件是:
我做了什么
从http://wixtoolset.org/releases/下载并安装'WiX' v3.11.1 到我的开发机器上。
从https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension下载并安装“Wix Toolset Visual Studio 2017 Extension”到我的开发机器上
使用和 in打开我的add-in项目,鼠标右键单击顶行节点并单击。FooAddInVS 2017Solution ExplorerSolutionAdd -> New Project
在Add New Project对话框中,单击v3下WiX Toolset,然后单击Setup Project for WiX v3。我将新项目命名为FooAddInSetup。Visual StudioSolution Explorer显示Solution FooAddIn (2 projects)、项目FooAddIn和项目FooAddInSetup。
在 下FooAddInSetup -> References,添加了对C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll和的引用C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll(Product.wxs 文件的元素需要这些来构建安装程序)。
配置 VS 以构建安装程序:在 VS 中,单击构建 -> 配置管理器。在配置管理器对话框中,选中BuildFooAddInSetup的复选框。
创建EULA.rtf(我的说“这是免许可软件”)并将其放置在 C:....\Visual Studio 2017\Projects\FooAddIn\FooAddInSetup
为我的VSTO发布文件位置的路径创建了一个预处理器变量:在解决方案资源管理器中,鼠标右键单击FooAddInSetup -> Properties。在 FooAddInSetup 选项卡上,单击“构建”。在该General部分中,单击Define 'Debug' preprocessor variable。在Define preprocessor variables:文本框中输入AddinFiles=..\FooAddIn\bin\$(Configuration)\
在Product.wxs 文件下WiX Product.wxs为我填充样板文件,add-in如下所示
注意:在wxs文件中,我修改了元素中的Visual Studio 2010 Tools for Office Runtime超链接Condition- Pieter 示例中的超链接已失效。
我将解决方案配置设置为Release并构建了解决方案。
FooAddInSetup.msi从...\FooAddInSetup\bin\release我的开发机器复制到我的生产机器(VDI 主机)并以管理员身份运行安装程序。
结果
不考虑我在wxs文件中声明的注册表设置,我的注册表项是在 中创建的HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Office\Word\AddIns\LesCaveatAddIn,即它们按预期进入 HKLM,但它们进入\Software\Wow6432Node\Microsoft.....而不是\Software\Microsoft....我在wxs文件中编码。我认为这是因为我的生产机器是 64 位机器。
正如预期的那样,加载项本身安装在 c:\program files (x86) 下
调出 Word,加载项按预期加载
产品.wxs文件
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<!--
The boilerplate Product.wxs file already contains the minimum amount of elements needed to build a WiX installer.
If the Product element, Id attribute is set to an asterisk (*), WiX will generate a new GUID every time the setup project is compiled (I left it as-is).
Change the Name attribute value and Manufacturer attribute value to values of your choice.
-->
<Product Id="*"
Name="FOO Add-In"
Language="1033"
Version="1.0.0.0"
Manufacturer="Foo Masters"
UpgradeCode="4b35cc09-4780-4644-a7d4-f5901f7a7e45">
<!--Attributes shown are the minimum number needed to build the setup project.-->
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- Verify if VSTO Office Runtime is installed -->
<Property Id="VSTORUNTIMEREDIST">
<RegistrySearch
Id="VSTORuntimeRedist"
Root="HKLM"
Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R"
Name="Version"
Type="raw" />
</Property>
<Condition
Message="The Visual Studio 2010 Tools for Office Runtime is not installed.
Please download and install from https://www.microsoft.com/en-us/download/details.aspx?id=48217.">
<![CDATA[Installed OR VSTORUNTIMEREDIST>="10.0.30319"]]>
</Condition>
<!-- Verify if .NET Framework is installed -->
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
<!--I want one Cab file, so only one Media element is needed. Make sure the EmbedCab attribute value is "yes".-->
<Media Id="1" Cabinet="FooAddin.cab" EmbedCab="yes"/>
<!--Set values for display on setup progeam UI-->
<Feature Id="ProductFeature" Title="FOO Add-In" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="Registry_FriendlyName" />
<ComponentRef Id="Registry_Description" />
<ComponentRef Id="Registry_Manifest" />
<ComponentRef Id="Registry_LoadBehavior" />
</Feature>
<!--Specify that the WiXUI_Minimal UI should be used, i.e, the simplest UI available -->
<UIRef Id="WixUI_Minimal" />
<!--Specify the EULA file to use-->
<WixVariable Id="WixUILicenseRtf" Value="EULA.rtf" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="FooAddin" />
<!-- Add required VSTO registry entries for 32-bit Word -->
<!-- see https://docs.microsoft.com/en-us/visualstudio/vsto/registry-entries-for-vsto-add-ins?view=vs-2019-->
<Component Id="Registry_FriendlyName">
<RegistryValue Id="RegKey_FriendlyName" Root="HKLM"
Key="Software\Microsoft\Office\Word\AddIns\FooAddin"
Name="FriendlyName"
Value="FOO Add-In"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_Description">
<RegistryValue Id="RegKey_Description" Root="HKLM"
Key="Software\Microsoft\Office\Word\AddIns\FooAddin"
Name="Description"
Value="FOO Add-In"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_Manifest">
<RegistryValue Id="RegKey_Manifest" Root="HKLM"
Key="Software\Microsoft\Office\Word\AddIns\FooAddin"
Name="Manifest" Value="[INSTALLFOLDER]FooAddin.vsto|vstolocal"
Type="string" KeyPath="yes" />
</Component>
<Component Id="Registry_LoadBehavior">
<RegistryValue Id="RegKey_LoadBehavior" Root="HKLM"
Key="Software\Microsoft\Office\Word\AddIns\FooAddin"
Name="LoadBehavior" Value="3"
Type="integer" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Fragment>
<Fragment>
<!-- Add refs to the components of the VSTO-->
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="MSOfficeToolsCommon_dll_Component">
<File Id="MSOfficeToolsCommon_dll" KeyPath="yes"
Name="Microsoft.Office.Tools.Common.v4.0.Utilities.dll"
Source="$(var.AddinFiles)"></File>
</Component>
<Component Id="FooAddin_dll_Component" >
<File Id="FooAddin_dll" KeyPath="yes"
Name="FooAddin.dll"
Source="$(var.AddinFiles)" />
</Component>
<Component Id="FooAddin_vsto_Component">
<File Id="FooAddin_vsto" KeyPath="yes"
Name="FooAddin.vsto"
Source="$(var.AddinFiles)"></File>
</Component>
<Component Id="FooAddin_dll_manifest_Component">
<File Id="FooAddin_dll_manifest" KeyPath="yes"
Name="FooAddin.dll.manifest"
Source="$(var.AddinFiles)"></File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3226 次 |
| 最近记录: |