| 加入收藏| 设为首页| 联系我们

首页 站长学习 站长之家 源码下载 建站素材 书籍教程 常用工具
 您现在的位置: 动力中国 >> 网络编程 >> ASP.NET教程 >> 文章正文  
 [组图]制作VSTO 2005 SE开发的Office 2007 AddIn的安装包
 

制作VSTO 2005 SE开发的Office 2007 AddIn的安装包

http://www.domcn.org  文章来源:本站收藏  点击数:

  关键字:制作VSTO 2005 SE开发的Office 2007 AddIn的安装包

首先,明确要使AddIn能运行得前提条件:
1、.Net Framework 2.0
2、VSTO 2005 SE runtime
3、Visual Studio Tools for Office Language Pack 非英文版本需要安装
4、Primary interop assemblies redistributable package for the 2007 release of Office(一般安装Office 2007时已经安装了)

使用VSTO 2005 SE开发完Office 2007的AddIn后制作Windonws Installer安装包过程如下:

1、下载安装Visual Studio 2005 Tools for Office Second Edition Sample: Deploying Office Solutions Using Windows Installer;

2、下载VSTO 2005 SE runtime,将vstor.exe拷贝到C:\Program Files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample\Packages\VSTOSERuntime下;

3、安装Windows SDK,Vista和Win 2003的都可以。主要为了编译一个cpp文件,不需要全部安装;

4、运行VS2005的命令行工具,到Visual Studio 2005 Tools for Office Second Edition Sample安装目录下,默认是C:\Program Files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample\projects\Checks,运行

cl.exe -I D:\Program Files\Microsoft Platform SDK\Include /Oxs /MT /GS ComponentCheck.cpp


编译ComponentCheck.cpp生成一个exe文件,拷贝到Packages\Office2007PIA下。

Vista 的是Include路径是D:\Program Files\Microsoft SDKs\Windows\v6.0\Include

5、下载Primary interop assemblies redistributable package for the 2007 release of Office,下载安装后,将o2007pia.msi拷贝到Packages\Office2007PIA下;

6、需要的话就下载Visual Studio Tools for Office Language Pack,拷贝到Packages\VSTOLP;

7、将Packages下的所有内容拷贝到.Net Framwork 目录下Pagckages目录,默认位置C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages;

8、添加projects目录下的SetSecurity到自己的AddIn项目中,它的作用是在安装时为我们的程序集添加安全策略。如果不添加安全策略,我们的插件是不会被Office调用的;

9、添加所有的项目输出到安装项目中;


10、在安装项目的属性中添加运行的先决条件。如果不执行第7步,这里是不能选择这些先决条件的。添加以后,安装时会检查这些组件,如果未安装,安装程序会提示用户连接微软网站下载和安装;


11、为安装项目添加Custom Actions,注册表项已经由VSTO模板创建了,可以根据自己的需要再修改,比如添加到HLM下;

选择SetSecurity的主输出
在Install的CustomActionData中添加:

/assemblyName=OutlookAddin.dll /targetDir=[TARGETDIR]\
   /solutionCodeGroupName=MyCompanyName.OutlookAddin
   /solutionCodeGroupDescription=Code group for OutlookAddin
   /assemblyCodeGroupName=OutlookAddin
   /assemblyCodeGroupDescription=Code group for OutlookAddin
   /allUsers=[ALLUSERS]


RollBack的CustomActionData中添加:

/solutionCodeGroupName=MyCompanyName.OutlookAddin

Uninstall的CustomActionData中添加:

/solutionCodeGroupName=MyCompanyName.OutlookAddin

Install时,如果只有一个dll,SetSecurity除外,这样设置就可以了,也不用修改代码,如果你有多个dll要为每个添加安全策略,这就要对这个参数和SetSecurity做一点修改:

/assemblyName=OutlookAddin.dll,2.dll,3.dll /targetDir=[TARGETDIR]\
   /solutionCodeGroupName=MyCompanyName.OutlookAddin
   /solutionCodeGroupDescription=Code group for OutlookAddin
   /assemblyCodeGroupName=OutlookAddin
   /assemblyCodeGroupDescription=Code group for OutlookAddin
   /allUsers=[ALLUSERS]

在SetSecurity.cs中以下这短代码:

                bool allUsers = String.Equals(allUsersString, 1);
                string assemblyPath = Path.Combine(targetDir, assemblyName);

                // 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 {}

                CaspolSecurityPolicyCreator.AddSecurityPolicy(
                    allUsers,
                    solutionCodeGroupName,
                    solutionCodeGroupDescription,
                    assemblyPath,
       

[1] [2] 下一页


制作VSTO 2005 SE开发的Office 2007 AddIn的安装包
  • 上一篇文章:

  • 下一篇文章:
  •  热门文章
    普通文章 电子邮件改头换面 四公司畅谈未
    普通文章 PC病毒史上最声名狼藉的八大病
    普通文章 Rails系统中的AJAX开发技术简析
    普通文章 基于ASP.NET AJAX框架实现表单
    普通文章 开发ASP.NET AJAX客户端定制行
    普通文章 用JFreeChart对JSP报表进行增强
    普通文章 SQL Server 2005上的CLR和ADO.
    普通文章 SQL Server 2005的XML支持机制
    普通文章 Firefox中标签式浏览技巧大全
    普通文章 Tomcat中的Session和Cookie大揭
     
     推荐文章
    推荐文章 把Google地图嵌入网页 就是这么
    推荐文章 迅雷搜索候选资源出错的解决
    推荐文章 轻松去除迅雷里的各种广告和资
    推荐文章 突破限制 免费领养到QQ空间五级
    推荐文章 Rational统一过程RUP贴近中小软
    推荐文章 构建自己的轻量级XML DOM分析程
    推荐文章 WPS Office 2007技巧:妙用配置
    推荐文章 Excel 2007:求余数函数实用进阶
    推荐文章 浅谈ASP.NET的Postback
    推荐文章 软件开发中项目需求管理简述
     
     相关文章
    没有相关文章
    设为首页 | 加入收藏 | 广告合作 | 联系站长 | 版权申明 |
    动力中国为网友提供免费学习资料,可用资源,如果您认为我们的相关内容侵害到了您的权利请联系管理员
    Copyright © 2006-2008 domcn.org All Rights Reserved.