Move powershell to .NET Core 2.0 (#3556)
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.
This commit is contained in:
parent
06020f34e5
commit
7a55bf98b2
|
@ -8,7 +8,7 @@ os:
|
|||
- osx
|
||||
sudo: required
|
||||
dist: trusty
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8.1
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
@ -25,7 +25,7 @@ install:
|
|||
- popd
|
||||
# Default 2.0.0 Ruby is buggy
|
||||
# Default bundler version is buggy
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm use 2.3.1; gem uninstall bundler -v1.13.1; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm install ruby-2.3.1; rvm use 2.3.1; fi
|
||||
# spellcheck
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
nvm install 6.4.0 &&
|
||||
|
|
|
@ -2,9 +2,10 @@ version: 6.0.0-alpha.18-{build}
|
|||
|
||||
image: Visual Studio 2015
|
||||
|
||||
# cache version - netcoreapp.2.0.0-preview1-001913-00
|
||||
cache:
|
||||
- '%LocalAppData%\Microsoft\dotnet'
|
||||
- '%HOMEDRIVE%%HOMEPATH%\.nuget\packages'
|
||||
- '%LocalAppData%\Microsoft\dotnet -> appveyor.yml'
|
||||
- '%HOMEDRIVE%%HOMEPATH%\.nuget\packages -> appveyor.yml'
|
||||
|
||||
nuget:
|
||||
project_feed: true
|
||||
|
|
101
build.psm1
101
build.psm1
|
@ -265,15 +265,6 @@ function Start-PSBuild {
|
|||
}
|
||||
|
||||
($srcProjectDirs + $testProjectDirs) | % { Start-NativeExecution { dotnet restore $_ $RestoreArguments } }
|
||||
|
||||
# .NET Core's crypto library needs brew's OpenSSL libraries added to its rpath
|
||||
if ($IsOSX) {
|
||||
# This is the restored library used to build
|
||||
# This is allowed to fail since the user may have already restored
|
||||
Write-Warning ".NET Core links the incorrect OpenSSL, correcting NuGet package libraries..."
|
||||
find $env:HOME/.nuget -name System.Security.Cryptography.Native.OpenSsl.dylib | % { sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib $_ }
|
||||
find $env:HOME/.nuget -name System.Net.Http.Native.dylib | % { sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib $_ }
|
||||
}
|
||||
}
|
||||
|
||||
# handle ResGen
|
||||
|
@ -414,6 +405,8 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
|
|||
Start-TypeGen
|
||||
}
|
||||
|
||||
# Get the folder path where powershell.exe is located.
|
||||
$publishPath = Split-Path $Options.Output -Parent
|
||||
try {
|
||||
# Relative paths do not work well if cwd is not changed to project
|
||||
Push-Location $Options.Top
|
||||
|
@ -421,7 +414,6 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
|
|||
Start-NativeExecution { dotnet $Arguments }
|
||||
|
||||
if ($CrossGen) {
|
||||
$publishPath = Split-Path $Options.Output
|
||||
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
|
||||
log "PowerShell.exe with ngen binaries is available at: $($Options.Output)"
|
||||
} else {
|
||||
|
@ -431,13 +423,32 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
|
|||
Pop-Location
|
||||
}
|
||||
|
||||
# add 'x' permission when building the standalone application
|
||||
# this is temporary workaround to a bug in dotnet.exe, tracking by dotnet/cli issue #6286
|
||||
if ($Options.Configuration -eq "Linux" -and $Options.Publish) {
|
||||
chmod u+x $Options.Output
|
||||
}
|
||||
|
||||
# publish netcoreapp2.0 reference assemblies
|
||||
try {
|
||||
Push-Location "$PSScriptRoot/src/TypeCatalogGen"
|
||||
$refAssemblies = Get-Content -Path "powershell.inc" | ? { $_ -like "*microsoft.netcore.app*" } | % { $_.TrimEnd(';') }
|
||||
$refDestFolder = Join-Path -Path $publishPath -ChildPath "ref"
|
||||
|
||||
if (Test-Path $refDestFolder -PathType Container) {
|
||||
Remove-Item $refDestFolder -Force -Recurse -ErrorAction Stop
|
||||
}
|
||||
New-Item -Path $refDestFolder -ItemType Directory -Force -ErrorAction Stop > $null
|
||||
Copy-Item -Path $refAssemblies -Destination $refDestFolder -Force -ErrorAction Stop
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# download modules from powershell gallery.
|
||||
# - PowerShellGet, PackageManagement, Microsoft.PowerShell.Archive
|
||||
if($PSModuleRestore)
|
||||
{
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
# Downloading the PowerShellGet and PackageManagement modules.
|
||||
# $Options.Output is pointing to something like "...\src\powershell-win-core\bin\Debug\netcoreapp1.1\win10-x64\publish\powershell.exe",
|
||||
# so we need to get its parent directory
|
||||
$publishPath = Split-Path $Options.Output -Parent
|
||||
log "Restore PowerShell modules to $publishPath"
|
||||
|
||||
$modulesDir = Join-Path -Path $publishPath -ChildPath "Modules"
|
||||
|
@ -474,7 +485,7 @@ function New-PSOptions {
|
|||
[ValidateSet("Linux", "Debug", "Release", "CodeCoverage", "")]
|
||||
[string]$Configuration,
|
||||
|
||||
[ValidateSet("netcoreapp1.1", "net451")]
|
||||
[ValidateSet("netcoreapp2.0", "net451")]
|
||||
[string]$Framework,
|
||||
|
||||
# These are duplicated from Start-PSBuild
|
||||
|
@ -561,7 +572,7 @@ function New-PSOptions {
|
|||
$Framework = if ($FullCLR) {
|
||||
"net451"
|
||||
} else {
|
||||
"netcoreapp1.1"
|
||||
"netcoreapp2.0"
|
||||
}
|
||||
Write-Verbose "Using framework '$Framework'"
|
||||
}
|
||||
|
@ -694,7 +705,7 @@ function Publish-PSTestTools {
|
|||
|
||||
Find-Dotnet
|
||||
|
||||
$tools = "$PSScriptRoot/test/tools/EchoArgs","$PSScriptRoot/test/tools/CreateChildProcess"
|
||||
$tools = @("$PSScriptRoot/test/tools/EchoArgs", "echoargs"), @("$PSScriptRoot/test/tools/CreateChildProcess", "createchildprocess")
|
||||
if ($Options -eq $null)
|
||||
{
|
||||
$Options = New-PSOptions
|
||||
|
@ -703,9 +714,16 @@ function Publish-PSTestTools {
|
|||
# Publish EchoArgs so it can be run by tests
|
||||
foreach ($tool in $tools)
|
||||
{
|
||||
Push-Location $tool
|
||||
Push-Location $tool[0]
|
||||
try {
|
||||
dotnet publish --output bin --configuration $Options.Configuration --framework $Options.Framework --runtime $Options.Runtime
|
||||
|
||||
# add 'x' permission when building the standalone application
|
||||
# this is temporary workaround to a bug in dotnet.exe, tracking by dotnet/cli issue #6286
|
||||
if ($Options.Configuration -eq "Linux") {
|
||||
$executable = Join-Path -Path $tool[0] -ChildPath "bin/$($tool[1])"
|
||||
chmod u+x $executable
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
@ -972,8 +990,8 @@ function Start-PSxUnit {
|
|||
function Install-Dotnet {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$Channel,
|
||||
[string]$Version,
|
||||
[string]$Channel = "preview",
|
||||
[string]$Version = "2.0.0-preview1-005724",
|
||||
[switch]$NoSudo
|
||||
)
|
||||
|
||||
|
@ -981,7 +999,7 @@ function Install-Dotnet {
|
|||
# Note that when it is null, Invoke-Expression (but not &) must be used to interpolate properly
|
||||
$sudo = if (!$NoSudo) { "sudo" }
|
||||
|
||||
$obtainUrl = "https://raw.githubusercontent.com/dotnet/cli/v1.0.1/scripts/obtain"
|
||||
$obtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"
|
||||
|
||||
# Install for Linux and OS X
|
||||
if ($IsLinux -or $IsOSX) {
|
||||
|
@ -1007,14 +1025,6 @@ function Install-Dotnet {
|
|||
curl -sO $obtainUrl/$installScript
|
||||
bash ./$installScript -c $Channel -v $Version
|
||||
}
|
||||
|
||||
# .NET Core's crypto library needs brew's OpenSSL libraries added to its rpath
|
||||
if ($IsOSX) {
|
||||
# This is the library shipped with .NET Core
|
||||
# This is allowed to fail as the user may have installed other versions of dotnet
|
||||
Write-Warning ".NET Core links the incorrect OpenSSL, correcting .NET CLI libraries..."
|
||||
find $env:HOME/.dotnet -name System.Security.Cryptography.Native.OpenSsl.dylib | % { sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib $_ }
|
||||
}
|
||||
} elseif ($IsWindows) {
|
||||
Remove-Item -ErrorAction SilentlyContinue -Recurse -Force ~\AppData\Local\Microsoft\dotnet
|
||||
$installScript = "dotnet-install.ps1"
|
||||
|
@ -1040,11 +1050,10 @@ function Start-PSBootstrap {
|
|||
SupportsShouldProcess=$true,
|
||||
ConfirmImpact="High")]
|
||||
param(
|
||||
[string]$Channel = "rel-1.0.0",
|
||||
# we currently pin dotnet-cli version, because tool
|
||||
# is currently migrating to msbuild toolchain
|
||||
# and requires constant updates to our build process.
|
||||
[string]$Version = "1.0.1",
|
||||
[string]$Channel = "preview",
|
||||
# we currently pin dotnet-cli version, and will
|
||||
# update it when more stable version comes out.
|
||||
[string]$Version = "2.0.0-preview1-005724",
|
||||
[switch]$Package,
|
||||
[switch]$NoSudo,
|
||||
[switch]$Force
|
||||
|
@ -1250,7 +1259,7 @@ function Start-PSPackage {
|
|||
-not $Script:Options.CrossGen -or ## Last build didn't specify -CrossGen
|
||||
$Script:Options.Runtime -ne $Runtime -or ## Last build wasn't for the required RID
|
||||
$Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release'
|
||||
$Script:Options.Framework -ne "netcoreapp1.1") ## Last build wasn't for CoreCLR
|
||||
$Script:Options.Framework -ne "netcoreapp2.0") ## Last build wasn't for CoreCLR
|
||||
{
|
||||
# It's possible that the most recent build doesn't satisfy the package requirement but
|
||||
# an earlier build does. e.g., run the following in order on win10-x64:
|
||||
|
@ -2048,11 +2057,11 @@ function Start-TypeGen
|
|||
$GetDependenciesTargetValue = @'
|
||||
<Project>
|
||||
<Target Name="_GetDependencies"
|
||||
DependsOnTargets="ResolvePackageDependenciesDesignTime">
|
||||
DependsOnTargets="ResolveAssemblyReferencesDesignTime">
|
||||
<ItemGroup>
|
||||
<_DependentAssemblyPath Include="%(_DependenciesDesignTime.Path)%3B" Condition=" '%(_DependenciesDesignTime.Type)' == 'Assembly' And '%(_DependenciesDesignTime.Name)' != 'Microsoft.Management.Infrastructure.Native.dll' And '%(_DependenciesDesignTime.Name)' != 'Microsoft.Management.Infrastructure.dll' " />
|
||||
<_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_DependentAssemblyPath)" Overwrite="true" />
|
||||
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
'@
|
||||
|
@ -2771,19 +2780,9 @@ function Start-CrossGen {
|
|||
"win7-x64"
|
||||
}
|
||||
} elseif ($IsLinux) {
|
||||
if ($IsUbuntu) {
|
||||
"ubuntu.14.04-x64"
|
||||
} elseif ($IsCentOS) {
|
||||
"rhel.7-x64"
|
||||
} elseif ($IsFedora) {
|
||||
"fedora.24-x64"
|
||||
} elseif ($IsOpenSUSE13) {
|
||||
"opensuse.13.2-x64"
|
||||
} elseif (${IsOpenSUSE42.1}) {
|
||||
"opensuse.42.1-x64"
|
||||
}
|
||||
"linux-x64"
|
||||
} elseif ($IsOSX) {
|
||||
"osx.10.10-x64"
|
||||
"osx.10.12-x64"
|
||||
}
|
||||
|
||||
if (-not $crossGenRuntime) {
|
||||
|
@ -2827,8 +2826,6 @@ function Start-CrossGen {
|
|||
$commonAssembliesForAddType = @(
|
||||
"Microsoft.CodeAnalysis.CSharp.dll"
|
||||
"Microsoft.CodeAnalysis.dll"
|
||||
"Microsoft.CodeAnalysis.VisualBasic.dll"
|
||||
"Microsoft.CSharp.dll"
|
||||
)
|
||||
|
||||
# Common PowerShell libraries to crossgen
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyName>Microsoft.Management.Infrastructure.CimCmdlets</AssemblyName>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
#if CORECLR
|
||||
using System.ComponentModel;
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
|
@ -19,11 +19,11 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="GetEventSnapin.cs" />
|
||||
<Compile Remove="gen\GetEventResources.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1570</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -20,11 +20,11 @@
|
|||
<ProjectReference Include="..\Microsoft.PowerShell.Security\Microsoft.PowerShell.Security.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="commands\management\ClearRecycleBinCommand.cs" />
|
||||
<Compile Remove="commands\management\ControlPanelItemCommand.cs" />
|
||||
<Compile Remove="commands\management\CommitTransactionCommand.cs" />
|
||||
|
@ -77,10 +77,8 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Ping" Version="4.3.0" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.4.0-preview1-25204-02" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -9,11 +9,6 @@ using System.Runtime.Serialization;
|
|||
using Microsoft.Management.Infrastructure;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SystemException and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Cmdletization.Cim
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -15,13 +15,6 @@ using Microsoft.Management.Infrastructure.Options;
|
|||
using Microsoft.PowerShell.Cim;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Cmdletization.Cim
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Diagnostics;
|
|||
using System.Globalization;
|
||||
using System.Management.Automation;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
|
@ -18,13 +19,6 @@ using Microsoft.Management.Infrastructure;
|
|||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for MailAddress.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Net.Mail;
|
||||
#endif
|
||||
|
||||
// TODO/FIXME: Move this class to src/cimSupport/other directory (to map to the namespace it lives in and functionality it implements [cmdletization independent])
|
||||
|
||||
namespace Microsoft.PowerShell.Cim
|
||||
|
|
|
@ -18,6 +18,7 @@ using System.Reflection;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.Win32;
|
||||
|
@ -32,8 +33,6 @@ using Microsoft.PowerShell.CoreClr.Stubs;
|
|||
#else
|
||||
//TODO:CORECLR System.DirectoryServices is not available on CORE CLR
|
||||
using System.DirectoryServices;
|
||||
//TODO:CORECLR System.Security.Permission is not available on CORE CLR
|
||||
using System.Security.Permissions;
|
||||
using System.Management; // We are not porting the library to CoreCLR
|
||||
using Microsoft.WSMan.Management;
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.Specialized;
|
||||
using System.Diagnostics; // Process class
|
||||
using System.ComponentModel; // Win32Exception
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Management.Automation;
|
||||
|
@ -17,6 +18,7 @@ using System.Net;
|
|||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Management.Automation.Internal;
|
||||
|
@ -26,15 +28,6 @@ using Microsoft.Management.Infrastructure;
|
|||
using FileNakedHandle = System.IntPtr;
|
||||
using DWORD = System.UInt32;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SafeHandleZeroOrMinusOneIsInvalid and SerializableAttribute
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#else
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
// 2004/12/17-JonN ProcessNameGlobAttribute was deeply wrong.
|
||||
|
@ -752,13 +745,143 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteObject(ClrFacade.AddProcessProperties(IncludeUserName.IsPresent, process));
|
||||
WriteObject(IncludeUserName.IsPresent ? AddUserNameToProcess(process) : (object)process);
|
||||
}
|
||||
}//for loop
|
||||
} // ProcessRecord
|
||||
|
||||
#endregion Overrides
|
||||
|
||||
#region Privates
|
||||
|
||||
/// <summary>
|
||||
/// New PSTypeName added to the process object
|
||||
/// </summary>
|
||||
private const string TypeNameForProcessWithUserName = "System.Diagnostics.Process#IncludeUserName";
|
||||
|
||||
/// <summary>
|
||||
/// Add the 'UserName' NoteProperty to the Process object
|
||||
/// </summary>
|
||||
/// <param name="process"></param>
|
||||
/// <returns></returns>
|
||||
private static PSObject AddUserNameToProcess(Process process)
|
||||
{
|
||||
// Return null if we failed to get the owner information
|
||||
string userName = RetrieveProcessUserName(process);
|
||||
|
||||
PSObject processAsPsobj = PSObject.AsPSObject(process);
|
||||
PSNoteProperty noteProperty = new PSNoteProperty("UserName", userName);
|
||||
|
||||
processAsPsobj.Properties.Add(noteProperty, true);
|
||||
processAsPsobj.TypeNames.Insert(0, TypeNameForProcessWithUserName);
|
||||
|
||||
return processAsPsobj;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the UserName through PInvoke
|
||||
/// </summary>
|
||||
/// <param name="process"></param>
|
||||
/// <returns></returns>
|
||||
private static string RetrieveProcessUserName(Process process)
|
||||
{
|
||||
string userName = null;
|
||||
#if UNIX
|
||||
userName = Platform.NonWindowsGetUserFromPid(process.Id);
|
||||
#else
|
||||
IntPtr tokenUserInfo = IntPtr.Zero;
|
||||
IntPtr processTokenHandler = IntPtr.Zero;
|
||||
|
||||
const uint TOKEN_QUERY = 0x0008;
|
||||
|
||||
try
|
||||
{
|
||||
do
|
||||
{
|
||||
int error;
|
||||
if (!Win32Native.OpenProcessToken(ClrFacade.GetSafeProcessHandle(process), TOKEN_QUERY, out processTokenHandler)) { break; }
|
||||
|
||||
// Set the default length to be 256, so it will be sufficient for most cases
|
||||
int tokenInfoLength = 256;
|
||||
tokenUserInfo = Marshal.AllocHGlobal(tokenInfoLength);
|
||||
if (!Win32Native.GetTokenInformation(processTokenHandler, Win32Native.TOKEN_INFORMATION_CLASS.TokenUser, tokenUserInfo, tokenInfoLength, out tokenInfoLength))
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
if (error == Win32Native.ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
Marshal.FreeHGlobal(tokenUserInfo);
|
||||
tokenUserInfo = Marshal.AllocHGlobal(tokenInfoLength);
|
||||
|
||||
if (!Win32Native.GetTokenInformation(processTokenHandler, Win32Native.TOKEN_INFORMATION_CLASS.TokenUser, tokenUserInfo, tokenInfoLength, out tokenInfoLength)) { break; }
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var tokenUser = ClrFacade.PtrToStructure<Win32Native.TOKEN_USER>(tokenUserInfo);
|
||||
|
||||
// Set the default length to be 256, so it will be sufficient for most cases
|
||||
int userNameLength = 256, domainNameLength = 256;
|
||||
var userNameStr = new StringBuilder(userNameLength);
|
||||
var domainNameStr = new StringBuilder(domainNameLength);
|
||||
Win32Native.SID_NAME_USE accountType;
|
||||
|
||||
if (!Win32Native.LookupAccountSid(null, tokenUser.User.Sid, userNameStr, ref userNameLength, domainNameStr, ref domainNameLength, out accountType))
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
if (error == Win32Native.ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
userNameStr.EnsureCapacity(userNameLength);
|
||||
domainNameStr.EnsureCapacity(domainNameLength);
|
||||
|
||||
if (!Win32Native.LookupAccountSid(null, tokenUser.User.Sid, userNameStr, ref userNameLength, domainNameStr, ref domainNameLength, out accountType)) { break; }
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
userName = domainNameStr + "\\" + userNameStr;
|
||||
} while (false);
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
// The Process not started yet, or it's a process from a remote machine
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// The Process has exited, Process.Handle will raise this exception
|
||||
}
|
||||
catch (Win32Exception)
|
||||
{
|
||||
// We might get an AccessDenied error
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// I don't expect to get other exceptions,
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tokenUserInfo != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(tokenUserInfo);
|
||||
}
|
||||
|
||||
if (processTokenHandler != IntPtr.Zero)
|
||||
{
|
||||
Win32Native.CloseHandle(processTokenHandler);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return userName;
|
||||
}
|
||||
|
||||
#endregion Privates
|
||||
}//GetProcessCommand
|
||||
#endregion GetProcessCommand
|
||||
|
||||
|
@ -1873,11 +1996,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
startInfo.Domain = nwcredential.Domain;
|
||||
}
|
||||
#if CORECLR
|
||||
startInfo.PasswordInClearText = ClrFacade.ConvertSecureStringToString(_credential.Password);
|
||||
#else
|
||||
startInfo.Password = _credential.Password;
|
||||
#endif
|
||||
}
|
||||
|
||||
//RedirectionInput File Check -> Not Exist -> Throw Error
|
||||
|
@ -2402,11 +2521,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
IntPtr password = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
#if CORECLR
|
||||
password = (startinfo.PasswordInClearText == null) ? Marshal.StringToCoTaskMemUni(string.Empty) : Marshal.StringToCoTaskMemUni(startinfo.PasswordInClearText);
|
||||
#else
|
||||
password = (startinfo.Password == null) ? Marshal.StringToCoTaskMemUni(string.Empty) : ClrFacade.SecureStringToCoTaskMemUnicode(startinfo.Password);
|
||||
#endif
|
||||
password = (startinfo.Password == null) ? Marshal.StringToCoTaskMemUni(string.Empty) : Marshal.SecureStringToCoTaskMemUnicode(startinfo.Password);
|
||||
flag = ProcessNativeMethods.CreateProcessWithLogonW(startinfo.UserName, startinfo.Domain, password, logonFlags, null, cmdLine, creationFlags, AddressOfEnvironmentBlock, startinfo.WorkingDirectory, lpStartupInfo, lpProcessInformation);
|
||||
if (!flag)
|
||||
{
|
||||
|
@ -2821,7 +2936,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
internal sealed class SafeJobHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
internal SafeJobHandle(IntPtr jobHandle)
|
||||
|
|
|
@ -13,16 +13,10 @@ using System.Management.Automation.Internal;
|
|||
using System.ComponentModel; // Win32Exception
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.InteropServices; // Marshal, DllImport
|
||||
using System.Security.Permissions;
|
||||
using NakedWin32Handle = System.IntPtr;
|
||||
using DWORD = System.UInt32;
|
||||
|
||||
#if CORECLR
|
||||
// Use the stub for SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
#region ServiceBaseCommand
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1570</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -20,11 +20,11 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="commands\utility\FormatAndOutput\OutGridView\ColumnInfo.cs" />
|
||||
<Compile Remove="commands\utility\FormatAndOutput\OutGridView\ExpressionColumnInfo.cs" />
|
||||
<Compile Remove="commands\utility\FormatAndOutput\OutGridView\HeaderInfo.cs" />
|
||||
|
@ -89,9 +89,9 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.0.0-rc" />
|
||||
<PackageReference Include="System.Diagnostics.TextWriterTraceListener" Version="4.3.0" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.0.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.4.0-preview1-25204-02" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -22,6 +22,8 @@ using Microsoft.CodeAnalysis.CSharp;
|
|||
using System.IO;
|
||||
using Microsoft.CodeAnalysis.Emit;
|
||||
using System.Collections.Immutable;
|
||||
using System.Security;
|
||||
using PathType = System.IO.Path;
|
||||
#else
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
@ -324,7 +326,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string activeExtension = null;
|
||||
foreach (string path in resolvedPaths)
|
||||
{
|
||||
string currentExtension = System.IO.Path.GetExtension(path).ToUpperInvariant();
|
||||
string currentExtension = PathType.GetExtension(path).ToUpperInvariant();
|
||||
|
||||
switch (currentExtension)
|
||||
{
|
||||
|
@ -452,11 +454,9 @@ namespace Microsoft.PowerShell.Commands
|
|||
get { return referencedAssemblies; }
|
||||
set
|
||||
{
|
||||
referencedAssemblies = value ?? Utils.EmptyArray<string>();
|
||||
referencedAssembliesSpecified = true;
|
||||
if (value != null) { referencedAssemblies = value; }
|
||||
}
|
||||
}
|
||||
internal bool referencedAssembliesSpecified = false;
|
||||
internal string[] referencedAssemblies = Utils.EmptyArray<string>();
|
||||
|
||||
/// <summary>
|
||||
|
@ -964,7 +964,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Assembly assembly = LoadAssemblyHelper(assemblyName);
|
||||
if (assembly == null)
|
||||
{
|
||||
assembly = LoadFrom(ResolveReferencedAssembly(assemblyName));
|
||||
assembly = LoadFrom(ResolveAssemblyName(assemblyName, false));
|
||||
}
|
||||
|
||||
if (passThru)
|
||||
|
@ -1015,92 +1015,135 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private static string s_frameworkFolder = System.IO.Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.Location);
|
||||
|
||||
// there are two different assemblies: framework contract and framework implementation.
|
||||
// Version 1.1.1 of Microsoft.CodeAnalysis doesn't provide a good way to handle contract separately from implementation.
|
||||
// To simplify user experience we always add both of them to references.
|
||||
// 1) It's a legitimate scenario, when user provides a custom referenced assembly that was built against the contract assembly
|
||||
// (i.e. System.Management.Automation), so we need the contract one.
|
||||
// 2) We have to provide implementation assembly explicitly, Roslyn doesn't have a way to figure out implementation by itself.
|
||||
// So we are adding both.
|
||||
private static PortableExecutableReference s_objectImplementationAssemblyReference =
|
||||
MetadataReference.CreateFromFile(typeof(object).GetTypeInfo().Assembly.Location);
|
||||
|
||||
private static PortableExecutableReference s_mscorlibAssemblyReference =
|
||||
MetadataReference.CreateFromFile(Assembly.Load(new AssemblyName("mscorlib")).Location);
|
||||
|
||||
// This assembly should be System.Runtime.dll
|
||||
private static PortableExecutableReference s_systemRuntimeAssemblyReference =
|
||||
MetadataReference.CreateFromFile(ClrFacade.GetAssemblies(typeof(object).FullName).First().Location);
|
||||
|
||||
// SecureString is defined in a separate assembly.
|
||||
// This fact is an implementation detail and should not require the user to specify one more assembly,
|
||||
// if they want to use SecureString in Add-Type -TypeDefinition.
|
||||
// So this assembly should be in the default assemblies list to provide the best experience.
|
||||
private static PortableExecutableReference s_secureStringAssemblyReference =
|
||||
MetadataReference.CreateFromFile(typeof(System.Security.SecureString).GetTypeInfo().Assembly.Location);
|
||||
|
||||
// We now ship the NetCoreApp2.0 reference assemblies with PowerShell Core, so that Add-Type can work
|
||||
// in a predictable way and won't be broken when we move to newer version of .NET Core.
|
||||
// The NetCoreApp2.0 reference assemblies are located at '$PSHOME\ref'.
|
||||
private static string s_netcoreAppRefFolder = PathType.Combine(PathType.GetDirectoryName(typeof(PSObject).Assembly.Location), "ref");
|
||||
private static string s_frameworkFolder = PathType.GetDirectoryName(typeof(object).Assembly.Location);
|
||||
|
||||
// These assemblies are always automatically added to ReferencedAssemblies.
|
||||
private static PortableExecutableReference[] s_autoReferencedAssemblies = new PortableExecutableReference[]
|
||||
{
|
||||
s_mscorlibAssemblyReference,
|
||||
s_systemRuntimeAssemblyReference,
|
||||
s_secureStringAssemblyReference,
|
||||
s_objectImplementationAssemblyReference
|
||||
};
|
||||
private static Lazy<PortableExecutableReference[]> s_autoReferencedAssemblies = new Lazy<PortableExecutableReference[]>(InitAutoIncludedRefAssemblies);
|
||||
|
||||
// A HashSet of assembly names to be ignored if they are specified in '-ReferencedAssemblies'
|
||||
private static Lazy<HashSet<string>> s_refAssemblyNamesToIgnore = new Lazy<HashSet<string>>(InitRefAssemblyNamesToIgnore);
|
||||
|
||||
// These assemblies are used, when ReferencedAssemblies parameter is not specified.
|
||||
private static PortableExecutableReference[] s_defaultAssemblies = new PortableExecutableReference[]
|
||||
{
|
||||
s_mscorlibAssemblyReference,
|
||||
s_systemRuntimeAssemblyReference,
|
||||
s_secureStringAssemblyReference,
|
||||
s_objectImplementationAssemblyReference,
|
||||
MetadataReference.CreateFromFile(typeof(PSObject).GetTypeInfo().Assembly.Location)
|
||||
};
|
||||
private static Lazy<PortableExecutableReference[]> s_defaultAssemblies = new Lazy<PortableExecutableReference[]>(InitDefaultRefAssemblies);
|
||||
|
||||
private bool InMemory { get { return String.IsNullOrEmpty(outputAssembly); } }
|
||||
|
||||
private string ResolveReferencedAssembly(string referencedAssembly)
|
||||
/// <summary>
|
||||
/// Initialize the list of reference assemblies that will be used when '-ReferencedAssemblies' is not specified.
|
||||
/// </summary>
|
||||
private static PortableExecutableReference[] InitDefaultRefAssemblies()
|
||||
{
|
||||
// netcoreapp2.0 currently comes with 137 reference assemblies (maybe more in future), so we use a capacity of '150'.
|
||||
var defaultRefAssemblies = new List<PortableExecutableReference>(150);
|
||||
foreach (string file in Directory.EnumerateFiles(s_netcoreAppRefFolder, "*.dll", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
defaultRefAssemblies.Add(MetadataReference.CreateFromFile(file));
|
||||
}
|
||||
defaultRefAssemblies.Add(MetadataReference.CreateFromFile(typeof(PSObject).Assembly.Location));
|
||||
return defaultRefAssemblies.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the set of assembly names that should be ignored when they are specified in '-ReferencedAssemblies'.
|
||||
/// - System.Private.CoreLib.ni.dll - the runtim dll that contains most core/primitive types
|
||||
/// - System.Private.Uri.dll - the runtime dll that contains 'System.Uri' and related types
|
||||
/// Referencing these runtime dlls may cause ambiguous type identity or other issues.
|
||||
/// - System.Runtime.dll - the corresponding reference dll will be automatically included
|
||||
/// - System.Runtime.InteropServices.dll - the corresponding reference dll will be automatically included
|
||||
/// </summary>
|
||||
private static HashSet<string> InitRefAssemblyNamesToIgnore()
|
||||
{
|
||||
return new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
|
||||
PathType.GetFileName(typeof(object).Assembly.Location),
|
||||
PathType.GetFileName(typeof(Uri).Assembly.Location),
|
||||
PathType.GetFileName(GetReferenceAssemblyPathBasedOnType(typeof(object))),
|
||||
PathType.GetFileName(GetReferenceAssemblyPathBasedOnType(typeof(SecureString)))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the list of reference assemblies that will be automatically added when '-ReferencedAssemblies' is specified.
|
||||
/// </summary>
|
||||
private static PortableExecutableReference[] InitAutoIncludedRefAssemblies()
|
||||
{
|
||||
return new PortableExecutableReference[] {
|
||||
MetadataReference.CreateFromFile(GetReferenceAssemblyPathBasedOnType(typeof(object))),
|
||||
MetadataReference.CreateFromFile(GetReferenceAssemblyPathBasedOnType(typeof(SecureString)))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the path of reference assembly where the type is declared.
|
||||
/// </summary>
|
||||
private static string GetReferenceAssemblyPathBasedOnType(Type type)
|
||||
{
|
||||
string refAsmFileName = PathType.GetFileName(ClrFacade.GetAssemblies(type.FullName).First().Location);
|
||||
return PathType.Combine(s_netcoreAppRefFolder, refAsmFileName);
|
||||
}
|
||||
|
||||
private string ResolveAssemblyName(string assembly, bool isForReferenceAssembly)
|
||||
{
|
||||
// if it's a path, resolve it
|
||||
if (referencedAssembly.Contains(System.IO.Path.DirectorySeparatorChar) || referencedAssembly.Contains(System.IO.Path.AltDirectorySeparatorChar))
|
||||
if (assembly.Contains(PathType.DirectorySeparatorChar) || assembly.Contains(PathType.AltDirectorySeparatorChar))
|
||||
{
|
||||
if (System.IO.Path.IsPathRooted(referencedAssembly))
|
||||
if (PathType.IsPathRooted(assembly))
|
||||
{
|
||||
return referencedAssembly;
|
||||
return assembly;
|
||||
}
|
||||
else
|
||||
{
|
||||
var paths = SessionState.Path.GetResolvedPSPathFromPSPath(referencedAssembly);
|
||||
var paths = SessionState.Path.GetResolvedPSPathFromPSPath(assembly);
|
||||
return paths[0].Path;
|
||||
}
|
||||
}
|
||||
|
||||
if (!String.Equals(System.IO.Path.GetExtension(referencedAssembly), ".dll", StringComparison.OrdinalIgnoreCase))
|
||||
string refAssemblyDll = assembly;
|
||||
if (!assembly.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// If we already load the assembly, we can reference it by name
|
||||
Assembly result = LoadAssemblyHelper(referencedAssembly);
|
||||
if (result != null)
|
||||
// It could be a short assembly name or a full assembly name, but we
|
||||
// alwasy want the short name to find the corresponding assembly file.
|
||||
var assemblyName = new AssemblyName(assembly);
|
||||
refAssemblyDll = assemblyName.Name + ".dll";
|
||||
}
|
||||
|
||||
// We look up in reference/framework only when it's for resolving reference assemblies.
|
||||
// In case of 'Add-Type -AssemblyName' scenario, we don't attempt to resolve against framework assemblies because
|
||||
// 1. Explicitly loading a framework assembly usually is not necessary in PowerShell Core.
|
||||
// 2. A user should use assembly name instead of path if they want to explicitly load a framework assembly.
|
||||
if (isForReferenceAssembly)
|
||||
{
|
||||
// If it's for resolving a reference assembly, then we look in NetCoreApp ref assemblies first
|
||||
string netcoreAppRefPath = PathType.Combine(s_netcoreAppRefFolder, refAssemblyDll);
|
||||
if (File.Exists(netcoreAppRefPath))
|
||||
{
|
||||
return result.Location;
|
||||
return netcoreAppRefPath;
|
||||
}
|
||||
else
|
||||
|
||||
// Look up the assembly in the framework folder. This may happen when assembly is not part of
|
||||
// NetCoreApp, but comes from an additional package, such as 'Json.Net'.
|
||||
string frameworkPossiblePath = PathType.Combine(s_frameworkFolder, refAssemblyDll);
|
||||
if (File.Exists(frameworkPossiblePath))
|
||||
{
|
||||
referencedAssembly += ".dll";
|
||||
return frameworkPossiblePath;
|
||||
}
|
||||
|
||||
// The assembly name may point to a third-party assembly that is already loaded at run time.
|
||||
if (!assembly.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Assembly result = LoadAssemblyHelper(assembly);
|
||||
if (result != null)
|
||||
{
|
||||
return result.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lookup in framework folders and the current folder
|
||||
string frameworkPossiblePath = System.IO.Path.Combine(s_frameworkFolder, referencedAssembly);
|
||||
if (File.Exists(frameworkPossiblePath))
|
||||
{
|
||||
return frameworkPossiblePath;
|
||||
}
|
||||
|
||||
string currentFolderPath = SessionState.Path.GetResolvedPSPathFromPSPath(referencedAssembly)[0].Path;
|
||||
// Look up the assembly in the current folder
|
||||
string currentFolderPath = SessionState.Path.GetResolvedPSPathFromPSPath(refAssemblyDll)[0].Path;
|
||||
if (File.Exists(currentFolderPath))
|
||||
{
|
||||
return currentFolderPath;
|
||||
|
@ -1108,10 +1151,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
ErrorRecord errorRecord = new ErrorRecord(
|
||||
new Exception(
|
||||
String.Format(ParserStrings.ErrorLoadingAssembly, referencedAssembly)),
|
||||
String.Format(ParserStrings.ErrorLoadingAssembly, assembly)),
|
||||
"ErrorLoadingAssembly",
|
||||
ErrorCategory.InvalidOperation,
|
||||
referencedAssembly);
|
||||
assembly);
|
||||
|
||||
ThrowTerminatingError(errorRecord);
|
||||
return null;
|
||||
|
@ -1195,17 +1238,29 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(source, parseOptions);
|
||||
var references = s_defaultAssemblies;
|
||||
if (referencedAssembliesSpecified)
|
||||
var references = s_defaultAssemblies.Value;
|
||||
if (ReferencedAssemblies.Length > 0)
|
||||
{
|
||||
var tempReferences = ReferencedAssemblies.Select(a => MetadataReference.CreateFromFile(ResolveReferencedAssembly(a))).ToList();
|
||||
tempReferences.AddRange(s_autoReferencedAssemblies);
|
||||
var tempReferences = new List<PortableExecutableReference>(s_autoReferencedAssemblies.Value);
|
||||
foreach (string assembly in ReferencedAssemblies)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(assembly)) { continue; }
|
||||
string resolvedAssemblyPath = ResolveAssemblyName(assembly, true);
|
||||
|
||||
// Ignore some specified reference assemblies
|
||||
string fileName = PathType.GetFileName(resolvedAssemblyPath);
|
||||
if (s_refAssemblyNamesToIgnore.Value.Contains(fileName))
|
||||
{
|
||||
WriteVerbose(StringUtil.Format(AddTypeStrings.ReferenceAssemblyIgnored, resolvedAssemblyPath));
|
||||
continue;
|
||||
}
|
||||
tempReferences.Add(MetadataReference.CreateFromFile(resolvedAssemblyPath));
|
||||
}
|
||||
references = tempReferences.ToArray();
|
||||
}
|
||||
|
||||
CSharpCompilation compilation = CSharpCompilation.Create(
|
||||
System.IO.Path.GetRandomFileName(),
|
||||
PathType.GetRandomFileName(),
|
||||
syntaxTrees: new[] { syntaxTree },
|
||||
references: references,
|
||||
options: new CSharpCompilationOptions(OutputAssemblyTypeToOutputKind(OutputType)));
|
||||
|
|
|
@ -9,13 +9,6 @@ using System.IO;
|
|||
using System.Management.Automation;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -13,11 +13,6 @@ using System.Management.Automation.Internal;
|
|||
using System.Globalization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for ICloneable
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -85,11 +85,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
if (_waitHandle != null)
|
||||
{
|
||||
#if CORECLR //TODO:CORECLR bool WaitOne(int millisecondsTimeout,bool exitContext) is not available on CLR yet
|
||||
_waitHandle.WaitOne(new TimeSpan(0, 0, 0, 0, milliSecondsToSleep));
|
||||
#else
|
||||
_waitHandle.WaitOne(new TimeSpan(0, 0, 0, 0, milliSecondsToSleep), true);
|
||||
#endif
|
||||
_waitHandle.WaitOne(milliSecondsToSleep, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@ using Microsoft.PowerShell.Commands.Internal.Format;
|
|||
using System.Management.Automation.Internal;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,15 +4,10 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Security.Permissions;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Internal.Host;
|
||||
|
||||
#if CORECLR
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -8,12 +8,6 @@ using System.Management.Automation.Internal;
|
|||
using System.Runtime.Serialization;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SystemException, SerializationInfo, SerializableAttribute and Serializable
|
||||
// It is needed for WriteErrorException which ONLY used in Write-Error cmdlet.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
#region WriteDebugCommand
|
||||
|
|
|
@ -171,4 +171,7 @@
|
|||
<data name="CannotDefineNewType" xml:space="preserve">
|
||||
<value>Cannot add type. Definition of new types is not supported in this language mode.</value>
|
||||
</data>
|
||||
<data name="ReferenceAssemblyIgnored" xml:space="preserve">
|
||||
<value>The specified reference assembly '{0}' is unnecessary and ignored.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<Description>PowerShell Host</Description>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1570</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -27,11 +27,11 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="singleshell\installer\EngineInstaller.cs" />
|
||||
<Compile Remove="singleshell\installer\MshHostMshSnapin.cs" />
|
||||
<Compile Remove="gen\HostMshSnapinResources.cs" />
|
||||
|
@ -51,9 +51,4 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="System.Xml.XDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.MemoryMappedFiles" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -23,13 +23,6 @@ using System.Management.Automation.Security;
|
|||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Management.Automation.Language;
|
||||
#if CORECLR
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using ConsoleHandle = Microsoft.Win32.SafeHandles.SafeFileHandle;
|
||||
|
|
|
@ -2,19 +2,18 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AssemblyName>Microsoft.PowerShell.CoreCLR.AssemblyLoadContext</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
|
||||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -30,11 +29,4 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Metadata" Version="1.4.1" />
|
||||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -11,12 +11,11 @@
|
|||
<AssemblyName>Microsoft.PowerShell.CoreCLR.Eventing</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
|
||||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -32,11 +31,8 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="System.Security.Principal" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.SecureString" Version="4.3.0" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="4.4.0-preview1-25204-02" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -4,10 +4,6 @@ using System.Management.Automation.SecurityAccountsManager;
|
|||
using System.Runtime.Serialization;
|
||||
using Microsoft.PowerShell.LocalAccounts;
|
||||
|
||||
#if CORECLR
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -80,22 +76,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="ex"></param>
|
||||
public LocalAccountsException(String message, Exception ex) : base(message, ex) { }
|
||||
|
||||
#if CORECLR
|
||||
/// <summary>
|
||||
/// Compliance Constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="ctx"></param>
|
||||
// This is not supported for CoreCLR
|
||||
protected LocalAccountsException(SerializationInfo info, StreamingContext ctx) : base() { }
|
||||
#else
|
||||
/// <summary>
|
||||
/// Compliance Constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="ctx"></param>
|
||||
protected LocalAccountsException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { }
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -36,8 +36,4 @@
|
|||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1094,12 +1094,5 @@ namespace Microsoft.PowerShell.Internal
|
|||
}
|
||||
#endif
|
||||
|
||||
#if CORECLR // TODO: remove if CORECLR adds this attribute back
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event)]
|
||||
sealed class ExcludeFromCodeCoverageAttribute : Attribute
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<Description>PowerShell SDK metapackage</Description>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<PackageId>Microsoft.PowerShell.SDK</PackageId>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -17,87 +16,18 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.1.0" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.Collections.Immutable" Version="1.3.0" />
|
||||
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
|
||||
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.EventBasedAsync" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
|
||||
<PackageReference Include="System.Data.Common" Version="4.3.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.StackTrace" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.TextWriterTraceListener" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
|
||||
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
|
||||
<PackageReference Include="System.Globalization.Extensions" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.DriveInfo" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.Watcher" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.MemoryMappedFiles" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.Packaging" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.Pipes" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Parallel" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Ping" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Security" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.WebHeaderCollection" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.WebSockets" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.DispatchProxy" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Metadata" Version="1.4.1" />
|
||||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Resources.Reader" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.VisualC" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Json" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Cng" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Principal" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.SecureString" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.3.0" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.3.0" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Overlapped" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.7.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XPath" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.Private.ServiceModel" Version="4.3.0" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.IO.Packaging" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.4.0-beta-25205-01" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.4.0-beta-25205-01" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.0-beta-25205-01" />
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0-beta-25205-01" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.4.0-beta-25205-01" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Threading.AccessControl" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Private.ServiceModel" Version="4.4.0-beta-25205-01" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,25 +1,8 @@
|
|||
Microsoft PowerShell SDK
|
||||
========================
|
||||
|
||||
This project is a metapackage referencing the PowerShell projects and .NET Core packages that PowerShell ships.
|
||||
This is a meta-project that serves two purposes:
|
||||
|
||||
The package dependencies consist of two parts:
|
||||
1. Group PowerShell sub projects to avoid unnecessary duplication of reference declarations.
|
||||
2. Group extra .NET Core packages that PowerShell doesn't depend on directly but must provide for our users at runtime.
|
||||
|
||||
1. PowerShell projects: local source code with own sets of dependencies
|
||||
2. .NET Core packages: the framework libraries that we ensure are present for PowerShell developers at runtime
|
||||
|
||||
This second set includes packages that we do not necessarily require at compile-time, but must provide for our users at runtime.
|
||||
For example, we include the library `System.Runtime.Serialization.Json.dll` so that users of PowerShell can utilize its types and methods,
|
||||
even though PowerShell does not directly depend on the library.
|
||||
|
||||
There are intentionally duplicated dependencies.
|
||||
Instead of relying on dependency transitivity where A -> B, B -> C, so A -> C,
|
||||
we explicitly include A -> C if A requires C despite the removal of B.
|
||||
Additionally, we want to easily identify our complete dependency set without generating a lockfile
|
||||
(an artifact of `dotnet restore` after it resolves the dependency graph).
|
||||
For example, `System.Management.Automation` depends on `System.Diagnostics.TraceSource`,
|
||||
but `Microsoft.PowerShell.SDK` depends on both `System.Diagnostics.TraceSource` and `System.Management.Automation`.
|
||||
|
||||
Transitive dependencies not listed in [project.json][] are **not a part of public contract**.
|
||||
|
||||
[project.json]: project.json
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1570</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -20,11 +20,11 @@
|
|||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="singleshell\installer\MshSecurityMshSnapin.cs" />
|
||||
<Compile Remove="gen\SecurityMshSnapinResources.cs" />
|
||||
|
||||
|
|
|
@ -19,12 +19,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
using System.Reflection;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
|
|
|
@ -218,14 +218,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static X509Certificate2 GetCertFromPfxFile(string path, SecureString password)
|
||||
{
|
||||
//
|
||||
// NTRAID#DevDiv Bugs-33007-2004/7/08-kumarp
|
||||
// the following will not be required once X509Certificate2.Import()
|
||||
// accepts a SecureString
|
||||
//
|
||||
string clearTextPassword = Utils.GetStringFromSecureString(password);
|
||||
|
||||
var cert = new X509Certificate2(path, clearTextPassword, X509KeyStorageFlags.DefaultKeySet);
|
||||
var cert = new X509Certificate2(path, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
return cert;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,6 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, SystemException, ThreadAbortException and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyName>Microsoft.WSMan.Management</AssemblyName>
|
||||
|
@ -17,11 +17,11 @@
|
|||
<ProjectReference Include="..\Microsoft.WSMan.Runtime\Microsoft.WSMan.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="WsManSnapin.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyName>Microsoft.WSMan.Runtime</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
|
||||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -2,15 +2,10 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Generates C# typed bindings for .resx files</Description>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<AssemblyName>resgen</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>ubuntu.16.10-x64;ubuntu.16.04-x64;ubuntu.14.04-x64;debian.8-x64;centos.7-x64;fedora.24-x64;win7-x86;win7-x64;win81-x64;win10-x64;osx.10.11-x64;osx.10.12-x64;opensuse.13.2-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<PackageReference Include="System.Xml.XDocument" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -410,6 +410,73 @@ namespace System.Management.Automation
|
|||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The code is copied from the .NET implementation.
|
||||
/// </summary>
|
||||
internal static string GetFolderPath(System.Environment.SpecialFolder folder)
|
||||
{
|
||||
return InternalGetFolderPath(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The API set 'api-ms-win-shell-shellfolders-l1-1-0.dll' was removed from NanoServer, so we cannot depend on 'SHGetFolderPathW'
|
||||
/// to get the special folder paths. Instead, we need to rely on the basic environment variables to get the special folder paths.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The path to the specified system special folder, if that folder physically exists on your computer.
|
||||
/// Otherwise, an empty string ("").
|
||||
/// </returns>
|
||||
private static string InternalGetFolderPath(System.Environment.SpecialFolder folder)
|
||||
{
|
||||
string folderPath = null;
|
||||
#if UNIX
|
||||
string envHome = System.Environment.GetEnvironmentVariable(Platform.CommonEnvVariableNames.Home);
|
||||
if (null == envHome)
|
||||
{
|
||||
envHome = Platform.GetTemporaryDirectory();
|
||||
}
|
||||
switch (folder)
|
||||
{
|
||||
case System.Environment.SpecialFolder.ProgramFiles:
|
||||
folderPath = "/bin";
|
||||
if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
|
||||
break;
|
||||
case System.Environment.SpecialFolder.ProgramFilesX86:
|
||||
folderPath = "/usr/bin";
|
||||
if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
|
||||
break;
|
||||
case System.Environment.SpecialFolder.System:
|
||||
case System.Environment.SpecialFolder.SystemX86:
|
||||
folderPath = "/sbin";
|
||||
if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
|
||||
break;
|
||||
case System.Environment.SpecialFolder.Personal:
|
||||
folderPath = envHome;
|
||||
break;
|
||||
case System.Environment.SpecialFolder.LocalApplicationData:
|
||||
folderPath = System.IO.Path.Combine(envHome, ".config");
|
||||
if (!System.IO.Directory.Exists(folderPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(folderPath);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// directory creation may fail if the account doesn't have filesystem permission such as some service accounts
|
||||
folderPath = String.Empty;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
#else
|
||||
folderPath = System.Environment.GetFolderPath(folder);
|
||||
#endif
|
||||
return folderPath ?? string.Empty;
|
||||
}
|
||||
|
||||
// Platform methods prefixed NonWindows are:
|
||||
// - non-windows by the definition of the IsWindows method above
|
||||
// - here, because porting to Linux and other operating systems
|
||||
|
|
|
@ -5,12 +5,8 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Win32;
|
||||
using System.Management.Automation.Remoting;
|
||||
|
||||
#pragma warning disable 1591, 1572, 1571, 1573, 1587, 1570, 0067
|
||||
|
||||
|
@ -20,515 +16,6 @@ using System.Management.Automation.Remoting;
|
|||
// We use the stubs in this namespace to reduce #if/def in the code as much as possible.
|
||||
namespace Microsoft.PowerShell.CoreClr.Stubs
|
||||
{
|
||||
using System.Runtime.InteropServices;
|
||||
// We create some stub attribute types to make some attribute markers work in CoreCLR.
|
||||
// The purpose of this is to avoid #if/def in powershell code as much as possible.
|
||||
|
||||
#region Attribute_Related
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SpecialNameAttribute
|
||||
/// </summary>
|
||||
public sealed class SpecialNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SpecialNameAttribute() { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SerializableAttribute
|
||||
/// </summary>
|
||||
public sealed class SerializableAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SerializableAttribute() { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for NonSerializedAttribute
|
||||
/// </summary>
|
||||
public sealed class NonSerializedAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public NonSerializedAttribute() { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SecurityAction
|
||||
/// </summary>
|
||||
public enum SecurityAction
|
||||
{
|
||||
Assert = 3,
|
||||
Demand = 2,
|
||||
InheritanceDemand = 7,
|
||||
LinkDemand = 6,
|
||||
PermitOnly = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SecurityPermissionAttribute
|
||||
/// </summary>
|
||||
public sealed class SecurityPermissionAttribute : Attribute
|
||||
{
|
||||
public SecurityPermissionAttribute(SecurityAction action) { }
|
||||
public bool SerializationFormatter { get; set; }
|
||||
|
||||
public bool UnmanagedCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for TypeLibTypeAttribute
|
||||
/// </summary>
|
||||
public sealed class TypeLibTypeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="flags"></param>
|
||||
public TypeLibTypeAttribute(short flags) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SuppressUnmanagedCodeSecurityAttribute
|
||||
/// </summary>
|
||||
public class SuppressUnmanagedCodeSecurityAttribute : Attribute
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Stub for HostProtectionAttribute
|
||||
/// </summary>
|
||||
public sealed class HostProtectionAttribute : Attribute
|
||||
{
|
||||
public HostProtectionAttribute(SecurityAction action) { }
|
||||
public bool MayLeakOnAbort { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ResourceExposureAttribute
|
||||
/// </summary>
|
||||
public sealed class ResourceExposureAttribute : Attribute
|
||||
{
|
||||
private ResourceScope _resourceExposureLevel;
|
||||
|
||||
public ResourceExposureAttribute(ResourceScope exposureLevel)
|
||||
{
|
||||
_resourceExposureLevel = exposureLevel;
|
||||
}
|
||||
|
||||
public ResourceScope ResourceExposureLevel
|
||||
{
|
||||
get { return _resourceExposureLevel; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ResourceScope
|
||||
/// </summary>
|
||||
public enum ResourceScope
|
||||
{
|
||||
None = 0,
|
||||
// Resource type
|
||||
Machine = 0x1,
|
||||
Process = 0x2,
|
||||
AppDomain = 0x4,
|
||||
Library = 0x8,
|
||||
// Visibility
|
||||
Private = 0x10, // Private to this one class.
|
||||
Assembly = 0x20, // Assembly-level, like C#'s "internal"
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ReliabilityContractAttribute
|
||||
/// </summary>
|
||||
public sealed class ReliabilityContractAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ReliabilityContractAttribute(Consistency consistencyGuarantee, Cer cer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for Cer
|
||||
/// </summary>
|
||||
public enum Cer
|
||||
{
|
||||
/// <summary>
|
||||
/// None
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// MayFail
|
||||
/// </summary>
|
||||
MayFail,
|
||||
|
||||
/// <summary>
|
||||
/// Success
|
||||
/// </summary>
|
||||
Success
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for Consistency
|
||||
/// </summary>
|
||||
public enum Consistency
|
||||
{
|
||||
/// <summary>
|
||||
/// MayCorruptProcess
|
||||
/// </summary>
|
||||
MayCorruptProcess,
|
||||
|
||||
/// <summary>
|
||||
/// MayCorruptAppDomain
|
||||
/// </summary>
|
||||
MayCorruptAppDomain,
|
||||
|
||||
/// <summary>
|
||||
/// MayCorruptInstance
|
||||
/// </summary>
|
||||
MayCorruptInstance,
|
||||
|
||||
/// <summary>
|
||||
/// WillNotCorruptState
|
||||
/// </summary>
|
||||
WillNotCorruptState
|
||||
}
|
||||
|
||||
#endregion Attribute_Related
|
||||
|
||||
#region Serialization_Related
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SerializationInfo
|
||||
/// </summary>
|
||||
public sealed class SerializationInfo
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SerializationInfo() { }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
public void AddValue(string name, object value)
|
||||
{
|
||||
throw new NotImplementedException("AddValue(string name, object value)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
public void AddValue(string name, bool value)
|
||||
{
|
||||
throw new NotImplementedException("AddValue(string name, bool value)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="type"></param>
|
||||
public void AddValue(string name, Object value, Type type)
|
||||
{
|
||||
throw new NotImplementedException("AddValue(string name, Object value, Type type)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
public void AddValue(string name, int value)
|
||||
{
|
||||
throw new NotImplementedException("AddValue(string name, int value)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public object GetValue(string name, Type type)
|
||||
{
|
||||
throw new NotImplementedException("GetValue(string name, Type type)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public string GetString(string name)
|
||||
{
|
||||
throw new NotImplementedException("GetString(string name)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public bool GetBoolean(string name)
|
||||
{
|
||||
throw new NotImplementedException("GetBoolean(string name)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public int GetInt32(string name)
|
||||
{
|
||||
throw new NotImplementedException("GetInt32(string name)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
public void SetType(System.Type type)
|
||||
{
|
||||
throw new NotImplementedException("SetType(System.Type type)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public long GetInt64(string name)
|
||||
{
|
||||
throw new NotImplementedException("GetInt64(string name)");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Serialization_Related
|
||||
|
||||
#region Interface_Related
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ISerializable
|
||||
/// </summary>
|
||||
public interface ISerializable
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
void GetObjectData(SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ICloneable
|
||||
/// </summary>
|
||||
public interface ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
object Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for IObjectReference
|
||||
/// </summary>
|
||||
public interface IObjectReference
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
Object GetRealObject(System.Runtime.Serialization.StreamingContext context);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for IRuntimeVariables
|
||||
/// </summary>
|
||||
public interface IRuntimeVariables
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int Count { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
object this[int index] { get; set; }
|
||||
}
|
||||
|
||||
#endregion Interface_Related
|
||||
|
||||
#region Exception_Related
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SystemException
|
||||
/// </summary>
|
||||
public class SystemException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// SystemException constructor
|
||||
/// </summary>
|
||||
public SystemException() : base() { }
|
||||
|
||||
/// <summary>
|
||||
/// SystemException constructor
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public SystemException(string message) : base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// SystemException constructor
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="innerException"></param>
|
||||
public SystemException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// SystemException constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
protected SystemException(SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
|
||||
/// <summary>
|
||||
/// SystemException constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
public virtual void GetObjectData(SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for AccessViolationException
|
||||
/// </summary>
|
||||
public class AccessViolationException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// AccessViolationException constructor
|
||||
/// </summary>
|
||||
public AccessViolationException() : base() { }
|
||||
|
||||
/// <summary>
|
||||
/// AccessViolationException constructor
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public AccessViolationException(string message) : base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// AccessViolationException constructor
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="innerException"></param>
|
||||
public AccessViolationException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// AccessViolationException constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
protected AccessViolationException(SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
|
||||
/// <summary>
|
||||
/// AccessViolationException constructor
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
public virtual void GetObjectData(SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ThreadAbortException
|
||||
/// </summary>
|
||||
public sealed class ThreadAbortException : Exception
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for AppDomainUnloadedException
|
||||
/// </summary>
|
||||
public sealed class AppDomainUnloadedException : Exception
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Exception_Related
|
||||
|
||||
#region SafeHandle_Related
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SafeHandleZeroOrMinusOneIsInvalid
|
||||
/// </summary>
|
||||
public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle)
|
||||
: base(IntPtr.Zero, ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IsInvalid
|
||||
/// </summary>
|
||||
public override bool IsInvalid
|
||||
{
|
||||
get
|
||||
{
|
||||
return handle == IntPtr.Zero || handle == new IntPtr(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for SafeHandleMinusOneIsInvalid
|
||||
/// </summary>
|
||||
public abstract class SafeHandleMinusOneIsInvalid : SafeHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
protected SafeHandleMinusOneIsInvalid(bool ownsHandle)
|
||||
: base(new IntPtr(-1), ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IsInvalid
|
||||
/// </summary>
|
||||
public override bool IsInvalid
|
||||
{
|
||||
get
|
||||
{
|
||||
return handle == new IntPtr(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion SafeHandle_Related
|
||||
|
||||
#region Misc_Types
|
||||
|
||||
/// <summary>
|
||||
|
@ -546,22 +33,15 @@ namespace Microsoft.PowerShell.CoreClr.Stubs
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for ProcessWindowStyle
|
||||
/// Stub for TypeLibTypeAttribute
|
||||
/// </summary>
|
||||
public enum ProcessWindowStyle
|
||||
public sealed class TypeLibTypeAttribute : Attribute
|
||||
{
|
||||
Normal,
|
||||
Hidden,
|
||||
Minimized,
|
||||
Maximized
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub for MailAddress
|
||||
/// </summary>
|
||||
public class MailAddress
|
||||
{
|
||||
public MailAddress(string address) { }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="flags"></param>
|
||||
public TypeLibTypeAttribute(short flags) { }
|
||||
}
|
||||
|
||||
#endregion Misc_Types
|
||||
|
@ -642,125 +122,6 @@ namespace Microsoft.PowerShell.CoreClr.Stubs
|
|||
#endregion
|
||||
}
|
||||
|
||||
|
||||
//TODO:CORECLR Put Stubs to System.Management.Core.dll
|
||||
namespace System
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO:CORECLR Inspection of the binary module needs to be re-write without using AppDomain
|
||||
/// </summary>
|
||||
internal sealed class AppDomain
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static System.AppDomain CreateDomain(string friendlyName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void Unload(System.AppDomain domain)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
internal class WebClient //: Component
|
||||
{
|
||||
public WebClient() { }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public bool UseDefaultCredentials { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.Security
|
||||
{
|
||||
using System.Text;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
sealed public class SecurityElement
|
||||
{
|
||||
private static readonly string[] s_escapeStringPairs = new string[]
|
||||
{
|
||||
// these must be all once character escape sequences or a new escaping algorithm is needed
|
||||
"<", "<",
|
||||
">", ">",
|
||||
"\"", """,
|
||||
"\'", "'",
|
||||
"&", "&"
|
||||
};
|
||||
private static readonly char[] s_escapeChars = new char[] { '<', '>', '\"', '\'', '&' };
|
||||
|
||||
/// <summary>
|
||||
/// Replaces invalid XML characters in a string with their valid XML equivalent.
|
||||
/// </summary>
|
||||
public static string Escape(string str)
|
||||
{
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
StringBuilder sb = null;
|
||||
|
||||
int strLen = str.Length;
|
||||
int index; // Pointer into the string that indicates the location of the current '&' character
|
||||
int newIndex = 0; // Pointer into the string that indicates the start index of the "remaining" string (that still needs to be processed).
|
||||
|
||||
do
|
||||
{
|
||||
index = str.IndexOfAny(s_escapeChars, newIndex);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
if (sb == null)
|
||||
return str;
|
||||
else
|
||||
{
|
||||
sb.Append(str, newIndex, strLen - newIndex);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sb == null)
|
||||
sb = new StringBuilder();
|
||||
|
||||
sb.Append(str, newIndex, index - newIndex);
|
||||
sb.Append(GetEscapeSequence(str[index]));
|
||||
|
||||
newIndex = (index + 1);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
private static string GetEscapeSequence(char c)
|
||||
{
|
||||
int iMax = s_escapeStringPairs.Length;
|
||||
|
||||
for (int i = 0; i < iMax; i += 2)
|
||||
{
|
||||
String strEscSeq = s_escapeStringPairs[i];
|
||||
String strEscValue = s_escapeStringPairs[i + 1];
|
||||
|
||||
if (strEscSeq[0] == c)
|
||||
return strEscValue;
|
||||
}
|
||||
|
||||
Diagnostics.Debug.Assert(false, "Unable to find escape sequence for this character");
|
||||
return c.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion CLR_STUBS
|
||||
|
||||
#region PS_STUBS
|
||||
|
@ -1357,18 +718,6 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Environment
|
||||
|
||||
internal static partial class Environment
|
||||
{
|
||||
//TODO:CORECLR Need to be removed once we decide what will be the replacement
|
||||
internal static void Exit(int exitCode)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Environment
|
||||
}
|
||||
|
||||
namespace System.Management.Automation.Security
|
||||
|
@ -1427,6 +776,7 @@ namespace System.Management.Automation.Security
|
|||
// Porting note: Tracing is absolutely not available on Linux
|
||||
namespace System.Management.Automation.Tracing
|
||||
{
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1792,61 +1142,6 @@ namespace Microsoft.PowerShell
|
|||
|
||||
#endregion TEMPORARY
|
||||
|
||||
|
||||
|
||||
#region Timer
|
||||
namespace System
|
||||
{
|
||||
// Summary:
|
||||
// Provides data for the event that is raised when there is an exception that
|
||||
// is not handled in any application domain.
|
||||
//[Serializable]
|
||||
//[ComVisible(true)]
|
||||
internal class UnhandledExceptionEventArgs : EventArgs
|
||||
{
|
||||
// Summary:
|
||||
// Initializes a new instance of the System.UnhandledExceptionEventArgs class
|
||||
// with the exception object and a common language runtime termination flag.
|
||||
//PS_STUBS_FOR_REMOTE
|
||||
// Parameters:
|
||||
// exception:
|
||||
// The exception that is not handled.
|
||||
//
|
||||
// isTerminating:
|
||||
// true if the runtime is terminating; otherwise, false.
|
||||
public UnhandledExceptionEventArgs(object exception, bool isTerminating) { }
|
||||
|
||||
// Summary:
|
||||
// Gets the unhandled exception object.
|
||||
//
|
||||
// Returns:
|
||||
// The unhandled exception object.
|
||||
public object ExceptionObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// Indicates whether the common language runtime is terminating.
|
||||
//
|
||||
// Returns:
|
||||
// true if the runtime is terminating; otherwise, false.
|
||||
public bool IsTerminating
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Timer
|
||||
|
||||
#pragma warning restore 1591, 1572, 1571, 1573, 1587, 1570, 0067
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,13 +17,6 @@ using System.Runtime.InteropServices;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Security;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
||||
{
|
||||
|
@ -618,15 +611,6 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
|||
Initialize(null, null);
|
||||
}
|
||||
|
||||
#if CORECLR
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
private static string SystemDirectory
|
||||
{
|
||||
get { return Environment.GetFolderPath(Environment.SpecialFolder.System); }
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the class cache with the default classes in $ENV:SystemDirectory\Configuration.
|
||||
/// </summary>
|
||||
|
@ -679,12 +663,8 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
|||
}
|
||||
else
|
||||
{
|
||||
#if CORECLR
|
||||
var systemResourceRoot = Path.Combine(SystemDirectory, "Configuration");
|
||||
#else
|
||||
var systemResourceRoot = Path.Combine(Environment.SystemDirectory, "Configuration");
|
||||
#endif
|
||||
var programFilesDirectory = Environment.GetEnvironmentVariable("ProgramFiles");
|
||||
var systemResourceRoot = Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), "Configuration");
|
||||
var programFilesDirectory = Platform.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
Debug.Assert(programFilesDirectory != null, "Program Files environment variable does not exist!");
|
||||
var customResourceRoot = Path.Combine(programFilesDirectory, "WindowsPowerShell\\Configuration");
|
||||
Debug.Assert(Directory.Exists(customResourceRoot), "%ProgramFiles%\\WindowsPowerShell\\Configuration Directory does not exist");
|
||||
|
@ -724,11 +704,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
|||
List<string> modulePaths = new List<string>();
|
||||
if (modulePathList == null || modulePathList.Count == 0)
|
||||
{
|
||||
#if CORECLR
|
||||
modulePaths.Add(Path.Combine(SystemDirectory, InboxDscResourceModulePath));
|
||||
#else
|
||||
modulePaths.Add(Path.Combine(Environment.SystemDirectory, InboxDscResourceModulePath));
|
||||
#endif
|
||||
modulePaths.Add(Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), InboxDscResourceModulePath));
|
||||
isInboxResource = true;
|
||||
}
|
||||
else
|
||||
|
@ -989,11 +965,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal
|
|||
|
||||
if (value != null)
|
||||
{
|
||||
#if CORECLR
|
||||
IntPtr ptr = SecureStringMarshal.SecureStringToCoTaskMemUnicode(value);
|
||||
#else
|
||||
IntPtr ptr = Marshal.SecureStringToCoTaskMemUnicode(value);
|
||||
#endif
|
||||
passwordValueToAdd = Marshal.PtrToStringUni(ptr);
|
||||
Marshal.ZeroFreeCoTaskMemUnicode(ptr);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>6.0.0</VersionPrefix>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1570;CS1734</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -16,50 +16,22 @@
|
|||
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.PowerShell.CoreCLR.AssemblyLoadContext\Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.csproj" />
|
||||
<ProjectReference Include="..\Microsoft.PowerShell.CoreCLR.Eventing\Microsoft.PowerShell.CoreCLR.Eventing.csproj" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
||||
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
|
||||
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.EventBasedAsync" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
|
||||
<PackageReference Include="System.Data.Common" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.StackTrace" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
|
||||
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.DriveInfo" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.Watcher" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.Pipes" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
|
||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.3.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Parallel" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.4.0-preview1-25204-02" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0-preview1-25204-02" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
|
||||
<ItemGroup>
|
||||
<Compile Remove="cimSupport\cmdletization\xml\cmdlets-over-objects.objectModel.autogen.cs" />
|
||||
<Compile Remove="cimSupport\cmdletization\xml\cmdlets-over-objects.xmlSerializer.autogen.cs" />
|
||||
<Compile Remove="engine\CodeMethods.cs" />
|
||||
|
@ -123,7 +95,6 @@
|
|||
<Compile Remove="engine\ComInterop\VariantBuilder.cs" />
|
||||
<Compile Remove="engine\ExtraAdapter.cs" />
|
||||
<Compile Remove="engine\ManagementObjectAdapter.cs" />
|
||||
<Compile Remove="engine\MshObjectTypeDescriptor.cs" />
|
||||
<Compile Remove="engine\PSMI\PSNegotiationData.cs" />
|
||||
<Compile Remove="engine\PSMI\PSPowerShellPipeline.cs" />
|
||||
<Compile Remove="engine\PSMI\Serialization\InternalMISerializer.cs" />
|
||||
|
@ -137,6 +108,7 @@
|
|||
<Compile Remove="engine\hostifaces\RunspaceInvoke.cs" />
|
||||
<Compile Remove="logging\eventlog\EventLogLogProvider.cs" />
|
||||
<Compile Remove="namespaces\SafeTransactionHandle.cs" />
|
||||
<Compile Remove="namespaces\SafeRegistryHandle.cs" />
|
||||
<Compile Remove="namespaces\TransactedRegistry.cs" />
|
||||
<Compile Remove="namespaces\TransactedRegistryKey.cs" />
|
||||
<Compile Remove="namespaces\TransactedRegistrySecurity.cs" />
|
||||
|
|
|
@ -22,13 +22,6 @@ using System.Management.Automation.Language;
|
|||
using Microsoft.PowerShell.Commands;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Cmdletization
|
||||
{
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
|
||||
|
@ -54,9 +47,6 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
ScriptWriter.s_xmlReaderSettings.MaxCharactersFromEntities = 16384; // generous guess for the upper bound
|
||||
ScriptWriter.s_xmlReaderSettings.MaxCharactersInDocument = 128 * 1024 * 1024; // generous guess for the upper bound
|
||||
|
||||
#if CORECLR // XmlReaderSettings doesn't have XmlResolver and Schema Validation related members in CoreCLR.
|
||||
ScriptWriter.s_xmlReaderSettings.DtdProcessing = DtdProcessing.Ignore; // DtdProcessing.Parse is not in CoreCLR, so we ignore DTDs in OneCore powershell
|
||||
#else
|
||||
ScriptWriter.s_xmlReaderSettings.DtdProcessing = DtdProcessing.Parse; // Allowing DTD parsing with limits of MaxCharactersFromEntities/MaxCharactersInDocument
|
||||
ScriptWriter.s_xmlReaderSettings.XmlResolver = null; // do not fetch external documents
|
||||
// xsd schema related settings
|
||||
|
@ -68,7 +58,6 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
ScriptWriter.s_xmlReaderSettings.Schemas = new XmlSchemaSet();
|
||||
ScriptWriter.s_xmlReaderSettings.Schemas.Add(null, cmdletizationSchemaReader);
|
||||
ScriptWriter.s_xmlReaderSettings.Schemas.XmlResolver = null; // do not fetch external documents
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Static code reused for reading cmdletization xml
|
||||
|
@ -110,13 +99,12 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
#if !CORECLR // No XmlSchema Validation In CoreCLR
|
||||
XmlSchemaException schemaException = e.InnerException as XmlSchemaException;
|
||||
if (schemaException != null)
|
||||
{
|
||||
throw new XmlException(schemaException.Message, schemaException, schemaException.LineNumber, schemaException.LinePosition);
|
||||
}
|
||||
#endif
|
||||
|
||||
XmlException xmlException = e.InnerException as XmlException;
|
||||
if (xmlException != null)
|
||||
{
|
||||
|
|
|
@ -13,14 +13,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using Microsoft.PowerShell.Commands.Internal.Format;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializationInfo, SecurityPermissionAttribute and Serializable
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
// TODO:CORECLR Permissions is not available on CORE CLR yet
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
|
|
|
@ -11,11 +11,6 @@ using System.Management.Automation.Host;
|
|||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
/*
|
||||
SUMMARY: this file contains a general purpose, reusable framework for
|
||||
loading XML files, and do data validation.
|
||||
|
|
|
@ -7,17 +7,10 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Net;
|
||||
using System.Security;
|
||||
using SafeString = System.String;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.PowerShell;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
|
||||
// FxCop suppressions for resource strings:
|
||||
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "Credential.resources", MessageId = "Cred")]
|
||||
|
||||
|
@ -163,8 +156,8 @@ namespace System.Management.Automation
|
|||
_userName = (string)info.GetValue("UserName", typeof(string));
|
||||
|
||||
// deserialize to secure string
|
||||
SafeString safePassword = (SafeString)info.GetValue("Password", typeof(SafeString));
|
||||
if (safePassword == SafeString.Empty)
|
||||
string safePassword = (string)info.GetValue("Password", typeof(string));
|
||||
if (safePassword == string.Empty)
|
||||
{
|
||||
_password = new SecureString();
|
||||
}
|
||||
|
@ -272,28 +265,7 @@ namespace System.Management.Automation
|
|||
|
||||
if (IsValidUserName(_userName, out user, out domain))
|
||||
{
|
||||
#if CORECLR
|
||||
// NetworkCredential constructor only accepts plain string password in .NET Core.
|
||||
// TODO: This raises security concerns about having the plain string password in memory
|
||||
// for an indefinite period of time. So we need to change back to the constructor that
|
||||
// takes a SecureString password once it becomes available in .NET Core.
|
||||
IntPtr unmanagedPtr = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
unmanagedPtr = ClrFacade.SecureStringToCoTaskMemUnicode(_password);
|
||||
string pwdInPlainText = System.Runtime.InteropServices.Marshal.PtrToStringUni(unmanagedPtr);
|
||||
_netCred = new NetworkCredential(user, pwdInPlainText, domain);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (unmanagedPtr != IntPtr.Zero)
|
||||
{
|
||||
Marshal.ZeroFreeCoTaskMemUnicode(unmanagedPtr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
_netCred = new NetworkCredential(user, _password, domain);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,15 +13,8 @@ using System.Text;
|
|||
using System.Resources;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Reflection;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Management.Automation.Language;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SecurityPermissionAttribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
|
|
|
@ -4,13 +4,7 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
||||
using System.Runtime.Serialization;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
#if !CORECLR
|
||||
using System.Security.Permissions;
|
||||
#else
|
||||
// Use stubs for ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
|
@ -537,7 +531,7 @@ namespace System.Management.Automation
|
|||
public class PSInvalidCastException : InvalidCastException, IContainsErrorRecord
|
||||
{
|
||||
#region Serialization
|
||||
#if !CORECLR // InvalidCastException Has No Serialization In CoreCLR
|
||||
|
||||
/// <summary>
|
||||
/// Populates a <see cref="System.Runtime.Serialization.SerializationInfo"/> with the
|
||||
/// data needed to serialize the PSInvalidCastException object.
|
||||
|
@ -564,7 +558,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
_errorId = info.GetString("ErrorId");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Serialization
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -11,11 +11,6 @@ using System.Collections.Generic;
|
|||
using System.Management.Automation.Language;
|
||||
using System.Management.Automation.Security;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -2,14 +2,8 @@
|
|||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
--********************************************************************/
|
||||
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Automation.Language;
|
||||
|
||||
#if CORECLR
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
|
|
|
@ -2127,7 +2127,8 @@ namespace System.Management.Automation
|
|||
using (typeConversion.TraceScope("Looking for \"{0}\" cast operator.", methodName))
|
||||
{
|
||||
// Get multiple matched Public & Static methods
|
||||
var methods = ClrFacade.GetMethods(targetType, methodName);
|
||||
const BindingFlags flagsToUse = BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod;
|
||||
var methods = targetType.GetMember(methodName, flagsToUse);
|
||||
foreach (MethodInfo method in methods)
|
||||
{
|
||||
if (!resultType.IsAssignableFrom(method.ReturnType))
|
||||
|
|
|
@ -20,13 +20,6 @@ using System.Xml;
|
|||
using Microsoft.PowerShell.Cmdletization;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Now define the set of commands for manipulating modules.
|
||||
//
|
||||
|
|
|
@ -16,13 +16,6 @@ using System.Management.Automation.Internal;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Now define the set of commands for manipulating modules.
|
||||
//
|
||||
|
@ -837,7 +830,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
protected override void EndProcessing()
|
||||
{
|
||||
// Win8: 264471 - Error message for New-ModuleManifest –ProcessorArchitecture is obsolete.
|
||||
// Win8: 264471 - Error message for New-ModuleManifest -ProcessorArchitecture is obsolete.
|
||||
// If an undefined value is passed for the ProcessorArchitecture parameter, the error message from parameter binder includes all the values from the enum.
|
||||
// The value 'IA64' for ProcessorArchitecture is not supported. But since we do not own the enum System.Reflection.ProcessorArchitecture, we cannot control the values in it.
|
||||
// So, we add a separate check in our code to give an error if user specifies IA64
|
||||
|
|
|
@ -10,11 +10,6 @@ using System.Text;
|
|||
using System.Management.Automation.Language;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
@ -23,14 +24,9 @@ using System.Runtime.Serialization;
|
|||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Management.Infrastructure;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if !CORECLR
|
||||
using System.Data;
|
||||
using System.DirectoryServices;
|
||||
#else
|
||||
// Use stubs for Serializable attribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
#pragma warning disable 1634, 1691 // Stops compiler from warning about unknown warnings
|
||||
|
@ -47,9 +43,7 @@ namespace System.Management.Automation
|
|||
/// It is permitted to subclass <see cref="PSObject"/>
|
||||
/// but there is no established scenario for doing this, nor has it been tested.
|
||||
/// </remarks>
|
||||
#if !CORECLR // TypeDescriptionProvider is not supported in CoreCLR
|
||||
[TypeDescriptionProvider(typeof(PSObjectTypeDescriptionProvider))]
|
||||
#endif
|
||||
[Serializable]
|
||||
public class PSObject : IFormattable, IComparable, ISerializable, IDynamicMetaObjectProvider
|
||||
{
|
||||
|
|
|
@ -4,11 +4,6 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for Serializable attribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -20,11 +20,6 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -36,11 +36,10 @@ namespace Microsoft.PowerShell {
|
|||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns>the parent process, or null if the parent is no longer running</returns>
|
||||
public static PSObject GetParentProcess(PSObject obj)
|
||||
public static object GetParentProcess(PSObject obj)
|
||||
{
|
||||
var process = PSObject.Base(obj) as Process;
|
||||
var parent = process?.GetParent();
|
||||
return parent != null ? ClrFacade.AddProcessProperties(false, parent) : null;
|
||||
return process?.GetParent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -12,10 +12,6 @@ using System.Management.Automation;
|
|||
using Microsoft.Win32;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#endif
|
||||
|
|
|
@ -5,11 +5,6 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -6,11 +6,6 @@ using System.Collections.ObjectModel;
|
|||
using System.Management.Automation.Provider;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -18,12 +18,7 @@ using System.Runtime.Serialization;
|
|||
using System.Security;
|
||||
using System.Xml;
|
||||
using Dbg = System.Diagnostics.Debug;
|
||||
#if !CORECLR
|
||||
using System.Security.Permissions;
|
||||
#else
|
||||
// Use stub for SerializableAttribute, SecurityPermissionAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
#pragma warning disable 1634, 1691 // Stops compiler from warning about unknown warnings
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ using TypeTable = System.Management.Automation.Runspaces.TypeTable;
|
|||
#if CORECLR
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Principal;
|
||||
using PSUtils = System.Management.Automation.PsUtils;
|
||||
|
@ -318,7 +317,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
baseDirectories.Add(appBase);
|
||||
}
|
||||
|
||||
#if !UNIX
|
||||
// Win8: 454976
|
||||
// Now add the two variations of System32
|
||||
baseDirectories.Add(Environment.GetFolderPath(Environment.SpecialFolder.System));
|
||||
|
@ -327,7 +326,7 @@ namespace System.Management.Automation
|
|||
{
|
||||
baseDirectories.Add(systemX86);
|
||||
}
|
||||
|
||||
#endif
|
||||
// And built-in modules
|
||||
string progFileDir;
|
||||
// TODO: #1184 will resolve this work-around
|
||||
|
@ -345,9 +344,6 @@ namespace System.Management.Automation
|
|||
baseDirectories.Add(Path.Combine(progFileDir, "PowerShellGet"));
|
||||
baseDirectories.Add(Path.Combine(progFileDir, "Pester"));
|
||||
baseDirectories.Add(Path.Combine(progFileDir, "PSReadLine"));
|
||||
#if CORECLR
|
||||
baseDirectories.Add(Path.Combine(progFileDir, "Json.Net"));
|
||||
#endif // CORECLR
|
||||
}
|
||||
Interlocked.CompareExchange(ref s_productFolderDirectories, baseDirectories.ToArray(), null);
|
||||
}
|
||||
|
|
|
@ -5,11 +5,6 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
[Flags]
|
||||
|
|
|
@ -11,11 +11,6 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, NonSerializedAttribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
#region Exceptions
|
||||
|
@ -225,7 +220,7 @@ namespace System.Management.Automation.Runspaces
|
|||
ReuseThread = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Doesn’t create a new thread; the execution occurs on the
|
||||
/// Doesn't create a new thread; the execution occurs on the
|
||||
/// thread that calls Invoke.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
|
|
|
@ -12,12 +12,6 @@ using System.Text.RegularExpressions;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Globalization;
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
|
|
|
@ -18,12 +18,6 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using Microsoft.PowerShell.Telemetry.Internal;
|
||||
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
#pragma warning disable 1634, 1691 // Stops compiler from warning about unknown warnings
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
|
@ -380,7 +374,7 @@ namespace System.Management.Automation.Runspaces
|
|||
}
|
||||
}
|
||||
|
||||
private static string s_debugPreferenceCachePath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "WindowsPowerShell"), "DebugPreference.clixml");
|
||||
private static string s_debugPreferenceCachePath = Path.Combine(Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "WindowsPowerShell"), "DebugPreference.clixml");
|
||||
private static object s_debugPreferenceLockObject = new object();
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -976,7 +976,7 @@ namespace System.Management.Automation.Host
|
|||
|
||||
internal static string GetTranscriptPath()
|
||||
{
|
||||
string baseDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
string baseDirectory = Platform.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
return GetTranscriptPath(baseDirectory, false);
|
||||
}
|
||||
|
||||
|
@ -984,14 +984,14 @@ namespace System.Management.Automation.Host
|
|||
{
|
||||
if (String.IsNullOrEmpty(baseDirectory))
|
||||
{
|
||||
baseDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
baseDirectory = Platform.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Path.IsPathRooted(baseDirectory))
|
||||
{
|
||||
baseDirectory = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
|
||||
Platform.GetFolderPath(Environment.SpecialFolder.MyDocuments),
|
||||
baseDirectory);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,6 @@ using System.Reflection;
|
|||
using System.Runtime.Serialization;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
#region DataAddedEventArgs
|
||||
|
|
|
@ -9,11 +9,6 @@ using System.Runtime.Serialization;
|
|||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, SystemException, ThreadAbortException and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
#region Exceptions
|
||||
|
|
|
@ -16,11 +16,6 @@ using Dbg = System.Management.Automation.Diagnostics;
|
|||
using System.Diagnostics;
|
||||
using Microsoft.Management.Infrastructure;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, NoSerializedAttribute, SystemException, ThreadAbortException and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
#pragma warning disable 1634, 1691 // Stops compiler from warning about unknown warnings
|
||||
|
||||
namespace System.Management.Automation
|
||||
|
|
|
@ -126,11 +126,7 @@ namespace System.Management.Automation.Runspaces
|
|||
|
||||
_startInfo.UserName = netCredential.UserName;
|
||||
_startInfo.Domain = string.IsNullOrEmpty(netCredential.Domain) ? "." : netCredential.Domain;
|
||||
#if CORECLR
|
||||
_startInfo.PasswordInClearText = ClrFacade.ConvertSecureStringToString(credential.Password);
|
||||
#else
|
||||
_startInfo.Password = credential.Password;
|
||||
#endif
|
||||
}
|
||||
|
||||
Process = new Process { StartInfo = _startInfo, EnableRaisingEvents = true };
|
||||
|
|
|
@ -4,17 +4,11 @@ Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
||||
using System.Threading;
|
||||
using PSHost = System.Management.Automation.Host.PSHost;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Management.Automation.Internal;
|
||||
using System.Management.Automation.Runspaces.Internal;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, NonSerializedAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
#region Exceptions
|
||||
|
|
|
@ -19,10 +19,6 @@ using System.Linq.Expressions;
|
|||
using Microsoft.Scripting.Ast;
|
||||
#endif
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SpecialNameAttribute
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
|
||||
|
@ -117,7 +113,6 @@ namespace System.Management.Automation.Interpreter
|
|||
}
|
||||
}
|
||||
|
||||
#if !CORECLR // Thread.Abort and ThreadAbortException are not in CoreCLR.
|
||||
/// <summary>
|
||||
/// To get to the current AbortReason object on Thread.CurrentThread
|
||||
/// we need to use ExceptionState property of any ThreadAbortException instance.
|
||||
|
@ -153,14 +148,6 @@ namespace System.Management.Automation.Interpreter
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
/// A thread cannot be aborted in CoreCLR, as Thread.Abort() is not available in CoreCLR (neither is ThreadAbortException).
|
||||
/// So this method doesn't need to do anything when running with CoreCLR
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void AbortThreadIfRequested(InterpretedFrame frame, int targetLabelIndex) { }
|
||||
#endif
|
||||
|
||||
internal int ReturnAndRethrowLabelIndex
|
||||
{
|
||||
|
|
|
@ -19,10 +19,6 @@ using System.Linq;
|
|||
using System.Linq.Expressions;
|
||||
#endif
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for Serializable attribute and SystemException
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
|
|
@ -22,11 +22,6 @@ using System.Collections.Generic;
|
|||
using System.Runtime.CompilerServices;
|
||||
using AstUtils = System.Management.Automation.Interpreter.Utils;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for IRuntimeVariables.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Interpreter
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for IRuntimeVariables.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Interpreter
|
||||
{
|
||||
internal sealed class RuntimeVariables : IRuntimeVariables
|
||||
|
|
|
@ -17,11 +17,6 @@ using System.Management.Automation.Language;
|
|||
using System.Management.Automation.Runspaces;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SystemException and SerializationInfo
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
#pragma warning disable 1634, 1691 // Stops compiler from warning about unknown warnings
|
||||
|
||||
namespace System.Management.Automation
|
||||
|
|
|
@ -19,11 +19,6 @@ using System.Management.Automation.Runspaces;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for Serializable attribute and SerializationInfo
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -265,7 +265,7 @@ namespace System.Management.Automation.Language
|
|||
Type type = ast.TypeName.GetReflectionType();
|
||||
if (type != null)
|
||||
{
|
||||
Diagnostics.Assert(!(type.GetTypeInfo() is TypeBuilder), "ReflectionType can never be TypeBuilder");
|
||||
Diagnostics.Assert(!(type is TypeBuilder), "ReflectionType can never be TypeBuilder");
|
||||
}
|
||||
return AstVisitAction.Continue;
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ namespace System.Management.Automation.Language
|
|||
_typeBuilder = module.DefineType(typeName, Reflection.TypeAttributes.Class | Reflection.TypeAttributes.Public, baseClass, interfaces.ToArray());
|
||||
_staticHelpersTypeBuilder = module.DefineType(string.Format(CultureInfo.InvariantCulture, "{0}_<staticHelpers>", typeName), Reflection.TypeAttributes.Class);
|
||||
DefineCustomAttributes(_typeBuilder, typeDefinitionAst.Attributes, _parser, AttributeTargets.Class);
|
||||
_typeDefinitionAst.Type = _typeBuilder.AsType();
|
||||
_typeDefinitionAst.Type = _typeBuilder;
|
||||
|
||||
_fieldsToInitForMemberFunctions = new List<Tuple<string, object>>();
|
||||
_definedMethods = new Dictionary<string, List<Tuple<FunctionMemberAst, Type[]>>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
@ -582,7 +582,7 @@ namespace System.Management.Automation.Language
|
|||
|
||||
if (hasValidateAttributes)
|
||||
{
|
||||
var typeToLoad = _typeBuilder.AsType();
|
||||
Type typeToLoad = _typeBuilder;
|
||||
setIlGen.Emit(OpCodes.Ldtoken, typeToLoad);
|
||||
setIlGen.Emit(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle")); // load current Type on stack
|
||||
setIlGen.Emit(OpCodes.Ldstr, propertyMemberAst.Name); // load name of Property
|
||||
|
@ -703,14 +703,14 @@ namespace System.Management.Automation.Language
|
|||
|
||||
private bool MethodExistsOnBaseClassAndFinal(string methodName, Type[] parameterTypes)
|
||||
{
|
||||
TypeInfo baseType = _typeBuilder.BaseType.GetTypeInfo();
|
||||
Type baseType = _typeBuilder.BaseType;
|
||||
|
||||
// If baseType is PS class, then method will be virtual, once we define it.
|
||||
if (baseType is TypeBuilder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var mi = baseType.AsType().GetMethod(methodName, parameterTypes);
|
||||
var mi = baseType.GetMethod(methodName, parameterTypes);
|
||||
return mi != null && mi.IsFinal;
|
||||
}
|
||||
|
||||
|
@ -1159,16 +1159,16 @@ namespace System.Management.Automation.Language
|
|||
|
||||
foreach (var helper in defineTypeHelpers)
|
||||
{
|
||||
Diagnostics.Assert(helper._typeDefinitionAst.Type.GetTypeInfo() is TypeBuilder, "Type should be the TypeBuilder");
|
||||
Diagnostics.Assert(helper._typeDefinitionAst.Type is TypeBuilder, "Type should be the TypeBuilder");
|
||||
bool runtimeTypeAssigned = false;
|
||||
if (!helper.HasFatalErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = helper._typeBuilder.CreateTypeInfo().AsType();
|
||||
var type = helper._typeBuilder.CreateType();
|
||||
helper._typeDefinitionAst.Type = type;
|
||||
runtimeTypeAssigned = true;
|
||||
var helperType = helper._staticHelpersTypeBuilder.CreateTypeInfo().AsType();
|
||||
var helperType = helper._staticHelpersTypeBuilder.CreateType();
|
||||
|
||||
if (helper._fieldsToInitForMemberFunctions != null)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ using System.Linq;
|
|||
using System.Management.Automation.Language;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
@ -25,7 +26,6 @@ using Microsoft.PowerShell.Commands;
|
|||
#if !CORECLR
|
||||
// System.DirectoryServices are not in CoreCLR
|
||||
using System.DirectoryServices;
|
||||
using System.Net.Mail;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Language
|
||||
|
@ -803,14 +803,14 @@ namespace System.Management.Automation
|
|||
{ typeof(X500DistinguishedName), new[] { "X500DistinguishedName" } },
|
||||
{ typeof(XmlDocument), new[] { "xml" } },
|
||||
{ typeof(CimSession), new[] { "CimSession" } },
|
||||
{ typeof(MailAddress), new[] { "mailaddress" } },
|
||||
#if !CORECLR
|
||||
// Following types not in CoreCLR
|
||||
{ typeof(DirectoryEntry), new[] { "adsi" } },
|
||||
{ typeof(DirectorySearcher), new[] { "adsisearcher" } },
|
||||
{ typeof(ManagementClass), new[] { "wmiclass" } },
|
||||
{ typeof(ManagementObject), new[] { "wmi" } },
|
||||
{ typeof(ManagementObjectSearcher), new[] { "wmisearcher" } },
|
||||
{ typeof(MailAddress), new[] { "mailaddress" } }
|
||||
{ typeof(ManagementObjectSearcher), new[] { "wmisearcher" } }
|
||||
#endif
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2624,7 +2624,7 @@ namespace System.Management.Automation.Language
|
|||
// 2. TypeBuilder
|
||||
// 3. RuntimeType
|
||||
// We also allow wipe type (assign to null), because there could be errors.
|
||||
Diagnostics.Assert(value == null || _type == null || _type.GetTypeInfo() is TypeBuilder, "Type must be assigned only once to RuntimeType");
|
||||
Diagnostics.Assert(value == null || _type == null || _type is TypeBuilder, "Type must be assigned only once to RuntimeType");
|
||||
_type = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,6 @@ using System.Management.Automation.Internal;
|
|||
using System.Runtime.Serialization;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, NonSerializedAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -733,12 +728,10 @@ namespace System.Management.Automation
|
|||
{
|
||||
RegexOptions regexOptions = RegexOptions.Singleline;
|
||||
|
||||
#if !CORECLR // RegexOptions.Compiled is not in CoreCLR
|
||||
if ((options & WildcardOptions.Compiled) != 0)
|
||||
{
|
||||
regexOptions |= RegexOptions.Compiled;
|
||||
}
|
||||
#endif
|
||||
if ((options & WildcardOptions.IgnoreCase) != 0)
|
||||
{
|
||||
regexOptions |= RegexOptions.IgnoreCase;
|
||||
|
|
|
@ -18,11 +18,6 @@ using System.Text;
|
|||
using Microsoft.PowerShell.Commands;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SystemException, SerializationInfo and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
// Stops compiler from warning about unknown warnings
|
||||
#pragma warning disable 1634, 1691
|
||||
|
||||
|
|
|
@ -14,11 +14,6 @@ using System.Management.Automation.Tracing;
|
|||
using System.Management.Automation.Language;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
// Stops compiler from warning about unknown warnings
|
||||
#pragma warning disable 1634, 1691
|
||||
|
||||
|
|
|
@ -13,11 +13,6 @@ using System.Security;
|
|||
using System.Threading;
|
||||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for ThreadAbortException.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
// Stops compiler from warning about unknown warnings
|
||||
#pragma warning disable 1634, 1691
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@ using System.IO;
|
|||
using System.Collections;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SerializationInfo and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
// Stops compiler from warning about unknown warnings
|
||||
#pragma warning disable 1634, 1691
|
||||
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
using System.Runtime.Serialization;
|
||||
using System.Management.Automation.Remoting;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SecurityPermissionAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
|
|
|
@ -27,13 +27,6 @@ using System.Security;
|
|||
using System.Collections.Generic;
|
||||
using System.Security.Principal;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
#region Register-PSSessionConfiguration cmdlet
|
||||
|
|
|
@ -10,13 +10,6 @@ using System.Diagnostics;
|
|||
using System.Management.Automation.Internal;
|
||||
using System.Globalization;
|
||||
|
||||
#if CORECLR
|
||||
// Some APIs are missing from System.Environment. We use System.Management.Automation.Environment as a proxy type:
|
||||
// - for missing APIs, System.Management.Automation.Environment has extension implementation.
|
||||
// - for existing APIs, System.Management.Automation.Environment redirect the call to System.Environment.
|
||||
using Environment = System.Management.Automation.Environment;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
using System.Collections;
|
||||
using System.Management.Automation.Runspaces;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for ICloneable type.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -10,11 +10,6 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using Dbg = System.Diagnostics.Debug;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Remoting
|
||||
{
|
||||
[SerializableAttribute]
|
||||
|
|
|
@ -4,13 +4,7 @@
|
|||
|
||||
using System.Runtime.Serialization;
|
||||
using System.Management.Automation.Internal;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute, SecurityPermissionAttribute and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Remoting
|
||||
{
|
||||
|
|
|
@ -13,11 +13,6 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Runtime.Serialization;
|
||||
using Microsoft.PowerShell;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for SerializableAttribute, SerializationInfo and ISerializable related types.
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation.Remoting
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -650,7 +650,7 @@ namespace System.Management.Automation
|
|||
// on Remoting in PowerShell engine
|
||||
try
|
||||
{
|
||||
string personalfolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
string personalfolder = Platform.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
args.Runspace.ExecutionContext.EngineSessionState.SetLocation(personalfolder);
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
|
@ -18,11 +18,6 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.PowerShell.Telemetry.Internal;
|
||||
|
||||
#if CORECLR
|
||||
// Use stub for Serializable attribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
internal enum CompileInterpretChoice
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.Management.Automation.Internal;
|
|||
using System.Management.Automation.Language;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Management.Automation.Tracing;
|
||||
using System.Net.Mail;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
|
@ -25,13 +26,6 @@ using Microsoft.PowerShell.Commands;
|
|||
using Dbg = System.Management.Automation.Diagnostics;
|
||||
using System.Management.Automation.Remoting;
|
||||
|
||||
#if CORECLR
|
||||
// Use stubs for SerializableAttribute and ISerializable related types
|
||||
using Microsoft.PowerShell.CoreClr.Stubs;
|
||||
#else
|
||||
using MailAddress = System.Net.Mail.MailAddress;
|
||||
#endif
|
||||
|
||||
namespace System.Management.Automation
|
||||
{
|
||||
[Flags]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue