* Add dockerfile and test so we can test simple remoting behaviors
this docker file creates an image which can be used to test remoting with containers.
We start with the microsoft/windowsservercore image and then set up the system for
testing by adding a user, setting up configuration for basic auth, installing
PowerShell Core, and creating a configuration endpoint for PSCore.
The tests are very simple; it retrieve $PSVersionTable.PSVersion in the following
connections:
Full -> Full
Full -> Core
Core -> Full
Core -> Core
* Add new file to bootstrap the docker image
fix the tests to be more resilient to changes in the version of the PSCore package
* update script to use local user cmdlets rather than net.exe
also remove pscore.msi at the end of the image build process to save space
* clean up commented lines and remove an unused parameter from one of the functions
also use constants more consistently
* remove reference to docker image name by string and use variable instead.
Rather than relying on case-insensitive string compares of source and destination paths, use operating system calls to determine whether two paths refer to the same file. This solves not only the case-insensitivity issue but also allows the cmdlet to operate properly if the destination is a hard or symbolic link to the source.
The Windows side is implemented in C#. The Unix side is implemented partially in native code.
This makes it possibe to write for example
[ValidatePattern('[A-Z]:', ErrorMessage='The Drive should be specified as a single letter followed by a colon, for example "D:"')]
[string] $Drive,
The element being validated is also passed, so {0} can be used in the custom error message
This change moves powershell to .NET Core 2.0. Major changes are:
1. PowerShell assemblies are now targeting `netcoreapp2.0`. We are using `microsoft.netcore.app-2.0.0-preview1-001913-00`, which is from dotnet-core build 4/4/17. We cannot target `netstandard2.0` because the packages `System.Reflection.Emit` and `System.Reflection.Emit.Lightweight`, which are needed for powershell class, cannot be referenced when targeting `netstandard2.0`.
2. Refactor code to remove most CLR stub types and extension types.
3. Update build scripts to enable CI builds. The `-cache` section is specified to depend on `appveyor.yml`, so the cache will be invalidated if `appveyor.yml` is changed.
4. Ship `netcoreapp` reference assemblies with powershell to fix the issues in `Add-Type` (#2764). By default `Add-Type` will reference all those reference assemblies when compiling C# code. If `-ReferenceAssembly` is specified, then we search reference assemblies first, then the framework runtime assemblies, and lastly the loaded assemblies (possibly a third-party one that was already loaded).
5. `dotnet publish` generates executable on Unix platforms, but doesn't set "x" permission and thus it cannot execute. Currently, the "x" permission is set in the build script, `dotnet/cli` issue [#6286](https://github.com/dotnet/cli/issues/6286) is tracking this.
6. Replace the use of some APIs with the ones that take `SecureString`.
7. osx.10.12 is required to update to `netcoreapp2.0` because `dotnet-cli` 2.0.0-preview only works on osx.10.12.
8. Add dependency to `System.ValueTuple` to work around a ambiguous type identity issue in coreclr. The issue is tracked by `dotnet/corefx` [#17797](https://github.com/dotnet/corefx/issues/17797). When moving to newer version of `netcoreapp2.0`, we need to verify if this dependency is still needed.
Now `New-Item` can create a file symlink to a file target or to a non-existent target. It can also create a directory symlink to a directory target on Windows.
On Unix, it is a convention for shells to accept `-i` for an interactive shell and many
tools expect this behavior (`script` for example, and when setting powershell as the
default shell) and calls the shell with the `-i` switch. This change is breaking in
that `-i` previously could be used as short hand to match `-inputformat` which now will
need to be `-in`.
- Fix incorrect handling of 'GetCurrentProcess()' API return value in 'IsWow64()' function (MainEntry.cpp)
- Remove unused INVALID_HANDLE_VALUE field from 'ProcessNativeMethods' class (Process.cs)
There are cases like using PowerShell via Puppet where the account being
used does not have a home directory. Updated PowerShell to use a process
specific temporary directory if HOME, CONFIG, CACHE, and DATA directories
are not available. Temporary directory is removed when last runspace
is disposed.
Based on the conclusion in discussion #3248, this PR fix "OEM" and "Default" encoding in powershell.
1. OEM -- We need an internal fix because .Net Core has no "OEM" encoding.
The fix gives the following PowerShell Core behavior on "OEM" encoding:
- on Windows - as Windows PowerShell based on GetOEMCP() and legacy encodings (System.Text.Encoding.CodePages)
- on Unix - the same as default encoding in PowerShell Core
2. Default -- We need internal fix because CoreFX `Encoding.default` for all platforms is UTF8.
Until we complete the `Encoding RFC` we should restore behavior as in Windows PowerShell.
The fix gives the following PowerShell Core behavior on "Default" encoding:
- on Windows - as Windows PowerShell based on GetACP() and legacy encodings (System.Text.Encoding.CodePages)
- on Unix - UTF-8 without BOM (We are expecting that the same will be [in CoreFX](https://github.com/dotnet/coreclr/issues/10643))
The package 'libpsrpclient' was replaced by 'psrp' in #3271. However, this was missed when moving from project.json to MSBuild. This change makes this update.
- Removed the -TimeoutSec option and modified the expected Error to be consistent across platforms.
- Changed the port of the phony proxy to 9 which is reserved for the Discard Protocol. So even if the system is listening, it's supposed to discard that TCP request (UDP may use it for Wake-on-Lan, but doesn't affect this).
Fix by saving the cursor position, displaying the progress, and restoring the cursor back to the original position so normal formatting (e.g. table output) can continue.
Closes#3453.
* Help was incorrectly returning multiple instances of the same help file if it existed under a culture path and the parent was in the search path as well
* updated test to use generated help file rather than an actual one
* Fixed test to have module in $pshome path and casing of en-US culture