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

查看:100
本文介绍了在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系统。我的PC上运行的是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:\RailwayProjects\RelayAnalysis_New\RelayAnalysis_Autocad\bin\Debug\Gl
obalArea.dll' or one of its dependencies. An attempt was made to load a program 
with an incorrect format.
File name: 
'file:///D:\RailwayProjects\RelayAnalysis_New\RelayAnalysis_Autocad\bin\Debug\Gl
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 
[HKLM\Software\Microsoft\Fusion!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 
[HKLM\Software\Microsoft\Fusion!EnableLog].

我强烈怀疑Autocad x64拒绝了dll,因为它不是x64格式,尽管我在这里可能是错误的。现在,我将问题的范围扩展到包括AutoCAD,因为问题的根源是将dll加载到autocad中。我在网上搜索后发现,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天全站免登陆