[IronPython] Newbie Questions

Dino Viehland dinov at microsoft.com
Thu Dec 11 09:57:27 CET 2008


.NET config doesn't really have any concept of configuration for an individual DLL.  Instead it only has a config for the exe which kicked things off (or actually for the current app domain).  So the concept of a "MyLibrary.dll.config" file doesn't really exist AFAIK.

So that basically leaves you with a few options.  You could add your configuration to an ipy.exe.config file.  Or you could try and force the .NET config APIs to explicitly load a config file (which is what I thought the blog post I linked to showed via ExeConfigurationFileMap/OpenMappedExeConfiguration).  Or your DLL could provide its own configuration mechanism if you really feel like its settings should be independent from the app using it.

But ultimately I think these are all the same problems you'll encounter when using your DLL from any other EXE.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Giulio Petrucci
> Sent: Thursday, December 11, 2008 12:42 AM
> To: IronPython mailing list
> Subject: Re: [IronPython] Newbie Questions
>
> Hi Dino,
>
> first of all, thanks for your reply
>
> 2008/12/5 Dino Viehland <dinov at microsoft.com>:
> > You can add a reference to the assembly and then import both the
> class and the enum.  For example:
> >
> > import clr
> > clr.AddReference('MyLibrary')
> > from MyLibrary import MyClass, MyEnum
> > MyClass().SomeMethod(MyEnum.SomeValue)
>
> Ok, I've just tested it and everything seems to work fine.
>
> > The 2nd question... is this an app.exe.config file that you're
> reading?  If so this might be helpful:
> >
> http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.wi
> ndowsforms/topic64732.aspx
>
> I couldn't realize actually the utility of the article. I'll try to
> explain my problem wit a litlle bit more of words. I've created a .NET
> library which reads some settings in the application configuration
> file. The library isn't actually used by any Console/WinForm/whatever
> application, but I just want to test it using the IronPython
> interactive console. So I created a MyLibrary.dll.config file, I run
> the IronPython console and I add the reference to my library. How can
> I "force" my library to read the proper .config file? Can I explicitly
> load a .config file?
>
> Thanks in advance,
> Giulio
> --
> OnAir:
> http://www.giuliopetrucci.it
> http://www.fujikomonamour.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list