首页 新闻 会员 周边

wpf 程序用AnyCpu方式生成秒开,用X86方式启动要1分钟

0
[已解决问题] 解决于 2018-06-10 22:09

测试了6台机器,全是win7 64位,

如果用AnyCpu方式编译,启动都是秒开;

如果用X86方式编译,其中两台启动要30秒到1分钟,请问有什么方法可以解决X86方式启动慢的问题

绝对不是程序问题,我特意新建了空白程序进行测试。

老牛在路上的主页 老牛在路上 | 初学一级 | 园豆:11
提问于:2018-05-20 15:21
< >
分享
最佳答案
0

通常都是用 AnyCpu , 即使不用 AnyCpu ,64 位的系统也要用 x64 啊,为什么你偏偏要用 x86 ?

它们之间的区别(来源):

  • AnyCPU will compile your assembly to run on any platform. DLLs and EXEs compiled with AnyCPU option will behave with sutle difference. On a 64-bit Windows operating system, EXEs compiled with this option will execute on the 64 bit CLR, while DLLs compiled with this option will execute on the same CLR as the process into which it is being loaded. So, if a 32bit EXE load a DLL that is compiled with this option, the process is 32bit so the DLL will run on the 32bit CLR.
  • x86 option compiles your assembly to be run by the 32-bit, x86-compatible common language runtime. On 32bit platform, the EXEs will run as 32bit process. On 64bit platform, the EXEs will run under WOW64 mode.
  • x64 option compiles your assembly to be run by the 64-bit common language runtime on a computer that supports the AMD64 or EM64T instruction set.
    Also please take a look at: How to: Optimize an Application for a Specific CPU Type
奖励园豆:5
dudu | 高人七级 |园豆:31007 | 2018-05-20 16:00

因为引用了指纹仪和签字板的dll,他们的dll都是x86的,只能用x86才能调用,用any cpu无法调用

老牛在路上 | 园豆:11 (初学一级) | 2018-05-22 10:53

@老牛在路上: AnyCPU有个 Prefer 32-bit (首选32位)的选项,也许可以解决问题,参考:WPF打包32位和64位程序 运行在ghost WIN7上问题

dudu | 园豆:31007 (高人七级) | 2018-05-22 11:56

@dudu: 那个要在.net4.5以上才行,我们的程序是.net 4.0的

老牛在路上 | 园豆:11 (初学一级) | 2018-05-23 14:28
其他回答(3)
0

6台电脑有2台启动慢,这难道不应该这两台电脑重装系统看看?

爱编程的大叔 | 园豆:30839 (高人七级) | 2018-05-20 20:26

关键是客户有几千台电脑,随便测试几台就有这个问题,不可能让他们都重装。

支持(0) 反对(0) 老牛在路上 | 园豆:11 (初学一级) | 2018-05-22 10:54
0

输出程序的启动日志查看一下啊,看看到底哪个步骤慢了。

lazy_ant | 园豆:209 (菜鸟二级) | 2018-06-11 08:56
0

八成和环境有关

DiggingDeeply | 园豆:338 (菜鸟二级) | 2018-06-11 11:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册