win7 vs生成exe可执行文件名中包含install或setup

来源:互联网 发布:工程量清单计价软件 编辑:程序博客网 时间:2024/04/29 19:48

近日,程序打包时候,测试出以下两个没有注意到的问题,费了半天终于找到解决方法,参考网上一些资料。整理如下:

问题描述: 

在Windows 7系统下,若EXE文件名中包含有’install’、’setup’等字样,可能出现如下问题:
1. 每次软件运行完退出后会弹出”程序兼容性助手”(Program Compatibility Assistant, 简称PCA),提示软件未正确安装。
2. 在Vista+的操作系统下任务栏右键该程序缺少”将此程序锁定到任务栏”和软件名同名项。

分析: 
Windows会自动进行启发式的安装包嗅探,估计其中的一条规则就是如果软件名中含有install或setup就会认为运行的软件是一个软件包。

解决方案: 
问题1: 
满足如下两项之一:

方法1.在项目配置中修改,配置属性->连接器->生成清单->选择否。
方法2.一、在注册表项HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted下有以可执行文件全路径为名,值为REG_DWORD类型的1的项。 
二、为可执行文件添加类似如下的Manifest文件,指定程序支持Win7与Vista。

[html] view plaincopy
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  
  2.   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">  
  3.     <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">  
  4.       <application>  
  5.         <!--The ID below indicates application support for Windows Vista -->  
  6.           <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>  
  7.         <!--The ID below indicates application support for Windows 7 -->  
  8.           <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>  
  9.       </application>  
  10.     </compatibility>  
  11.   </assembly>  

问题2: 
在项目配置属性->常规->目标文件名->修改生成名字。

0 0
原创粉丝点击