0

Relating to Visual studio community 2015, Package Manager Console Host Version 3.4.4.1321

When i open project X in my private computer, it works just fine. But loading it into the company laptop, this gets printed out in the package manager console:

...The Term "C:\\...\init.ps1" is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the 
name, or if a path was included.....
At line:1 char:1 
Category info: ObjectNotFound: (C:\\...\init.ps1:String) [],CommandNotFoundException.

I have tried to reinstall nuget package manager onto visual studio but to no avail. My execution policy has been set to unrestricted.

Also I tried to manually type out that same path into package manager console and the same error occurred.

BUT when i launch cmd and run powershell from it and execute the same init.ps1 there, the script runs just fine as it gave me a different error(path not found and pointed me to somewhere inside the script) which is it's expected behaviour.

Any ideas on how to solve this issue? Reinstalling Nuget extension on Visual Studio does not work.

2
  • Are there any spaces in the path of the init.ps1? If yes, please try to move the .ps1 file to root directory, check if it work fine? Commented May 25, 2017 at 10:54
  • Nope did that...The issue that i am able to run scripts in powershell via cmd, but when i open powershell ise or when using the package manager console to execute the script it mentions that it cant read the path as a valid script file Commented May 26, 2017 at 1:23

1 Answer 1

1

Please check the following:

  1. If you type out the correct path, from the error I can see that there is"C:\...\init.ps1" which can cause that Powershell to do that because the path is invalid. Please check the path to your script you are calling.

  2. The path is viewed as a string. This causes the Cmdlet to parse that as a string rather as a valid path.

Short examples of your script will be useful in debugging this error. If you don't mind please include that.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually the C:\...\init.ps1 is just an example, its just to simplify the filepath definitely the real thing is longer. Also the script is from the nuget package EntityFramework under the tools folder of that nuget package. Init.ps1 is run when the project first loads. As mentioned before my personal computers vs2015 works just fine. But in the company laptop its not working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.