![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | can my cmdlet/snapin have a config file? I just built a cmdlet/snapin for Powershell. it has a myCmdlet.dll.config where it's installed. However, i'm not getting anything inside the cmdlet when i do a: COnfigurationManager.AppSettings["foobar"] How do cmdlet configuration files work? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: can my cmdlet/snapin have a config file? "Steve" <Steve@discussions.microsoft.com> wrote in message news:97A43B65-7172-46CA-8A15-BBD83F68CC7A@microsoft.com... >I just built a cmdlet/snapin for Powershell. it has a myCmdlet.dll.config > where it's installed. However, i'm not getting anything inside the > cmdlet > when i do a: > > COnfigurationManager.AppSettings["foobar"] > > How do cmdlet configuration files work? IIRC the ConfigurationManager.AppSetttings class works off an application level config file. This is a common problem in .NET. There isn't a framework supported config file for DLLs. BTW I would *not* recommend dumping stuff into a PowerShell.exe.config file. -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: can my cmdlet/snapin have a config file? Blog: http://whizzrd.spaces.live.com "Steve" <Steve@discussions.microsoft.com> wrote in message news:97A43B65-7172-46CA-8A15-BBD83F68CC7A@microsoft.com... >I just built a cmdlet/snapin for Powershell. it has a myCmdlet.dll.config > where it's installed. However, i'm not getting anything inside the cmdlet > when i do a: > > COnfigurationManager.AppSettings["foobar"] > > How do cmdlet configuration files work? I did something similar in a web app, Manually loading a config file from Assembly Path, that didn't work with GACed assemblies, I believe assembly redirection policy configuration files are published in GAC by compiling them into an assembly as a resource, pretty useless for configuration as it's just as easy to change the code, recompile and re-publish as doing the same with a configuration file. I know PSCX contain a method for associating cmdlet parameter default values to variables in the powershell environment, but haven't tried it yet. Perhaps you can put the configuration into registry by attaching an eventhandler to the AfterInstall event your SnapIn inherits from Installer. -- Joris van Lier Please note that all scripts and opinions are supplied "as is" and with no warranty |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Powershell and cmdlet config files | Steve | PowerShell | 3 | 05-14-2007 09:23 AM |
| How to set alias for my cmdlet when my snapin is registered | Rostislav.Pridatko@quest.com | PowerShell | 1 | 03-16-2007 10:24 AM |
| what is the web.config file? | geotso | Vista General | 6 | 11-04-2006 04:42 AM |
| adding a cmdlet without using a snapin | klumsy@xtra.co.nz | PowerShell | 0 | 10-22-2006 03:52 PM |