在 Visual Studio 2010 中使用实体框架 4.1 定位 x64 平台 [英] Targetting x64 platform with entity framework 4.1 in Visual Studio 2010

查看:38
本文介绍了在 Visual Studio 2010 中使用实体框架 4.1 定位 x64 平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个引用实体框架 4.1 的数据库应用程序.在项目的属性窗口中,配置平台 选择选项都被禁用.我不想将此应用程序仅针对 x64 系统.

I have a database application that references Entity Framework 4.1. In the properties window of the project both the Configuration as well as Platform selection options are disabled. I wan't to target this application only for x64 systems.

在同一个解决方案中还有一些其他项目,它们只有 x86 选项可用作平台.

Also there are some other projects in the same Solution and they have only x86 option avaliable as platform.

我不明白为什么我不能专门针对 x64 系统.我的电脑上运行的是 Windows 7 64 位.

I don't get the idea why I couldn't target x64 systems specifically. I have windows 7 64 bit running on my pc.

有关如何专门针对基于 x64 的系统的任何线索.所有项目均参考 .Net Framework 4.

Any clues how to target specifically to x64 based systems. All projects reference .Net Framework 4.

仅显示任何 CPU"选项的项目屏幕截图

Screen shot of the project showing only "Any CPU" option

编辑 1:为什么我需要针对 x64 系统.

实际上,我正在开发的 dll 必须加载到 Autocad x64 系统中.但是当我尝试将 dll 加载到 Autocad 中时,它拒绝了 dll 并出现以下错误

Actually, the dlls that I am developing will have to load in Autocad x64 systems. But when I am trying to load the dll into Autocad it is rejecting the dll with the following error

NETLOAD Cannot load assembly. Error details: System.BadImageFormatException: 
Could not load file or assembly 
'file:///D:RailwayProjectsRelayAnalysis_NewRelayAnalysis_AutocadinDebugGl
obalArea.dll' or one of its dependencies. An attempt was made to load a program 
with an incorrect format.
File name: 
'file:///D:RailwayProjectsRelayAnalysis_NewRelayAnalysis_AutocadinDebugGl
obalArea.dll'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String 
codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, 
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean 
forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName 
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean 
forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, 
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm 
hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, 
StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at loadmgd()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value 
[HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure 
logging.
To turn this feature off, remove the registry value 
[HKLMSoftwareMicrosoftFusion!EnableLog].

我强烈怀疑 Autocad x64 拒绝了 dll,因为它不是 x64 格式,尽管我在这里可能是错的.所以现在我将问题的范围扩大到包括 AutoCAD,因为问题的根源是在 autocad 中加载 dll.我在网上搜索,发现AutoCAD对x32和x64类型非常挑剔.用于开发 Autocad 插件的原生开发环境 AutoCAD.net 在 x32 和 x64 类型下也分别可用,我认为用 x32 开发的插件不会在 x64 类型的 Autocad 版本中运行,反之亦然.反之.所以,我需要具体说明 Autocad 插件的目标平台

I have a strong suspicion that Autocad x64 is rejecting the dll because it not in x64 format, although I may be wrong here. So now I expand the scope of my question to include AutoCAD, as the root of the problem is loading the dll in autocad. I have searched the web and found that AutoCAD is very picky about x32 and x64 types. The native developement environment AutoCAD.net for developing the Autocad plugins is also available separately under x32 and x64 types and I don't think that plugins developed with x32 will run in x64 type Autocad versions, and vice-versa. So, I need to be specific about the target platform for Autocad plugins

推荐答案

在配置管理器中,有一个创建新配置的选项,我们可以在其中选择 x64 作为目标平台.

In the Configuration Manager, there is an option to create new Configuration where we can select x64 as target platform.

关于 AutoCAD 2012,它对平台类型非常严格.64 位 AutoCAD 2012 将接受任何 CPU"x64 目标插件,但不接受 x86.这与我们可以在 x64 系统上运行 x86 应用程序的惯例有点不同.我将所有项目都定位到 x64 并将它们加载到 AutoCAD 中,没有任何错误.

Regarding the AutoCAD 2012, its very strict about the platform type. A 64 bit AutoCAD 2012 will accept "Any CPU" and x64 targeted plugins but not x86. That's a little off from the convention where we can run x86 applications on x64 systems. I targeted all my projects to x64 and loaded them in AutoCAD without any errors.

所以我的问题解决了.

这篇关于在 Visual Studio 2010 中使用实体框架 4.1 定位 x64 平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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