Sunday, March 10, 2013

POS for .NET with .NET 4 applications

Problem:
I have a .NET dll that uses POS for .NET to handle devices. I'm integrating with a program that's running in .NET 4.0. This results in PosExplorer not being able to return from the cstr. In some situations this may be causing execeptions, but in my case it's not reporting any errors at all.

Solution
In the ApplicationName.exe.config for the exe that is running the DLL put in

<configuration>
   <runtime>
      <NetFx40_LegacySecurityPolicy enabled="true"/>
   </runtime>
</configuration>


Note: The configuration section will probably already exist, so just stick the runtime section in there. If the application does not have a .config file, then create one. It needs to be named ApplicationName.exe.config
 
References

Support thread: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/4f205df3-2658-4531-87bd-77bda99d571c

Tool used to debug: http://www.yortsoft.com/Products/PosDotNetPlugNPlayConfigurationUtility.htm

MSDN doc: http://msdn.microsoft.com/en-us/library/dd409253%28v=vs.100%29.aspx

No comments:

Post a Comment

There was an error in this gadget