Package Manager Console does not have access to global variables

The problem

The problem. So you get this message: “The term … is not recognized ...”, from Package Manager Console. Even though that same command works in Powershell.

It gets annoying when, after getting used to Package Manager Console in Visual Studio to quickly install/remove Nuget packages, you realize that it can`t run most of other commands, because it doesnt recognize your system and user Environment Variables.

The solution

Luckily there is way to remedy this situation. Actually, there are 3:

1. Run Visual Studio as Administrator. This one is quick, but I don`t think VS is supposed to run with Admin privileges all the time.

2. Just use the Package Manager Console for packages and have your Powershell opened as separate window. This has 2 drawbacks. You will often have to manually go to solution directory in Powershell to do sth. And you have no way to use keyboard shortcut do quickly jump to Powershell.

3. My favorite. In VS go to:
I. Tools | Extensions | Online | Type this in search bar: Open Command Line
II. Download it
III. Restart VS and wait for installation to finish
IV. (Optional) In VS press Ctrl+q and type ‘keyboard’, go to keyboard settings. Now in text box labeled ‘Show commands containing’ type: ‘powershell’. Click on: ‘DebuggerContextMenus...OpenCommandLine.PowerShell’ and at the bottom assign it a key/key combination you want to use to launch it. It is Shift+Alt+. by default. I prefer Alt+P, you might prefer something else completely.

Now the nice thing is, not only can you open Powershell from VS with your favorite key combination, you have access to those variables as well. And to top it off, notice that the path in Powershell is automatically your solution directory path, which is really nice. Enjoy your coding and stay productive!

05/07/2018