VC2005 下应用程序发布配置步骤

来源:互联网 发布:淘宝改版后如何看差评 编辑:程序博客网 时间:2024/06/04 20:06

 发布配置步骤 (Release方式编译)

我的身份证识别程序中使用了CxImage ,调试时一直用CxImage动态库的Debug版本(cximagecrtd.dll),在发布总弹出初始化错误,事件信息显示为 "DLL 版本信息不匹配错误" 导致发布不成功。发现问题所在后把CxIImage也按Release配置进行编译,得到Release版本动态库(cximagecrt.dll) 问题得到解决。 没有进行部署配置的可执行文件在目录机器执行可能会生成 “配置错误”或“初始化错误” 主要原因是不能找到匹配的依赖库(*.dll), 需要使用*.manifest  (部署文件)进行定位.

项目名称:Identification

发布配置目标位置  本地 x:/Setup  x = c | d | e 盘.......

操作目录 项目文件夹  Release下

1. 把项目按Release 配置进行编译 在 项目的Release 文件夹下生成可执行文件及一些附近文件。 把生成的可执行文件Identification.exe  及部署配置文件 Identification.exe.intermediate.manifest  拷贝到 x:/Setup下

2. 把之前用到的CxImage 动态库 cximagecrt.dll 也拷贝到了 x:/Setup下

操作目录

3.将Identification.exe.intermediate.manifest  改名为 Identification.exe.manifest   注:.exe 之前命名同可以执行文件名称

4. 打开 Identification.exe.manifest    (我的文件内容如下:)

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

5. 在 x:/Setup 目录 跟据 name='Microsoft.VC80.CRT'  这个信息 创建目录 命名为 Microsoft.VC80.CRT 同样也需要创建

Microsoft.VC80.MFC 这个目录

现在目录结构:

x:/Setup

-----|Identification.exe

-----|Identification.exe.manifest

-----|Microsoft.VC80.CRT (目录)

-----|Microsoft.VC80.MFC (目录)

 

 记下 文件中  version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'  这段配置信息

6.到c:/windows/winsxs  下查找对应的目录

我查到的目录

x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700

x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_3bf8fa05

注意信息匹配。

如果没有这个些目录或没有匹配的目录 查找或下载 vcredist_x86.exe  并安装 vc8安装后在

x:/Program Files/Microsoft Visual Studio 8/SDK/v2.0/BootStrapper/Packages/vcredist_x86 可以找到。

拷贝 x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700 目录中 *.dll 到 x:/Setup/Microsoft.VC80.CRT  拷贝x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_3bf8fa05 目录中 *.dll 到x:/Setup/Microsoft.VC80.MFC

 

Microsoft.VC80.CRT  和Microsoft.VC80.MFC目录中还需要下面的配置文件  同样也需要注意版本匹配

我的两个配置文件如下:

名称:Microsoft.VC80.CRT.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable></noInheritable>
    <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    <file name="msvcr80.dll" hash="10f4cb2831f1e9288a73387a8734a8b604e5beaa" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>n9On8FItNsK/DmT8UQxu6jYDtWQ=</dsig:DigestValue></asmv2:hash></file>
    <file name="msvcp80.dll" hash="b2082dfd3009365c5b287448dcb3b4e2158a6d26" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>0KJ/VTwP4OUHx98HlIW2AdW1kuY=</dsig:DigestValue></asmv2:hash></file>
    <file name="msvcm80.dll" hash="542490d0fcf8615c46d0ca487033ccaeb3941f0b" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>YJuB+9Os2oxW4mY+2oC/r8lICZE=</dsig:DigestValue></asmv2:hash></file>
</assembly>

 

名称:Microsoft.VC80.MFC.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable></noInheritable>
    <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    <file name="mfc80.dll" hash="8f53f3ce664dfb39cadf8ecb34dd49cbd8348227" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>1ojXfwyqiX5uwu0seJ53tIMEcB8=</dsig:DigestValue></asmv2:hash></file>
    <file name="mfc80u.dll" hash="db3a3bfed210d41af3579d948cace75cb74eee0a" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>AltS/xFid2D3AGUQ6aUhtVQjD+4=</dsig:DigestValue></asmv2:hash></file>
    <file name="mfcm80.dll" hash="b8c8711c5caa3a600d9f3138b7bb2ee8987353d2" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>Y8H6ZS9/W9H8y+NhgWOxGaeaORw=</dsig:DigestValue></asmv2:hash></file>
    <file name="mfcm80u.dll" hash="23bd86592cba61a704d8e63eb8c8e9d72212f7e5" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>xsOzrzfyAgJe47nMR3YRxsX7R8I=</dsig:DigestValue></asmv2:hash></file>
</assembly>

 

这两个配置文件中描述的DLL名称与目录中实际的动态库一定要一致。这两个配置文件在VC8的安装目录也能找到

 

这样配置结束后,不管目标主机是否安装VC8 双击可执行文件(Identification.exe) 都是可正常执行。

可以接下来通过安装制作程序制作安装包。

 

原创粉丝点击