microcafe icon indicating copy to clipboard operation
microcafe copied to clipboard

Problem running powershell scripts, such as

Open alturium opened this issue 7 years ago • 1 comments

Hi,

Thanks ahead of time for any help. This is not a microcafe issue per se, but I'm new to powershell and receive the errors below when invoking the .ps1 scripts from a PS cmd line.

When running the Build-Microservices.ps1 (after invoking powershell via command line), received the following error message (which is probably due to the powershell setup on my machine):

`Import-Module : The specified module '\Invoke-MsBuild.psm1' was not loaded because no valid module file was found in any module directory. At D:\dev\projects\aspnet_core_akka_net\microcafe\Build-MicroServices.ps1:4 char:14

  • Import-Module <<<< -Name "$PSScriptRoot\Invoke-MsBuild.psm1"
    • CategoryInfo : ResourceUnavailable: (\Invoke-MsBuild.psm1:String) [Import-Module],
      FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCom mand

Import-Module : The specified module '\Invoke-NuGetPackageRestore.psm1' was not loaded because no valid module file was found in any module directory. At D:\dev\projects\aspnet_core_akka_net\microcafe\Build-MicroServices.ps1:5 char:14

  • Import-Module <<<< -Name "$PSScriptRoot\Invoke-NuGetPackageRestore.psm1"
    • CategoryInfo : ResourceUnavailable: (\Invoke-NuGetPackageRestore.psm1:String) [Impo rt-Module], FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCom mand

Method invocation failed because [System.Object[]] doesn't contain a method named 'IndexOf'. At D:\dev\projects\aspnet_core_akka_net\microcafe\Build-MicroServices.ps1:54 char:82

  • $success = BuildSolution $solution.Path $solution.Solution $solutions.IndexOf <<<< ($solution
    

) $solutions.Length + CategoryInfo : InvalidOperation: (IndexOf:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound `

alturium avatar Jun 05 '17 05:06 alturium

For whatever reason it looks like the Invoke-MsBuild and Invoke-NuGetPackageRestore powershell files aren't in the same folder as the Build-Microservices script.

Or, it could be that you're using an old version of Powershell that doesn't support the $PSScriptRoot variable. You need to be using PowerShell v3 or higher.

rbanks54 avatar Sep 08 '17 03:09 rbanks54