Strange exception when calling a method


hi,

i'm trying use dotnetzip, i'm getting strange error when use 'save' method. similar error icsharp zip assembly, , error looks powershell-specific, i'm posting here initially.

i perform following steps documented on few different blogs without issues:

[system.reflection.assembly]::loadfrom("$workingdir\lib\dotnetzip\ionic.zip.dll")    $zipfilename = "test.zip"    $zipfile =  new-object ionic.zip.zipfile($zipfilename)    $zipfile.addfile("test.txt")

so far, no issues. everything's fine. when try call 'save' method write zip file disk, following occurs:

ps c:\ziptemp> $zipfile.save()  exception getting "formatvaluelist": "microsoft.powershell.commands.internal.format.freeformatentry.formatvaluelist"      + categoryinfo          : notspecified: (:) [out-lineoutput], getvalueinvocationexception      + fullyqualifiederrorid : catchfrombaseadaptergetvalue,microsoft.powershell.commands.outlineoutputcommand

i can't life of me figure out why happening. i've been searching high , low days on various search engines, , far can tell no-one has ever encountered exception , lived post it. intially encountered error in powershell ise, i've tried in standard powershell shell, both , elevated administrator, same results. specifying filename 'save' method produces same error (although filename established when object created, shouldn't have specify 'save' method anyway).

as noted, happens different .net zip assemblies different authors, leads me think i'm missing simple or powershell being intransigent. the exception looks powershell having fit trying format object display on screen.

i'm using powershell 2.0 on windows 7 rc.

thanks in advance can provide help.

cheers,
aaron

hi,

you need specify full path files.

[system.reflection.assembly]::loadfrom("$workingdir\lib\dotnetzip\ionic.zip.dll")  $zipfilename = "c:\test.zip"  $zipfile =  new-object ionic.zip.zipfile($zipfilename)  $zipfile.addfile("c:\test.txt")  $zipfile.save()  

hope helps.
grégory schiro - powershell & mof


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group