简体   繁体   English

Nuget Package Manager控制台无法执行EntityFramework PowerShell脚本

[英]Nuget Package Manager console unable to execute entityFramework powershell scripts

Relating to Visual studio community 2015, Package Manager Console Host Version 3.4.4.1321 关于Visual Studio社区2015,程序包管理器控制台主机版本3.4.4.1321

When i open project X in my private computer, it works just fine. 当我在私人计算机中打开项目X时,它工作正常。 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. 我试图将nuget软件包管理器重新安装到Visual Studio上,但无济于事。 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. 但是,当我启动cmd并从中运行powershell并在其中执行相同的init.ps1时,脚本运行得很好,因为它给了我一个不同的错误(找不到路径并将我指向脚本中的某个地方),这是预期的行为。

Any ideas on how to solve this issue? 关于如何解决此问题的任何想法? Reinstalling Nuget extension on Visual Studio does not work. 在Visual Studio上重新安装Nuget扩展不起作用。

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. 如果键入正确的路径,从错误中我可以看到存在“ C:\\ ... \\ init.ps1”,这可能导致Powershell这样做,因为路径无效。 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. 这将导致Cmdlet将其解析为字符串而不是有效路径。

Short examples of your script will be useful in debugging this error. 脚本的简短示例将有助于调试此错误。 If you don't mind please include that. 如果您不介意,请附上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM