[Python.NET] C# components for script

Tribble, Brett btribble at ea.com
Tue Nov 11 20:40:18 CET 2008


Yes, they can be anywhere, you just need to write some code to add them to the SYSTEM path for the current running code. Optionally, you can also tell .NET where to look for the assembly's config file.

import sys
import clr
import System

loadDir = 'C:/myAssemblyPath/'
assemblyName = 'myDLL.dll'
configfileName = 'myDLL.ini'

# add to system path
if not loadDir in sys.path:
    sys.path.insert(0, loadDir)

# tell .NET where to look for the applications config file
System.AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", (loadDir + configfileName))

# load it up
clr.AddReference(assemblyName)


Cheers,

Brett


From: pythondotnet-bounces+btribble=maxis.com at python.org [mailto:pythondotnet-bounces+btribble=maxis.com at python.org] On Behalf Of Singh, Mandeep
Sent: Monday, November 10, 2008 7:56 PM
To: pythondotnet at python.org
Subject: [Python.NET] C# components for script


Hi,
        I have written c# components to be used by Python. I note that those components need to be placed in the Pythonnet installation directory because its like private assemblies being loaded. Is there a way I can place them in separate location?

Thanks & regards,
Mandeep Singh
Equity IT
Credit Suisse
Tel: (+65) 6212 8755


==============================================================================

Please access the attached hyperlink for an important electronic communications disclaimer:



http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html

==============================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20081111/b3fc1f87/attachment.htm>


More information about the PythonDotNet mailing list