Dear Friends,
I am developing a .NET/C# 2.0 application which uses the PowerShell SDK for script execution. I am not using SnapIns. I am setting everything directly through PS's RunspaceConfiguration.
So my problem is that I cannot add a custom format for my type Plux.ExtensionTypeInfo implemented in the application.
( Plux.ExtensionTypeInfo has a property called Name )
That is what I try:
...
RunspaceConfiguration config = RunspaceConfiguration.Create();
config.Formats.Prepend(
new FormatConfigurationEntry("plux.format.ps1xml")
);
config.Formats.Update();
...
plux.format.ps1xml:
<Configuration>
<ViewDefinitions>
<View>
<Name>Plux.ExtensionTypeInfo</Name>
<ViewSelectedBy>
<TypeName>Plux.ExtensionTypeInfo</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Width>30</Width>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Name</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
After executing a Cmdlet, which returns a few ExtensionTypeInfo objects, the output will never be formatted.
With the built in Cmdlets and Types, the formatting works perfectly in my PS Host application. The Cmdlet registration works also fine through the config object. When launching update-formatdata on plux.format.ps1xml, with powershell.exe or my hosting application, no errors are thrown.
Still, the code above has no effect on formatting.