Setting up Visual Studio Code for PowerShell Development

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 76

  • @tompaget83
    @tompaget83 2 года назад

    Trevor, you're AWESOME! This video is so very useful!

  • @seangraylin
    @seangraylin 3 года назад +1

    okay so this settings.json file does not show up for me at all and I do not know why. I keep getting this error message "PowerShell does not support debugging this file type: '/Users/sean/Desktop/Test.psd1'."

    • @seangraylin
      @seangraylin 3 года назад

      ​@@TrevorSullivan I am not sure how else you would run the code other than pressing F5 or the run arrow. When I press F1 a search dialogue box appears and not really sure what you mean by command pallete.
      I seem to be getting different results for instance when you created the folder you get a settings windows with settings.json which is not something I am seeing at all.
      sorry if this is stupid I am not a coder but an administrator and I am just looking for a better way to look at and manage PS scripts without opening up a VM with windows to run PS ISE.

  • @kimfucku8074
    @kimfucku8074 5 лет назад +1

    VS Code is a dream! Cranked out a lot of PS code in the last year which I couldn't have done it with all the support VS Code provides!

  • @AndyHelsby
    @AndyHelsby 7 лет назад +2

    Great tutorial - Completely new to vscode here so these tweaks are very handy. The format brace on new line doesn't seem to work for me though - the formatting is working as it automatically puts the space between the ) and { in the code but doesn't drop the { to the new line.
    Small detail and the rest of the tips will come in handy so thanks.

  • @shaundbritto3471
    @shaundbritto3471 Год назад +1

    i dont know if you still upload videos, i just have one request, whenever i am working on a react project and the terminal is listening to a port, the terminal works for 3 to 4 minutes and terminates with exit code 2, how to resolve, no solution found on google

    • @TrevorSullivan
      @TrevorSullivan  Год назад

      Hey there, have you tried replicating this behavior on another system? Have you filed a bug report with the appropriate GitHub repository?

    • @shaundbritto3471
      @shaundbritto3471 Год назад

      @@TrevorSullivan everytime time i run js file on a port, the terminal works for 2 minutes and then The terminal process "C:\Program Files\PowerShell\7\pwsh.exe" terminated with exit code: 2148734499.
      This error appears, i have tried on cmd prompt, powershell all the terminals abruptly shut

  • @daviesmotivation8864
    @daviesmotivation8864 4 года назад

    sorry for late asking. i'm new here. i wanna ask why if i download something in vcs, don't have reload button.
    please help me.

  • @ItzV85100
    @ItzV85100 5 лет назад +3

    Nice, clear and well explained. very useful. thanks a lot
    (y) :)

  • @elitehaxxor8025
    @elitehaxxor8025 Год назад +1

    Thank you for the amazing video. I've always used PowerShell Studio and wanted to make a change and you made that extremely easy. I also love the inclusion of the script analyser because, not sure if it's just me, but I absolutely hate coming across shared code that has aliases or shortended names for parameters.

  • @fredflintstone505
    @fredflintstone505 Год назад

    Your instructions for setting up an older version of PowerShell (5.1) with the latest VSCode (1.76.2) does not work. Any change on updated instructions?

  • @martinwhite7340
    @martinwhite7340 6 лет назад +2

    Might help others having trouble getting the integrated terminal to work in OSX:
    "terminal.integrated.shell.osx": "/usr/local/bin/pwsh",
    "terminal.integrated.shellArgs.osx": []

    • @olpner
      @olpner 5 лет назад

      Martin white solved my problems. Cheers mate!

    • @jamescontreras6323
      @jamescontreras6323 5 лет назад

      THANK you, should have read all of these comments for this :O

  • @dsfarag
    @dsfarag 6 лет назад

    Great video, very well laid out and explained.

  • @boolgeriyi1286
    @boolgeriyi1286 4 года назад

    Where the FUCK is the PowerShell extension located on Windows?? If you say this is a guide for both Windows and MacOS then tell us what to do too!

  • @snap-off5383
    @snap-off5383 3 года назад

    I don't get why powershell isn't natively supported in Visual Studio Community.

  • @TH4445
    @TH4445 5 лет назад +1

    Thanks for the video but... the current version of VScode editor is 1.32.3 There have been changes. Also I,m not sure about the extensions . I say this because of experience. Trevor could you please make a video on setting up VSC on windows for Html and CSS with the current version. Thanks.

  • @elmuziko
    @elmuziko 6 лет назад +1

    I myself am an ISE veteran, only given the size of the scripts I've wrote and the small changes I keep making I'm wanting to move to something that tracks changes. I've read a lot of docs and this is coming up trumps every time.
    Whilst it looks good, and I immediately feel at ease writing code - I can't for the life of me figure out how to run it? You know like in ISE you just hit the green run button?
    If I highlight everything and press F8 I get : Executable script code found in signature block., and the internet is being less than helpful in solving.
    Am I being a total jackass or is it meant to be this difficult?

    • @elmuziko
      @elmuziko 6 лет назад

      Thanks for the swift response Trevor. My execution policy is unrestricted.
      If I hit F8 on, say,
      New-Item c:\test.txt -itemtype file
      It works fine.
      If I do:
      Test-Path C:\test.txt
      It works fine.
      If I do:
      IF ( ( Test-Path C:\test.txt ) -eq $FALSE ) { "No file" }
      Then this is when I get the error: Executable script code found in signature block
      I won't cry if I can't get it to work, it's just a shame because the idea of version control on my scripts would be heavenly. Quite frankly I'm surprised half of them still work given the sheer size and rubbish coding of them all!!!

    • @RandomTorok
      @RandomTorok 5 лет назад

      I'm with you Graham, F8 will run a selection but I want to run an entire script. I've got a script that works fine from the ISE but when I load it into VS Code I can't figure out how to run the entire script. Can someone please explain how to do a simple thing like run a script.

  • @NirHason
    @NirHason 7 лет назад

    Thank you for the video! really informative.
    When I mouse right-click on the script document I have the open of "Run code" (can be done also by clicking on the play button on the top right corner) it's just running the script to the 'output' window and it shows "[Running] powershell -ExecutionPolicy ByPass . . . " But it's just stays like that forever. my code includes some 'Read-Host' cmdlet so it won't ask for any input or anything.
    Why is that? we can't use the 'run code' option for Powershell?

    • @NirHason
      @NirHason 7 лет назад

      tnx for the answer :)

  • @simonberg5694
    @simonberg5694 4 года назад

    Hi Trevor
    Great video! I used this video as reference for my first try out of VS Code for Powershell.
    But in time the VSCode settings has changed, and i found that the AutoIndent settings has changed and is reliable of an formatter, with containing rules for AutoIndent regarding Powershell formatting guidelines.
    Have you stumpled on the same issue and might have an solution?
    Best Regards
    Simon Berg

    • @simonberg5694
      @simonberg5694 4 года назад

      Hey Trevor
      After starting using the VS code i found this setting
      "editor.autoIndent": "True"
      And it worked like a charm and the FormatOnSave or FormatOnTrue triggered, the formatting and the AutoIndent kicked in, when i was writing my powershell documents. So my indentation was working like a charm whenever i startet writing som code wrapped with brackets.
      But many updates for VS Code has arrived since, and suddenly it stopped working and now i have to set "editor.autoIndent": to one of these "Advanced, Brackets, Full, Keep or None" but neither works.
      Then i googled and some bloggers mentions the AutoIndent formatting rules is now dependent og the specific formatter. VS Code expects the formatter is known about the specific document code language AutoIndent rules.
      But i dont think Microsoft included these rules in ex. the "ms-vscode.powershell" formatter.
      Maybe you have seen this problem before?
      [settings.json]
      "workbench.colorTheme": "Default Dark+",
      "powershell.integratedConsole.focusConsoleOnExecute": false,
      "powershell.integratedConsole.showOnStartup": false,
      "powershell.enableProfileLoading": false,
      "powershell.codeFormatting.newLineAfterCloseBrace": true,
      "powershell.codeFormatting.openBraceOnSameLine": false,
      "powershell.codeFormatting.whitespaceAroundOperator": true,
      "editor.defaultFormatter": "ms-vscode.powershell",
      "editor.tabCompletion": "on",
      "editor.autoIndent": "full",
      "editor.formatOnSave": true,
      "editor.formatOnType": true,
      "git.enableSmartCommit": true,
      "git.confirmSync": false,
      "git.autofetch": true,
      "powershell.scriptAnalysis.enable": true

  • @utilars
    @utilars Месяц назад

    How do we setup PowerShell Extension for VSCode to use the Powershell version that comes preinstalled in MS Windows?

    • @TrevorSullivan
      @TrevorSullivan  Месяц назад

      @@utilars check out the VScode settings for the extension. There's a property you can set that specifies paths to different PowerShell executables on your system

  • @bsbs1841
    @bsbs1841 6 лет назад

    Awesome. Thanks for the vid!!!

  • @MSMgamer190
    @MSMgamer190 6 лет назад +3

    Thanks Trevor you've helped increase my productivity. very helpful tutorial!!

    • @pranjalpagaria322
      @pranjalpagaria322 4 года назад

      can you help me with this problem ruclips.net/video/GtNmcjx8j2o/видео.html in visual studio not getting sollution

  • @oliawak
    @oliawak 4 года назад

    Hello Trevor, can you do a tutorial on how to connect to office 365 services? I’m getting a WSMan error in vscode on macOS. Thank you!

  • @daviwil
    @daviwil 7 лет назад +1

    Slight correction on "powerShell.startAutomatically": that setting is used to disable automatic startup of PowerShell Editor Services when a PowerShell file is opened. Some users requested this to shorten startup time when browsing PowerShell files in short-lived VS Code windows.
    Great video, thanks Trevor!

    • @daviwil
      @daviwil 7 лет назад

      No problem! The setting's name is a little confusing, so I blame it on myself :)

  • @nickryansanjuan4727
    @nickryansanjuan4727 2 года назад +1

    noice o.o

  • @mikekim6966
    @mikekim6966 5 лет назад

    Hi Trevor, this is really helpful. Just like invoking PS command from editor by F8 and stay focus on the editor, is there a similar way to do it in git bash shell terminal. I have a file containing a list of shell command and would like to execute one command at a time and see the execution in the bash terminal. How do I do that?
    Basically, i would like to run current line in the active terminal(bash). Thanks.
    Solved: There is a command that I created a shortcut : terminal run the selected text in active terminal..

  • @chamaco7500
    @chamaco7500 6 лет назад

    When attempting to start the integrated Terminal in OSX I get an err: terminal process terminated with exit code: 64
    I tried to use the directory of: "/usr/local/bin/powershell" but there's no powershell "executable" in this directory.
    I ran powershell from my MAC and found that it loads from : "/usr/local/microsoft/powershell/6.0.1/pwsh " but when I use this path I get the error

    • @cyborgdc5017
      @cyborgdc5017 6 лет назад

      I get the same error. Have you found a solution to this problem?

  • @thomasmartin9232
    @thomasmartin9232 4 года назад

    How do I pass in command line parameters in Visual Code to debug a PowerShell application?

  • @jasonthurston799
    @jasonthurston799 6 лет назад

    VS Code lacks some nice features of ISE.
    1. In the terminal I'd like to be able to start typing parameters and have it show me a menu of available parameters.
    2. I'd like to have something like the two green arrow buttons in ISE for running all code in the buffer or just select code. F8 is hard to reach accurately in the dark .
    3. Not and ISE feature but since VSCode has tasks, I don't seem to be able to get a task to run against my active terminal so the task can prepare/affect my environment.

  • @karlstenator
    @karlstenator 2 года назад

    Great video, thanks for sharing. I can now use Powershell via VS Code. 🏆

  • @MarkFugel
    @MarkFugel 5 лет назад +1

    Yet another great video that is packed with some nice Visual Code goodies...especially for powershell. Quick question...i am trying to run AWS commands and so am running core...i think. My settings point to C:\\Program Files\\PowerShell\\6\\pwsh.exe but when i try to run Get-AWSPowerShellLambdaTemplate i get an error that i am running 5.1 and i need 6.0 powrshell

  • @AyanMullick
    @AyanMullick 5 лет назад

    Thanks for the video

  • @diogosilva9492
    @diogosilva9492 Год назад

    slayermusiq1? is that you?

  • @issiewizzie
    @issiewizzie 7 лет назад

    whats the diff between visual studio code for mac and visual studio for mac

  • @baref0ot455
    @baref0ot455 5 лет назад

    Is Visual Studio Code different from Visual Studio?
    I use VS 2019. Thanks guys

    • @baref0ot455
      @baref0ot455 5 лет назад

      Trevor Sullivan Already ahead of you I downloaded and right out the box (since I already had Node JS installed) it works great. Been at for about 4 hours lol

  • @Whitecat2304
    @Whitecat2304 4 года назад

    You look like David Warner

  • @outworkthework
    @outworkthework 5 лет назад

    Good solid video with useful tips. So my next question is there a way to insert all of your suggestions into a script or update a ini file so we can repackage the msi with them already incorporated for less experienced developers?

  • @GosuHub
    @GosuHub 4 года назад

    6:27 how do i know the path to powershell ?
    please answer

  • @yilgullive
    @yilgullive 5 лет назад

    Cant realy focus on the content with u swinging that claw

  • @marcelo1302
    @marcelo1302 5 лет назад

    Cool video, bro!

  • @RedHairGildarts
    @RedHairGildarts 2 года назад

    in kitchen?

  • @Macadoof
    @Macadoof 7 лет назад

    Absolutely fantastic video, great presentation. Thank you. Subbed!

  • @delphi88
    @delphi88 7 лет назад

    Thx a lot. Also thx for good voice quality.

  • @dastushar8539
    @dastushar8539 6 лет назад

    how to run powershelgl as an adminstrator

  • @will0282
    @will0282 4 года назад

    Awesome vid. Keep up the good work.

  • @Vern.Anderson
    @Vern.Anderson 7 лет назад

    Thank you! I'm glad some one finally made a tutorial for this. Any way to make VS code make good use of multiple monitors like ISE can? For example the console would take up one monitor and the editor the other.

    • @daviwil
      @daviwil 7 лет назад

      At the moment there's no way to split panes from VS Code out of the single window. In the future you may see horizontal layout of the window so that the console can be on the right side rather than the bottom, but I doubt it will ever be detachable. However, we might be able to launch an external console using the PowerShell extension.

    • @Vern.Anderson
      @Vern.Anderson 7 лет назад

      David, thank you. Yea detachable is not necessary for me personally, I just meant the capability to SPAN multiple monitors. In my case just 2 monitors. Thanks for taking time out to reply.

    • @wolfrackham
      @wolfrackham 7 лет назад

      Spanning monitors would be a most welcome feature. I use my monitors in portrait mode so having the terminal being able to support this would be great.

  • @anycaroliny9209
    @anycaroliny9209 4 года назад

    Very useful, thank u!

  • @akshay2012rdts
    @akshay2012rdts 3 года назад

    Good Video. Thanks man

  • @oliawak
    @oliawak 4 года назад

    Very useful thanks!

  • @systemm1157
    @systemm1157 5 лет назад

    hi guys....

  • @AdrianMoseley
    @AdrianMoseley 6 лет назад

    Very useful. Thanks for this.

  • @gangu749
    @gangu749 6 лет назад

    Thanks A Lot

  • @howardwalowitz3600
    @howardwalowitz3600 7 лет назад

    very helpful! thank you!

  • @mtbcyclist
    @mtbcyclist 7 лет назад

    Great video! Thanks!

  • @HappyYankeeFan
    @HappyYankeeFan 7 лет назад

    Great job as always, Trevor!

    • @pranjalpagaria322
      @pranjalpagaria322 4 года назад

      can you help me with this problem ruclips.net/video/GtNmcjx8j2o/видео.html in visual studio not getting sollution

  • @bobkrang5007
    @bobkrang5007 2 года назад

    Be careful!!! This video is 5 years old (out of date) and the presenter is using a MAC and not Windows 10!!!

  • @LettersByPooja
    @LettersByPooja 2 года назад

    Thanks Travel, this was super useful to me. I have a query: the formatter did not work for me on the fly. It asked me to install the formatter and took to the extension section with search string "category:formatters powershell" and none of the results match with powershell. Any way I can bring the formatter rightly? My VS code version is 1.67.1