.net – 非托管导出:无法编译程序集

.net – 非托管导出:无法编译程序集,第1张

概述我想创建一个可以从非托管代码(Delphi 5)访问的.NET程序集. 我找到了Unmanaged Exports并按照那里的步骤进行了 *** 作但是我甚至无法成功编译基本示例: using RGiesecke.DllExport;namespace DelphiNET{ public class Class1 { [DllExport("add")] 我想创建一个可以从非托管代码(Delphi 5)访问的.NET程序集.

我找到了Unmanaged Exports并按照那里的步骤进行了 *** 作但是我甚至无法成功编译基本示例:

using RGIEsecke.DllExport;namespace DelphiNET{    public class Class1    {        [DllExport("add")]        public static int Add(int left,int right)        {            return left + right;        }    }}

DelphiNET.csproj项目文件:

...<ItemGroup>  <Compile Include="Class1.cs" />  <Compile Include="DllExport\DllExportAttribute.cs" />  <Compile Include="PropertIEs\AssemblyInfo.cs" /></ItemGroup><import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><import Project="DllExport\RGIEsecke.DllExport.targets" />...

这是错误:

------ Build started: Project: DelphiNET,Configuration: Release Any cpu ------c:\windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /Nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /deBUG:pdbonly /filealign:512 /optimize+ /out:obj\Release\DelphiNET.dll /target:library Class1.cs DllExport\DllExportAttribute.cs PropertIEs\AssemblyInfo.csCompile complete -- 0 errors,0 warningsDelphiNET -> C:\DelphiNET\bin\Release\DelphiNET.dllILDasm: calling 'C:\Program files\Microsoft SDKs\windows\v6.0A\Bin\ildasm.exe' with /quoteallnames /nobar "/out:C:\documents and Settings\Lukas\Local Settings\Temp\tmp29F\DelphiNET.il" "C:\DelphiNET\bin\Release\DelphiNET.dll"C:\DelphiNET\bin\Release\DelphiNET.dll : warning EXP0009: Platform is Anycpu,generating creating binarIEs for each cpu platform in a separate folder...ILAsm: calling 'c:\windows\Microsoft.NET\Framework\v2.0.50727\ILAsm.exe' with /nologo "/out:C:\DelphiNET\bin\Release\x86\DelphiNET.dll" "C:\documents and Settings\Lukas\Local Settings\Temp\tmp29F\DelphiNET.x86.il" /DLL "/resource=C:\documents and Settings\Lukas\Local Settings\Temp\tmp29F\DelphiNET.res"  /optimize  C:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : C:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembling 'C:\documents and Settings\Lukas\Local Settings\Temp\tmp29F\DelphiNET.x86.il'  to DLL --> 'C:\DelphiNET\bin\Release\x86\DelphiNET.dll'C:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Source file is ANSIC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembled method RGIEsecke.DllExport.DllExportAttribute::.ctorC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembled method RGIEsecke.DllExport.DllExportAttribute::get_CallingConventionC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembled method RGIEsecke.DllExport.DllExportAttribute::set_CallingConventionC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembled method RGIEsecke.DllExport.DllExportAttribute::get_ExportnameC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Assembled method RGIEsecke.DllExport.DllExportAttribute::set_ExportnameC:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : ***** FAILURE ***** C:\DelphiNET\DllExport\RGIEsecke.DllExport.targets(8,5): error : Done building project "DelphiNET.csproj" -- Failed.========== Build: 0 succeeded or up-to-date,1 Failed,0 skipped ==========

*** 作系统:WinXPSP3,带有SP1的Microsoft Visual C#2008 Express Edition,.NET 3.5 SP1

知道什么是错的吗?谢谢.

编辑23:40:

我找到了这个BUG.它是在函数的名称 – 添加和添加太相同.当你改变其中一个,它的工作原理.

@H_419_22@解决方法 顺便说一下,我刚刚更新了档案.
当你拿走 this时,你甚至可以为你准备好这一切.

这是一个项目模板,可以设置一切,应该可以正常工作.

我确实在之前的版本中找到了一些要点,我做了一些并非总是如此的假设.我之前实现的一个潜在问题是/ optimize开关,它用于发布配置.在这种情况下,有时ILAsm会扼杀IL,我没有看到新版本.

@H_419_22@ @H_419_22@ 总结

以上是内存溢出为你收集整理的.net – 非托管导出:无法编译程序集全部内容,希望文章能够帮你解决.net – 非托管导出:无法编译程序集所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/1277810.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存