Pergunta

I've gotten the following error when installing windirstat and ilmerge on Chocolatey. I'm suspicious that ampersand behavior changed in PowerShell 3.0.

Running powershell -NoProfile -ExecutionPolicy unrestricted -Command "& import-module -name  'C:\NuGet\chocolateyInstall\helpers\chocolateyInstaller.psm1'; & 'C:\NuGet\lib\ilmerge.2.10.526.4\tools\chocolateyInstall.ps1'". This may take awhile and permissions may need to be elevated, depending on the package.
ilmerge did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] The expression after '&' in a pipeline element produced an invalid object. It must result in a command name, script block or Command
Info object.
-----------------------
Foi útil?

Solução

The problem was not ampersand behavior I had to replace $oc = Get-Command 'Write-Host' | ?{$_.ModuleName -eq 'Microsoft.PowerShell.Utility'} with $oc = Get-Command 'Write-Host' -Module 'Microsoft.PowerShell.Utility' as well as make a similar replacement for a Write-Error wrapper.

Outras dicas

How about starting PowerShell with the -version 1.0 or 2.0 parameter? Then run the above command and see if there is any difference.

At the commandline

PowerShell -version 2.0

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top