【.NET 4.5】新增的 Prefer 32-bit target platform
这本来是一个很小的feature并且也没有什么模糊的地方,关键是VS把这个设置成了默认值,当默认为Any CPU的时候,application会被编译成32-bit mode.
下边是我遇到的问题,在64-bit OS上,使用VS2013创建基于.net 4.5的console 工程,代码如下:
// Software\Wow6432Node\mytest default value is 0
var x86path = @"Software\Wow6432Node\mytest";
// Software\mytest default value is 1
var x64path = @"Software\mytest";
Console.WriteLine(Registry.LocalMachine.OpenSubKey(x86path).GetValue("").ToString()); // output is 0
Console.WriteLine(Registry.LocalMachine.OpenSubKey(x64path).GetValue("").ToString()); // output is 0
Console.WriteLine(Registry.LocalMachine.OpenSubKey(x64path).GetValue("").ToString()); 希望的输出是1,最终输出0. 为什么呢?答案在MSDN中:
anycpu (default) compiles your assembly to run on any platform. Your application runs as a 64-bit process whenever possible and falls back to 32-bit when only that mode is available.
anycpu32bitpreferred compiles your assembly to run on any platform. Your application runs in 32-bit mode on systems that support both 64-bit and 32-bit applications. You can specify this option only for projects that target the .NET Framework 4.5.
x86 compiles your assembly to be run by the 32-bit, x86-compatible common language runtime.
http://msdn.microsoft.com/en-us/library/zekwfyz4.aspx
很显然,anycpu32bitpreferred 就是把application编译成了一个可以在ARM/X64/X86/Itanium下运行的x86 application。这一点算是一个增强,但不应该是一个默认值。
- ------------------------
- 64-bit and 32-bit tips:
- On a 64-bit Windows system, both the 32-bit and 64-bit versions of system DLLs are stored. The 64-bit DLLs are in C:\Windows\System32, and the 32-bit DLLs are in C:\Windows\SysWOW64.
- When a 32-bit process opens a file in C:\Program Files, it actually reads/writes to C:\Program Files (x86).
- There are separate views of (most of) the registry for 32-bit and 64-bit applications. You can change the 64-bit registry location and it wouldn’t be visible to 32-bit applications.
【.NET 4.5】新增的 Prefer 32-bit target platform的更多相关文章
- CSS3新增伪类--好用的:target
问:如果让你实现下图,点击跳转后,让内容1增加一个背景颜色,你会怎么做呢? 可能很多小伙伴第一反应是用JS,给跳转绑定点击事件,然后用DOM获取到内容1,在给其添加css样式. 如果我跟你说用cs ...
- Double prefix overrides to provide 16-bit operand size in a 32/64 operating mode
A processor supports an operating mode in which the default address size is greater than 32 bits and ...
- 《Note --- Unreal --- MemPro (CONTINUE... ...)》
Mem pro 是一个主要集成内存泄露检测的工具,其具有自身的源码和GUI,在GUI中利用"Launch" button进行加载自己待检测的application,目前支持的平台为 ...
- Unity3D Optimizing Graphics Performance for iOS
原地址:http://blog.sina.com.cn/s/blog_72b936d801013ptr.html icense Comparisons http://unity3d.com/unity ...
- DBus接口文档
gitgit.projects.genivi.org / ipc / common-api-dbus-tools.git / blob? search: re 0544e985b6e4a6c83ddf ...
- 使用visual studio 2015调用阿里云oss .net sdk 2.2的putobject接口抛出outofmemory异常
问题描述: 使用阿里云oss .net sdk 2.2版本,使用putobject接口上传文件时,抛出outofmemory异常. 原因分析: 上传时,用于准备上传的数据缓冲区内存分配失败.与应用软件 ...
- 第一周-JAVA基本概念
1. 本周学习总结 本周学习内容: 1.JAVA的发展 2.JDK,JVM,JRE, 3.掌握JAVA的组成结构 4.掌握使用简单的编译器写javac与java命令, 关键概念之间的联系: JVM:将 ...
- sql server连接oracle并实现增删改查
需要一个软件ODAC112040Xcopy_64bit 我连接的oracle是11g r2 sqlserver 是 2016 软件下载 https://pan.baidu.com/s/1OpYmpR ...
- Python基础【day03】:字典(一)
本节内容 简述 语法 字典的使用 字典内置方法 一.简述 字典是Python中的又一种数据结构,它是通过key-value的数据类型,跟我们小时候用的新华字典差不多,通过key去访问value 二.语 ...
随机推荐
- 2018.09.19 atcoder AtCoDeer and Rock-Paper(贪心)
传送门 sb贪心啊. 显然能选帕子就选帕子. 首先假设第一个人全出石头. 考虑把一些石头修改成帕子. 这样贡献只增不减,加起来就是答案. 代码: #include<bits/stdc++.h&g ...
- 使用ASI传递post表单..参数是数组
你可以使用addPostValue方法来发送相同name的多个数据(梦维:服务端会以数组方式呈现): ASIFormDataRequest *request = [ASIFormDataRequest ...
- Corel Video Studio Pro X5
视频编辑也是大学的时候接触过,依稀记得转场,字幕,滤镜,电子相册等的概念.自己也不经常用,所以实践经验比较少.正好接一个机会学习一下视频编辑,用的是会声会影X5. 需要的软件Photoshop,格式工 ...
- EBS Webservice Timeout,HTTP Server Return "500 Internal Server Error"
http://blog.itpub.net/26687597/viewspace-1207571/ 基于Oracle EBS R12,开发了一个Webservice用于返回某项主数据,当请求的数据量非 ...
- SQL笔记---分页
随用随想,随用随记. 通过实际应用掌握SQL语句. 一. SQL分页 1. 第一种方法:利用ID大于多少进行筛选 SELECT TOP 20 *FROM dbo.WMS_Stock ...
- 委托发展史(Linq操作符)
嗯~这篇就讲讲Linq吧! 之前讲过Lambda最后进化到了令人发指的地步: Func<string, int> returnLength; returnLength = text =&g ...
- 自定义两个控件,一个是显示图标和文字的矩形,一个是带边框的label(但是不是label)
记录遇到的两个坑 坑1. 一开始我继承button 来实现下面的控件1,后面发现button没有双击事件.就改成继承UserControl了.重新编译,导致设计时的控件文本全部被清空,因为UserCo ...
- wpf使用DynamicDataDisplay插件,修改x轴的样式,改成透明的。
时光偷走的,永远都是我们眼皮底下看不见的珍贵. 问题:X轴会显示灰色拖动条. 解决:将X轴颜色改为透明. DDD插件是开源的,但是网上的参考资料却很少,所以,很多问题在网上搜索不到,因为没有找到该插件 ...
- webapi token、参数签名是如何生成的(转载)
API接口保障安全性原则:1.有调用者身份2.请求的唯一性3.请求的参数不能被篡改4.请求的有效时间 在刚接触接口开发时,可能脑子里压根就没有这个接口调用安全性的原则,但常识性的经验告诉我们,每一个请 ...
- nginx安装和遇到的问题
nginx安装步骤和遇到的问题 tar -xvf nginx-.tar.gz cd nginx- ./configrue make make install 在configure中可能遇到的问题: ( ...