ISSUE:
The issue is that PowerShell by default restricts running scripts unless we
change the execution policies.
SOLUTION:
NOTE: Do not forget to restart the visual studio code after
performing the below steps.
For visual studio code settings,
1. Press Ctrl + Shift + P and type: settings.json
2. The dropdown will show three options:
a. Default settings
b. User settings and
c. Workspace settings:
d.
Default Settings are for our view only purpose to see what all settings are
currently being applied to our currently opened VS Code. It’s non-modifiable.
Currently, VScode only offers 2 editable settings:
VS Code provides two different scopes for settings:
User Settings - Settings that apply globally to any instance of
VS Code you open.
Workspace Settings - Settings stored inside your workspace
and only apply when the workspace is opened.
Workspace settings override user settings. Workspace settings are specific to
a project and can be shared across developers on a project.
Note: A VS Code "workspace" is usually just your project root folder.
Workspace settings as well as debugging and task configurations are stored
at the root in a .vscode folder. You can also have more than one root folder in
a VS Code workspace through a feature called Multi-root workspaces.
For workspace settings JSON, the JSON file is located in a folder of the root
directory called .vscode, you can create it yourself if it is not there.
3. Select Open User Settings (JSON) if we want to fix this issue for
every VS Code launch and to fix it for current project, select Open
Workspace Settings (JSON) and in the opened file (I chose Open
User Settings (JSON)) find the key (if present):
”terminal.integrated.profiles.windows"
4. If not present, add the following JSON setting to it & save the file:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"args": ["-ExecutionPolicy", "Bypass"]
}
}
SNAPSHOT:
5. Need to restart VS Code and the Terminal.
6. DONE.