diff --git a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs index 566262e3db..650588c32e 100644 --- a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs @@ -374,7 +374,9 @@ namespace Microsoft.PowerShell.Commands ThrowTerminatingError(er); } - path = pathInfos[0].Path; + // `Path` returns the PSProviderPath which is fully qualified to the provider and the filesystem APIs + // don't understand this. Instead `ProviderPath` returns the path that the FileSystemProvider understands. + path = pathInfos[0].ProviderPath; // First, we validate if the path does exist. if (!File.Exists(path) && !Directory.Exists(path)) diff --git a/test/powershell/engine/Module/TestModuleManifest.Tests.ps1 b/test/powershell/engine/Module/TestModuleManifest.Tests.ps1 index 091b968c27..ddb6ca5d52 100644 --- a/test/powershell/engine/Module/TestModuleManifest.Tests.ps1 +++ b/test/powershell/engine/Module/TestModuleManifest.Tests.ps1 @@ -151,6 +151,16 @@ Describe "Test-ModuleManifest tests" -tags "CI" { $module.NestedModules | Should -HaveCount 1 $module.NestedModules.Name | Should -BeExactly "Foo" } + + It 'Works for manifest specified as UNC path' -Skip:(!$IsWindows) { + # chance the testdrive path to a UNC path + + $testModulePath = '\\localhost\' + "$testDrive\test.psd1".Replace(':', '$') + New-Item -ItemType File -Path testdrive:/foo.psm1 > $null + New-ModuleManifest -Path $testModulePath -RootModule "foo.psm1" + $module = Test-ModuleManifest -Path $testModulePath + $module.RootModule | Should -Be "foo.psm1" + } } Describe "Tests for circular references in required modules" -tags "CI" {