visual-studio-2010 - Visual Studio 2010 中使用 Entity Framework 4.1 面向 x64 平台

标签 visual-studio-2010 entity-framework-4.1 autocad autocad-plugin

我有一个引用 Entity Framework 4.1 的数据库应用程序。在项目的属性窗口中,配置平台选择选项均被禁用。我不想将此应用程序仅定位于 x64 系统。

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

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

有关如何专门针对基于 x64 的系统的任何线索。所有项目都引用.Net Framework 4。

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

enter image description here

编辑 1:为什么我需要以 x64 系统为目标。

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

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,因为问题的根源是在 autocad 中加载 dll。我在网上搜索了一下,发现AutoCAD对x32和x64类型非常挑剔。用于开发 Autocad 插件的 native 开发环境 AutoCAD.net 也可以在 x32 和 x64 类型下单独使用,我不认为使用 x32 开发的插件可以在 x64 类型 Autocad 版本中运行,反之亦然。反之亦然。因此,我需要具体说明 Autocad 插件的目标平台

最佳答案

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

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

所以我的问题已经解决了。

关于visual-studio-2010 - Visual Studio 2010 中使用 Entity Framework 4.1 面向 x64 平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13660652/

相关文章:

c++ - 更改 visual studio 2010 中的默认编译器

vb.net - 如何使自定义ComboBox(OwnerDrawFixed)看起来像标准ComboBox的3D?

c# - 公开 Ria 服务 SP1 和 EF 4.1 POCO 中的关联实体

entity-framework-4.1 - Entity Framework 代码首先按 ID 删除而不获取(通用样式)

excel - 包含 Excel 文件的 AutoCAD 文件的路径

c# - 如何将数据库更改传播到我的 .edmx 文件?

c++ - 调用成员函数,在类外部声明

wpf - Entity Framework 4 - 关联通知

c++ - 调试 AutoCAD 模块

c# - 一个类方法之间类库中的数据持久化