|
assemblyCodeGroupName,
assemblyCodeGroupDescription);
stateSaver.Add(allUsers, allUsers);
修改为:
bool allUsers = String.Equals(allUsersString, 1);

// Note that Install method may be invoked during Repair mode and the code group
// may already exist.
// To prevent adding of another code group, remove the code group if it exists.
try
 {
// The solutionCodeGroupName must be a unique name; otherwise, the method might delete wrong code group.
CaspolSecurityPolicyCreator.RemoveSecurityPolicy(allUsers, solutionCodeGroupName);
}
 catch {}

string[] assemblys = assemblyName.Split(,);
foreach (string assembly in assemblys)
 {
string assemblyPath = Path.Combine(targetDir, assembly);
CaspolSecurityPolicyCreator.AddSecurityPolicy(
allUsers,
solutionCodeGroupName,
solutionCodeGroupDescription,
assemblyPath,
assemblyCodeGroupName,
assemblyCodeGroupDescription);
}

stateSaver.Add(allUsers, allUsers);
很笨的方法。:-)(前两天正是这个符号诞生25周年)
12、编译我们的安装项目,这样我的AddIn就可以安装到装有Office 2007的系统上了。
我们会得到一个警告: WARNING: No HomeSite attribute has been provided for 2007 Microsoft Office Primary Interop Assemblies, so the package will be published to the same location as the bootstrapper. 看安装项目的Debug目录

这个是因为安装程序不能通过微软网站下载2007 Microsoft Office Primary Interop Assemblies(微软未提供),所以将安装包一起发布,我们的安装程序会直接从本地运行这个msi。 这些运行的先决条件,也可以同我们的安装包一起发布。特别是在目标主机无外网连接的情况下。

编译后如下:

当然,我们可以自己去实现这些检测和安装,添加一个Register search和lunch condition, Register Search属性如下:
 Lunch Condition属性如下:
 这样我们的安装包一样可以从本地安装VSTO运行时。
这样安装包比较大,我们可以发布两个版本,视具体情况而定。
现在AddIn的安装包基本完成了,其他的一些东西:安装界面,版本...我在这里就不介绍了,现在想说的是这个安装包还不够完美,没有检测是否安装Office 2007,我们也可以通过注册表来实现。
其实,要做出比较好的安装包还是要用Installshiled,但是俺好久没用它了,也不知道如何用它去做Office AddIn的安装包,并且它需要付费,因此,还是用了Windows Installer。
上一页 [1] [2]
制作VSTO 2005 SE开发的Office 2007 AddIn的安装包 |