你怎么使用维克斯的部署应用程序级3.0外接程序?
题
我要部署应用程序级3的应用程序级词2007年addin,我已经写Visual Studio2008年。我看到维克斯有一个扩展名为WixOfficeExtension看起来就像它可能具有这一功能,但我找不到任何文件,我不能辨别它的目的从来源的代码。
有人试图这之前,你们能把它关闭成功?
解决方案
这是代码,我在使用。我基本上移植的例子 MSDN 使用维克斯.
注: 这具体的解决办法是唯一词2007年addin,但情况的Excel是非常相似。只需修改的注册/组件检查和钥匙/价值根据前述 MSDN文章.
列入名单定义的行动
为了运行外接程序的完全信任,它必须被添加到列入名单的当前用户。只有这样,才能做到这一可靠的是一个自定义的行动。这是一个港口的定义操作的 文章 新的 部署工具的基础 包括与维克斯.
使用,创建一个新的丹麦信托基金项目称为VSTOCustomAction和加CustomAction.cs。
CustomAction.csusing System;
using System.Security;
using System.Security.Permissions;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.VisualStudio.Tools.Office.Runtime.Security;
namespace VSTOCustomActions
{
public class CustomActions
{
private static string GetPublicKey(Session session)
{
return session["VSTOCustomAction_PublicKey"];
}
private static string GetManifestLocation(Session session)
{
return session["VSTOCustomAction_ManifestLocation"];
}
private static void ErrorMessage(string message, Session session)
{
using (Record r = new Record(message))
{
session.Message(InstallMessage.Error, r);
}
}
[CustomAction]
public static ActionResult AddToInclusionList(Session session)
{
try
{
SecurityPermission permission =
new SecurityPermission(PermissionState.Unrestricted);
permission.Demand();
}
catch (SecurityException)
{
ErrorMessage("You have insufficient privileges to " +
"register a trust relationship. Start Excel " +
"and confirm the trust dialog to run the addin.", session);
return ActionResult.Failure;
}
Uri deploymentManifestLocation = null;
if (Uri.TryCreate(GetManifestLocation(session),
UriKind.RelativeOrAbsolute, out deploymentManifestLocation) == false)
{
ErrorMessage("The location of the deployment manifest is missing or invalid.", session);
return ActionResult.Failure;
}
AddInSecurityEntry entry = new AddInSecurityEntry(deploymentManifestLocation, GetPublicKey(session));
UserInclusionList.Add(entry);
session.CustomActionData.Add("VSTOCustomAction_ManifestLocation", deploymentManifestLocation.ToString());
return ActionResult.Success;
}
[CustomAction]
public static ActionResult RemoveFromInclusionList(Session session)
{
string uriString = session.CustomActionData["VSTOCustomAction_ManifestLocation"];
if (!string.IsNullOrEmpty(uriString))
{
Uri deploymentManifestLocation = new Uri(uriString);
UserInclusionList.Remove(deploymentManifestLocation);
}
return ActionResult.Success;
}
}
}
维克斯的片段
我们显然需要实际的维克斯的文件,安装addin.参考它从你主。wcs文件
<FeatureRef Id="MyAddinComponent"/>
Addin.wcs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment Id="Word2007Fragment">
<!-- Include the VSTO Custom action -->
<Binary Id="VSTOCustomAction" SourceFile="path\to\VSTOCustomAction.dll"/>
<CustomAction Id="AddToInclusionList" BinaryKey="VSTOCustomAction" DllEntry="AddToInclusionList" Execute="immediate"/>
<CustomAction Id="RemoveFromInclusionList" BinaryKey="VSTOCustomAction" DllEntry="RemoveFromInclusionList" Execute="immediate"/>
<!-- Set the parameters read by the Custom action -->
<!--
The public key that you used to sign your dll, looks something like <RSAKeyValue><Modulus>...</Modulus><Exponent>...</Exponent></RSAKeyValue>
Take note: There should be no whitespace in the key!
-->
<Property Id="VSTOCustomAction_PublicKey"><![CDATA[Paste you public key here]]></Property>
<CustomAction Id="PropertyAssign_ManifestLocation" Property="VSTOCustomAction_ManifestLocation" Value="[INSTALLDIR]MyAddin.MyAddin.vsto" />
<!-- Properties to check prerequisites -->
<Property Id="VSTORUNTIME">
<RegistrySearch Id="RegistrySearchVsto"
Root="HKLM"
Key="SOFTWARE\Microsoft\vsto runtime Setup\v9.0.30729"
Name="SP"
Type="raw"/>
</Property>
<Property Id="HASWORDPIA">
<ComponentSearch Id="ComponentSearchWordPIA"
Guid="{816D4DFD-FF7B-4C16-8943-EEB07DF989CB}"/>
</Property>
<Property Id="HASSHAREDPIA">
<ComponentSearch Id="ComponentSearchSharedPIA"
Guid="{FAB10E66-B22C-4274-8647-7CA1BA5EF30F}"/>
</Property>
<!-- Feature and component to include the necessary files -->
<Feature Id="MyAddinComponent" Title ="Word 2007 Addin" Level="1" AllowAdvertise="no">
<ComponentRef Id="MyAddinComponent"/>
<Condition Level="0"><![CDATA[NOT ((VSTORUNTIME="#1") AND HASSHAREDPIA AND HASWORDPIA)]]></Condition>
</Feature>
<DirectoryRef Id="INSTALLDIR">
<Component Id="MyAddinComponent" Guid="your component guid here">
<File Name="MyAddin.dll" Source="path\to\MyAddin.dll" />
<File Name="MyAddin.dll.manifest" Source="path\to\MyAddin.dll.manifest" />
<File Name="MyAddin.vsto" Source="path\to\MyAddin.vsto" />
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Office\Word\Addins\MyAddin"
Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="FriendlyName" Value="MyAddin Word 2007 Addin" />
<RegistryValue Type="string" Name="Description" Value="MyAddin Word 2007 Addin" />
<RegistryValue Type="string" Name="Manifest" Value="[INSTALLDIR]MyAddin.vsto|vstolocal" KeyPath="yes"/>
<RegistryValue Type="integer" Name="LoadBehavior" Value="3"/>
</RegistryKey>
</Component>
</DirectoryRef>
<!-- Modify the install sequence to call our custom action -->
<InstallExecuteSequence>
<Custom Action="AddToInclusionList" After="InstallFinalize"><![CDATA[(&MyAddinComponent = 3) AND NOT (!MyAddinComponent = 3)]]></Custom>
<Custom Action="PropertyAssign_ManifestLocation" Before="AddToInclusionList"><![CDATA[(&MyAddinComponent = 3) AND NOT (!MyAddinComponent = 3)]]></Custom>
<Custom Action="RemoveFromInclusionList" After="InstallFinalize"><![CDATA[(&MyAddinComponent = 2) AND NOT (!MyAddinComponent = 2)]]></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
希望这样可以节省一些时间对一个人在那里。
其他提示
我很惊讶没有一个已经回答了这个...我一直在研究外接程序,所以我将只倾倒一些链接在这里。我不知道你如果你已经找到了解决你在寻找什么,但这可以帮助别人找像我这样的:
答案是,安装应用程序级3.0外接程序,用于办公室的工作对于维克斯,但我不知道任何有关这WixOfficeExtension?我得到它的工作不是一个简单的任务,需要相当多的东西来获得这一成就的正确:
步骤1。我真的想要使用的应用程序级?
步骤2。确定应用程序级是对在这里阅读:
从毫米沙Shneerson--部署应用程序级,为2007年: http://blogs.msdn.com/mshneer/archive/2006/01/05/deployment-articles.aspx Microsoft部署信息: http://msdn.microsoft.com/en-us/library/bb386179.aspx#
步骤3。我需要安装多个addin的时间或希望使用维克斯的原因我想要吗? 去第4步。
如果不使用安装在visual studio,让你的生活很容易的...这里是微软设置的安装,最简单的方式: http://msdn.microsoft.com/en-us/library/cc563937.aspx
去这里找到一个很好的摘要的提示/想法。我浏览论坛的帮助,以及在这里,非常良好的网站。(好的总结,geered outlook但适用于办公室): http://www.outlookcode.com/article.aspx?ID=42
步骤4。维克斯
A)获得熟悉这个你需要它:注册条目应用程序级加载 http://msdn.microsoft.com/en-us/library/bb386106.aspx#
B)使用设置基于对象从窗户安装在visual studio产生MSI文件。
C)测试,msi和确保你的addin工作使用microsoft MSI。相信我的许多问题需要你的时间最多在这里。
D)运行dark.exe (在维克斯站),并看一下该登记册的设置,建立,是为输出的文件。
E)添加这些注册中设置到你的维克斯的文件。
-我没有找到这个博客一点点有用的,但这是为com扩展中心的Excel: http://matthewrowan.spaces.live.com/blog/cns!CCB05A30BCA0FF01!143.项
F)运行和部署。
注:我会添加更多的在这里我找到更多的在这里。我仍然在学习维克斯,我能做什么与它的外接程序,等等。维克斯是很大的,办事处加载项部署是一个皇家痛苦。