A way to load `FormatData` without writing to a file first · Issue #27628 · PowerShell/PowerShell · GitHub
Skip to content

A way to load FormatData without writing to a file first #27628

Description

@iRon7

Summary of the new feature / enhancement

See: #7845

microsoft-github-policy-service bot

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of
PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Putting words into action:

This is still an issue for us for two reasons:

  • We use a ModuleBuilder to create a single .psm1 file to get the best performance
    • Therefore it would be nice to also be able to embed FormatData (ps1xml file contents) directly in the module
  • Besides, we want sign our modules (.psm1 files)
    • In which case it shouldn't be necessarily to sign these ps1xml files separately (or first export the xml and than re-import it🙄)

Proposed technical implementation details (optional)

In other words, I would like to be able to prepend the actual XML content (from an embedded in-memory ps1xml string):
Wishful thinking:

$Xml = [Xml]'
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <ViewDefinitions>
        <View>
            <Name>XdnName</Name>
            <OutOfBand />
            <ViewSelectedBy>
                <TypeName>XdnName</TypeName>
            </ViewSelectedBy>
            <CustomControl>
                <CustomEntries>
                    <CustomEntry>
                        <CustomItem>
                            <ExpressionBinding>
                                <ScriptBlock>
                                    $_.ToColoredString()
                                </ScriptBlock>
                            </ExpressionBinding>
                        </CustomItem>
                    </CustomEntry>
                </CustomEntries>
            </CustomControl>
        </View>
    </ViewDefinitions>
</Configuration>
'
Update-FormatData -PrependXml $Xml

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions