문제

PowerShell 스크립트가 내 솔루션을 업데이트합니다.

Add-PSSnapin Microsoft.SharePoint.PowerShell
write-host $args[0]
Update-SPSolution -Identity PkbInfo.SP.wsp -literalpath $args[0] -GACDeployment 
.

SP 2010 관리 셸 (물론 ADD-PSSNAPIN 없음)으로 실행하면 OK가 실행되지만 NANT 명령으로 실행하려고 시도 할 때 :

  <target name="sp.update">
    <exec failonerror="true" program="${powershell.exe}">   
    <arg value="-noprofile" />
    <arg value="-nologo" />
    <arg value="-noninteractive" />
    <arg value="-command" />
    <arg value="${ps.script.name} ${ps.copyto.folder}" />
    </exec>
  </target>
.

i 오류가 발생했습니다 :

     [exec] Update-SPSolution : c:\shared\PkbInfo.wsp: The specified file was no
t found.
     [exec] At C:\Users\me\Documents\production\sharepoint\nant_powershell
.ps1:5 char
     [exec] :18
     [exec] + Update-SPSolution <<<<  -Identity PkbInfo.SP.wsp -literalpath $arg
s[0] -GACDe
     [exec] ployment
     [exec]     + CategoryInfo          : ReadError: (:) [Update-SPSolution], Fi
leNotFound
     [exec]    Exception
     [exec]     + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdl
etUpdateSo
     [exec]    lution
     [exec]
     [exec] Update-SPSolution : Zgłoszono wyjątek typu 'Microsoft.SharePoint.Pow
erShell.SPC
     [exec] mdlet+SkipCurrentRecordException'.
.

두 경우 모두 (관리 쉘 및 nant)의 쓰기 호스트가 올바른 경로를 표시하기 때문에 전달하는 인수가 구문 분석되지 않습니다. UPDATE-SPSolation에서 $ args [0]이 NANT로 실행될 때 실제 인수로 변환되지 않는 이유는 무엇입니까?

도움이 되었습니까?

해결책

Try and put a $() around your literal path, like so:

Update-SPSolution -Identity PkbInfo.SP.wsp -literalpath $($args[0]) -GACDeployment  

You can also use Resolve-Path if your path is relative

On a side note: remember that Update-SPSolution only works as long as you update existing artefacts (eg. no new or deleted modules/features/rootfiles)

다른 팁

You try to run:

Update-SPSolution -Identity PkbInfo.SP.wsp 

And you get the error:

 [exec] Update-SPSolution : c:\shared\PkbInfo.wsp: The specified file was no  
t found.

Check your filename :)

(I know you can have different identity and filename, but nobody ever changes that, right?)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top