PSDocs icon indicating copy to clipboard operation
PSDocs copied to clipboard

Failed to import format data file

Open BernieWhite opened this issue 3 years ago • 0 comments

When importing PSDocs module, importing PSDocs.Format.ps1xml may fail if PSDocs.dll is blocked by Windows because it was downloaded from the PowerShell Gallery.

Import-Module : Errors occurred while loading the format data file:
C:\Program Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml, Error at XPath
/Configuration/ViewDefinitions/View[1] in file C:\Program
Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml: A node is missing from TableControl, ListControl,
WideControl, CustomControl.
C:\Program Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml, Error at XPath
/Configuration/ViewDefinitions/View[1]/TableControl/TableHeaders in file C:\Program
Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml: The column header definition is not valid; all
headers are discarded.

C:\Program Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml, Error at XPath
/Configuration/ViewDefinitions/View[1]/TableControl/TableHeaders/TableColumnHeader[1]/Label in file C:\Program
Files\WindowsPowerShell\Modules\PSDocs\0.7.0\PSDocs.Format.ps1xml: The resource PSDocs.Resources.ViewStrings in
assembly C:\PSDocs is not found.
At line:1 char:1
+ Import-Module PSDocs.Azure
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

We should add a note for troubleshooting this issue.

It can be fixed by using Unblock-File.

For example:

Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules\PSDocs\' | Unblock-File;

See issue Azure/PSDocs.Azure#25.

BernieWhite avatar Jan 13 '21 05:01 BernieWhite