2

I have a Delphi application where I do CLR Hosting to load any .Net dll. The API I use for loading the CLR is CorBindToRuntimeEx.

But with this approach, CLR reads the app.config but it does not perform the supportedruntime check which is normally done with normal .Net apps. ie. in normal .Net exes if I have mentioned .Net version as 4.6 in app.config, and .Net 4.6 is not installed, an error message comes. But in my current approach the error does not come. Can anyone please help me with any way by which I can ensure that when CLR is loaded by Delphi, it will perform this version check from app.config.

I tried using CorBindToCurrentRuntime API which takes app.config as a parameter. But the API call is failing everytime.

From MSDN it looks like, the earlier APIs are deprecated and calling ClrCreateInstance> GetRuntime> SetDefaultStartupFlags might work. But I am not sure how to call these APIs. Can you please help with a code snippet in Delphi on how to call these APIs.

I would really appreciate any help with this even if its using the deprecated APIs.

Arun Satyarth
  • 434
  • 1
  • 4
  • 12
  • I believe getting the ICLRRuntimeHost in .NET 4+ is very similar [to getting an ICorDebug instance](http://stackoverflow.com/a/40909810/274204), only difference is the interface requested in the last step. – Brian Reichle Feb 22 '17 at 21:02

0 Answers0