Skip to content

Commit 7c3f148

Browse files
committed
add debugging
1 parent 68e474d commit 7c3f148

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/code/LocalServerApiCalls.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,37 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
646646
File.Move(destNupkgPath, zipFilePath);
647647

648648
// extract from .zip
649-
_cmdletPassedIn.WriteDebug($"Extracting '{zipFilePath}' to '{tempDiscoveryPath}'");
649+
_cmdletPassedIn.WriteVerbose($"Extracting '{zipFilePath}' to '{tempDiscoveryPath}'");
650650
System.IO.Compression.ZipFile.ExtractToDirectory(zipFilePath, tempDiscoveryPath);
651651

652652
string psd1FilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.psd1");
653653
string ps1FilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.ps1");
654654
string nuspecFilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.nuspec");
655655

656656
List<string> pkgTags = new List<string>();
657+
_cmdletPassedIn.WriteVerbose($"nuspecFilePath: {nuspecFilePath}");
658+
string path = $tempDiscoveryPath;
659+
try {
660+
// Get the files in the directory
661+
string[] files = Directory.GetFiles(path);
662+
// Get the directories in the directory
663+
string[] directories = Directory.GetDirectories(path);
664+
// Output the files
665+
Console.WriteLine("Files:");
666+
foreach (string file in files)
667+
{
668+
Console.WriteLine(file);
669+
}
670+
// Output the directories
671+
Console.WriteLine("\nDirectories:");
672+
foreach (string directory in directories)
673+
{
674+
Console.WriteLine(directory);
675+
}
676+
} catch (Exception e)
677+
{
678+
Console.WriteLine("An error occurred: " + e.Message);
679+
}
657680

658681
if (File.Exists(psd1FilePath))
659682
{

test/InstallPSResourceTests/InstallPSResourceLocal.Tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ Describe 'Test Install-PSResource for local repositories' -tags 'CI' {
289289
It "Install .nupkg that contains directories (specific package throws errors when accessed by ZipFile.OpenRead)" {
290290
$nupkgName = "Microsoft.Web.Webview2"
291291
$nupkgVersion = "1.0.2792.45"
292-
Install-PSResource -Name $nupkgName -Version $nupkgVersion -Repository $localNupkgRepo -TrustRepository
292+
$repoPath = Get-PSResourceRepository $localNupkgRepo
293+
Write-Verbose -Verbose "repoPath $($repoPath.Uri)"
294+
$searchPkg = Find-PSResource -Name $nupkgName -Version $nupkgVersion -Repository $localNupkgRepo
295+
Write-Verbose -Verbose "search name: $($searchPkg.Name)"
296+
Install-PSResource -Name $nupkgName -Version $nupkgVersion -Repository $localNupkgRepo -TrustRepository -Verbose
293297
$pkg = Get-InstalledPSResource $nupkgName
294298
$pkg.Name | Should -Be $nupkgName
295299
$pkg.Version | Should -Be $nupkgVersion

0 commit comments

Comments
 (0)