Initial knowledge of PowerShell, NuGet PowerShell debugging

Source: Internet
Author: User
Tags variable scope

Initial knowledge of PowerShell, NuGet PowerShell debugging preface

I have heard that PowerShell is very good, but not really used, these two days just use to, by the way write about, may use later things. Originally wanted to remember the use of the process used in some of the operation, is so clever, found a very good tutorial site, so I can be lazy, haha.

Related information
    • Unofficial Online Tutorials Website
    • Www.pstips.net
    • Official documents
    • Entry
    • Basic Guide
    • Operating system requirements
    • Windows PowerShell ISE
    • Running Remote Commands
PowerShell debugging and debugging related when NuGet installs packages
  • In project need to use NuGet package Nugetdebugtools
  • Follow the tutorials on GitHub
  • The Package Manager console inputs commands that pop up an input box and PowerShell console when installing a NuGet package that needs to be debugged, input in-box input commands for debugging, and input variables or expressions to observe the results in the PowerShell console
  • Add Debugger
    ~Bash
    Add-debugger
    ~
    Or
    ~Bash
    Add-debugger-readhost
    ~
  • Set the script name to be debugged
    ~Bash
    Set-psbreakpoint-command Init.ps1, INSTALL.PS1, UNINSTALL.PS1
    ~
  • Create a new project, install the NuGet package you want to debug, and when you hit the previous step to set a breakpoint script, the Debug input box will appear and execute? A bunch of action tips appear
    ~~~bash
    S, Stepinto Step to the next statement into functions, scripts, etc.
    V, Stepover Step to the next statement over functions, scripts, etc.
    O, StepOut Step out of the current function, script, etc.
    C, Continue Continue operation (also on empty input).
    Q, Quit Stop operation and exit the debugger.
    ?, h Write this help message.
    K Write Call Stack (get-pscallstack).
    K Write detailed call stack using Format-list.

    W Restart watching the debugger output file.
    R Write Last PowerShell commands invoked on debugging.

  • Discussion on debugging PS1 scripts in NuGet packages
  • Attention
  • NuGet packages seem to be globally installed and installed locally within the project, and have not tried to know, guess
  • The way to bring up the NuGet Package Manager console installation after turning on VS is a global installation, and then installing packages within each project can be debugged
  • I was installed in the project Nugetdebugtools, also can use

Write the NuGet package PS1 script may be used to the Dongdong
  • Param ($installPath, $toolsPath, $package, $project) The first line of the file these four parameters are the path to the NuGet package, the script path, the object of the package itself, the project object that installs the package
  • Sometimes you need to change the operation of some files to always copy to the output directory
  • Code examples for PS1 scripts in NuGet
Summarize
  • Because completely useless, what posture will not, what to do is completely asked the Niang, the information is good, not many times can not find the use of the helpless, find the organization is really a little blind. So learning something new takes a little time to find the documentation or tutorials (what do you call the Force?). Does the official document not give any force? Hey, I just want to say you're happy. It can be an official document, an official community, a third-party community or a forum, and a foreign (English keyword search).
  • The most convenient way is to find around the relevant fields of Daniel, there are Daniel you also find what tutorial ah, walk up!
  • Whatever it is, it basically has its routines, and it's quick to understand the routines. For example, PowerShell script, execution environment-execution portal-data type-variable declaration and use-basic operation-execution end. More complex points There are various life cycle events, variable scope and so on, quickly get started using the basic no tube so much, as long as can Bang Bang bang run up, tube it 3,721.

Initial knowledge of PowerShell, NuGet PowerShell debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.