如果.NET“任何CPU”项目绑定到框架或Framework64的DLL? [英] Should .NET 'Any CPU' projects bind to Framework or Framework64 DLLs?

查看:146
本文介绍了如果.NET“任何CPU”项目绑定到框架或Framework64的DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#的Visual Studio项目(.csproj的),有一个参考Framework64版本<$​​ C $ C> System.Data这的。当我尝试建立使用的MSBuild /的 Team Foundation Server的(TFS)在另一台机器,它没有为64位的DLL不存在。

I have a C# Visual Studio project (.csproj) that has a reference to the Framework64 version of System.Data. When I try to build using MSBuild/Team Foundation Server (TFS) on another machine, it fails as the 64-bit DLL doesn't exist.

我应该绑定到Framework版本,还是将限制我在64位机上运行时?是否.NET重定向结合时,可以使用64位的?

Should I bind to the Framework version, or will this limit me when running on 64-bit machines? Does .NET redirect the binding to use 64-bit when possible?

推荐答案

我想你的意思的任何CPU 的在你的问题,正确的吗?假如是这样的话,不考虑位数结合是要走的路在几乎所有情况下。

I think you mean Any CPU in your question, correct? Assuming that's the case, binding without regard for bitness is the way to go in nearly all circumstances.

回想 .NET code是的 JIT编译(只是在时间编译) - 这意味着32位和64位code OUT的C#或< A HREF =htt​​p://en.wikipedia.org/wiki/Visual_Basic_.NET相对=nofollow> VB.NET 编译器是一样的,不管你打算运行在什么架构。当code为JIT编译在运行时,当它变成是32位或64位。

Recall that .NET code is JITed (Just In Time compiled) -- meaning 32 bit and 64 bit code out of a C# or VB.NET compiler is the same no matter what architecture you plan to run on. When the code is JITed at runtime, that's when it becomes 32 or 64 bit.

在某些情况下,你必须介意目标架构。一个特定的情况下,将任何引用/在 COM -wrapper的DLL,.NET框架的依赖性提供或以其他方式。这是这些DLL文件将被标记(在COM的情况下)为32位,仅(如COM是32位仅架构),如果他们没有被标记为32位,互操作,以COM将无法正常运行。因此,由于它们明确标记,你的项目产出应该一样。

In some situations, you do have to mind the target architecture. One specific case would be any references/dependencies on COM-wrapper DLLs, .NET Framework supplied or otherwise. This being that these DLL files will be marked (in the case of COM) as 32 bit-only (as COM is 32 bit only architecture) if they were not marked as 32 bit, interop to COM would not function. Therefore, since they are explicitly marked, your project outputs should be as well.

这篇关于如果.NET“任何CPU”项目绑定到框架或Framework64的DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆