Powershell-Bereitstellung mit Nant - Problem mit Skriptargumenten
-
09-12-2019 - |
Frage
Ich habe ein PowerShell-Skript, das meine Lösung aktualisiert: generasacodicetagpre.
Wenn ich es mit SP 2010-Management-Shell (ohne Add-Psnapin natürlich) ausführen, läuft es OK, aber wenn ich versuche, es mit NANT-Befehl auszuführen: generasacodicetagpre.
Ich erhalte einen Fehler: generasacodicetagpre.
So sieht es aus, als ob das Argument, das ich passiere, nicht analysiert wird, was seltsam ist, da der Schreibhost in beiden Fällen (mit Managementschale und NANT) den richtigen Pfad anzeigt. Alle Ideen, warum die $ Args [0] in der Update-SPSolution beim Laufen mit NANT mit NANT nicht in echtes Argument konvertiert wird?
Lösung
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)
Andere Tipps
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?)