"Fossies" - the Fresh Open Source Software Archive

Member "PowerShell-7.2.5/docs/FAQ.md" (21 Jun 2022, 4062 Bytes) of package /linux/misc/PowerShell-7.2.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Frequently Asked Questions

Where can I learn PowerShell's syntax?

SS64.com is a good resource. Microsoft Docs is another excellent resource.

What are the best practices and style?

The PoshCode unofficial guide is our reference.

What are PowerShell's scoping rules?

Things that create a scope

Things that operate in the current scope

Why didn't an error throw an exception?

Error handling in PowerShell is a bit weird, as not all errors result in catchable exceptions by default. Setting $ErrorActionPreference = 'Stop' will likely do what you want; that is, cause non-terminating errors instead to terminate. Read An Introduction To Error Handling in PowerShell for more information.

Where do I get the PowerShell Core SDK package?

The SDK NuGet package Microsoft.PowerShell.SDK is provided for developers to write .NET Core C# code targeting PowerShell Core. PowerShell NuGet packages for releases starting from v6.0.0-alpha.9 will be published to the powershell-core myget feed.

To use the Microsoft.PowerShell.SDK NuGet package, declare PackageReference tags in your .csproj file as follows:

<ItemGroup>
  <PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.0-beta.9" />
  <PackageReference Include="Microsoft.PowerShell.Commands.Diagnostics" Version="6.0.0-beta.9" />
  <PackageReference Include="Microsoft.WSMan.Management" Version="6.0.0-beta.9"/>
</ItemGroup>

Why did my build fail?

There are few common issues with the build. The easiest way to resolve most issues with the build is to run Start-PSBuild -Clean.

Dependency changed

If package dependencies were changed in any project.json, you need to manually run dotnet restore to update your local dependency graphs. Start-PSBuild -Restore can automatically do this.

Resource changed

Start-PSBuild automatically calls Start-ResGen on the very first run. On subsequent runs, you may need to explicitly use Start-PSBuild -ResGen command.

Try it, when you see compilation error about *strings.

More details about resource.

TypeGen

Similar to -ResGen parameter, there is -TypeGen parameter that triggers regeneration of type catalog.

Why did Start-PSBuild tell me to update dotnet?

We depend on the latest version of the .NET CLI, as we use the output of dotnet --info to determine the current runtime identifier. Without this information, our build function can't know where dotnet is going to place the build artifacts.

You can automatically install this using Start-PSBootstrap. However, you must first manually uninstall other versions of the CLI.

If you have installed by using any of the following means:

You must manually uninstall it.

Additionally, if you've just unzipped their binary drops (or used their obtain scripts, which do essentially the same thing), you must manually delete the folder, as the .NET CLI team re-engineered how their binaries are setup, such that new packages' binaries get stomped on by old packages' binaries.