Compare commits

...

224 Commits

Author SHA1 Message Date
Aditya Patwardhan
e7a4de5da4
Update to .NET 6.0.410 (#19798)
* Update to .NET 6.0.410

* Update wix

* Update wix

---------

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2023-06-14 13:19:24 -07:00
Travis Plunk
e26717af2f
Always regenerate files wxs fragment (#19803)
* Always regenerate files wxs fragment (#19196)

* update bom
2023-06-14 12:25:26 -07:00
Travis Plunk
081dff0e3d Add prompt to fix conflict during backport (#19583)
* Add prompt to fix conflicts

* Add function to backport all approved PRs

* Update tools/releaseTools.psm1

Co-authored-by: Dongbo Wang <dongbow@microsoft.com>

* Update tools/releaseTools.psm1

---------

Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2023-06-13 21:51:48 -07:00
Travis Plunk
adf2729aaa Add backport function to release tools (#19568)
* Add backport function

* delete backport action
2023-06-13 21:50:59 -07:00
Aditya Patwardhan
28c6dd4aa5 Do not remove penimc_cor3.dll from build (#18438) 2023-06-13 21:47:41 -07:00
Aditya Patwardhan
733295b59a Remove unnecessary native dependencies from the package (#18213) 2023-06-13 21:45:44 -07:00
Travis Plunk
814feb6120 Delete symbols on Linux as well (#19735) 2023-06-13 17:42:58 -07:00
dependabot[bot]
90b4504aac Bump Microsoft.PowerShell.MarkdownRender (#19751) 2023-06-13 17:42:22 -07:00
Aditya Patwardhan
40c341c8f4
Backport compliance changes (#19719) 2023-05-26 22:07:31 +00:00
Travis Plunk
7c4fd5b29a
Delete charset regex test (#19585) 2023-05-05 11:48:04 -07:00
Travis Plunk
17da21af20
Fix issue with merge of 19068 (#19586) 2023-04-28 10:50:46 -07:00
Travis Plunk
2cc2d9c579
Update the team member list in releaseTools.psm1 (#19574)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2023-04-27 15:03:09 -07:00
Travis Plunk
7d90d3f959
Verify that packages have license data (#19543) (#19575) 2023-04-27 15:01:48 -07:00
Travis Plunk
28000fa8e4
Update experimental-feature.json (#19581)
* [release/v7.2.12] Update experimental-feature-linux.json

* Update experimental-feature-windows.json
2023-04-27 14:56:42 -07:00
Travis Plunk
a447e4498d
Fix the regex used for package name check in vPack build (#19573)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2023-04-27 10:11:21 -07:00
Travis Plunk
32e766aa3e
Make the vPack PAT library more obvious (#19572) 2023-04-27 10:10:45 -07:00
Travis Plunk
cd753e616e
Add an explicit manual stage for changelog update (#19551) (#19567)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2023-04-26 09:48:35 -07:00
Dongbo Wang
252ba19ba6 Merged PR 25348: Fix the template that creates GitHub draft release
Fix the template that creates GitHub draft release
2023-04-13 17:40:25 +00:00
Dongbo Wang
395b941071 Merged PR 25324: Update the changelog for v7.2.11 release
Update the changelog for v7.2.11 release
2023-04-12 22:14:33 +00:00
Dongbo Wang
183e2411a5 Update ThirdPartyNotices.txt 2023-04-11 17:55:12 -07:00
Dongbo Wang
e08f9eeeb6 Update cgmanifest.json 2023-04-11 17:46:57 -07:00
Dongbo Wang
f728e44c5b Fix the template that creates nuget package 2023-04-11 17:03:00 -07:00
Dongbo Wang
7c8152dafb Update the wix file 2023-04-11 13:56:05 -07:00
Dongbo Wang
84ff770ba7 Update .NET SDK to 6.0.408 2023-04-11 12:11:51 -07:00
Dongbo Wang
2e14410d15 Try to fix the build 2023-04-10 10:34:34 -07:00
Aditya Patwardhan
1aa4a36a5e Fix stage dependencies and typo in release build (#19353) 2023-04-07 11:50:31 -07:00
Aditya Patwardhan
ab0e9d58fa Fix issues in release build and release pipeline (#19338) 2023-04-07 11:50:24 -07:00
Aditya Patwardhan
1c7ec2f582 Restructure the package build to simplify signing and packaging stages (#19321) 2023-04-07 11:50:09 -07:00
Aditya Patwardhan
8450602d59 Skip VT100 tests on Windows Server 2012R2 as console does not support it (#19413) 2023-04-07 11:47:34 -07:00
James Truher [MSFT]
9fc8642474 Improve package management acceptance tests by not going to the gallery (#19412) 2023-04-07 11:46:26 -07:00
Aditya Patwardhan
dd76e4721b Test fixes for stabilizing tests (#19068) 2023-04-07 11:45:51 -07:00
Anam Navied
510461f0f6 Add stage for symbols job in Release build (#18937) 2023-04-07 11:39:59 -07:00
Aditya Patwardhan
347dfa3ad1 Use reference assemblies generated by dotnet (#19302) 2023-04-07 11:39:26 -07:00
Travis Plunk
20f62f4420 Add URL for all distributions (#19159)
* Add URL for all distributions

* Make url compatible
2023-04-07 11:39:10 -07:00
Aditya Patwardhan
61465c9c6d Update release pipeline to use Approvals and automate some manual tasks (#17837) 2023-04-07 11:37:40 -07:00
Patrick Meinecke
8b780f2718 Merged PR 24461: Update changelog for v7.2.10 2023-02-23 23:47:45 +00:00
Andrew
0413ffd2ab
Fixed package names verification to support multi-digit versions (#17220)
Fixed package names verification to support multi-digit versions.

Currently "Validate RPM package names" release step is failing because of version "7.0.10" in these examples:
WARNING: powershell-7.0.10-1.centos.8.x86_64.rpm is not a valid package name
WARNING: powershell-7.0.10-1.rhel.7.x86_64.rpm is not a valid package name
WARNING: powershell-lts-7.0.10-1.centos.8.x86_64.rpm is not a valid package name
WARNING: powershell-lts-7.0.10-1.rhel.7.x86_64.rpm is not a valid package name
2023-02-21 18:28:53 -05:00
Patrick Meinecke
11af035aab Merged PR 24413: Add pipeline secrets (from #17837) 2023-02-21 23:13:06 +00:00
Travis Plunk
8fcfe41978
Update to azCopy 10 (#18509) 2023-02-21 16:37:00 -05:00
Patrick Meinecke
a73ae1ad89 Merged PR 24346: Update third party notices for v7.2.10 2023-02-16 20:41:46 +00:00
Patrick Meinecke
8ded9a8e45 Merged PR 24333: Update cgmanifest for v7.2.10
Update cgmanifest for v7.2.10
2023-02-16 14:58:50 +00:00
Patrick Meinecke
ba4a71948a Merged PR 24325: Pull latest patches for 7.2.10 dependencies 2023-02-15 21:28:35 +00:00
Patrick Meinecke
3ddd25fdd8 Merged PR 24324: Update SDK to 6.0.406 for v7.2.10
Update `global.json` to `6.0.406` for servicing release v7.2.10
2023-02-15 20:44:49 +00:00
Travis Plunk
caede6fe99
Add test for framework dependent package in release pipeline (#18506) (#19114) 2023-02-07 22:05:45 +00:00
Aditya Patwardhan
4fd81ac0cf
Mark 7.2.x releases as latest LTS but not latest stable (#19069) 2023-02-01 16:15:35 -08:00
Travis Plunk
64c9f03acb Merged PR 23958: Add 7.2.9 changelog
Add 7.2.9 changelog
2023-01-24 17:12:23 +00:00
github-actions[bot]
5535e22345 Create test artifacts for windows arm64 (#18932)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2023-01-11 13:17:49 -08:00
Travis Plunk
9b022669b2 Merged PR 23821: Fix for JEA session leaking functions
Related work items: #152543
2023-01-11 01:11:38 +00:00
Travis Plunk
2a23f51bac Merged PR 23816: Update dependencies for .NET release
Update dependencies for .NET release
2023-01-11 00:24:45 +00:00
Travis Plunk
0dcef011e4 Merged PR 23819: Fix for JEA session leaking functions
Related work items: #152543
2023-01-11 00:07:10 +00:00
github-actions[bot]
bf9e56f1cc
Correct incorrect cmdlet name in script (#18919)
Co-authored-by: Nicklas Bjälemark <nicklas.bjalemark@aditro.com>
2023-01-10 14:16:05 -08:00
github-actions[bot]
8b1e1f0518
Don't install based on build-id for RPM (#18921)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2023-01-10 13:47:20 -08:00
github-actions[bot]
e2e23e318d
[release/v7.2.9] Apply expected file permissions to linux files after authenticode signing (#18922)
* Upload linux artifacts as tar.gz to preserve linux file permissions

* Fix conditions

* Fix yaml

* Fix paths for downloaded artifacts

* Rename while downloading

* Fix file names and paths

* Fix tar compress

* Add set-location before tar

* Create dirs before expanding

* Create dir before expanding

* Fix conditions

* Add logging

* Export file permission to json

* Fix for condition

* Apply file permissions before packaging

* Add logging

* Fix issues

* Add comments

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2023-01-10 13:46:31 -08:00
github-actions[bot]
8306762644
[release/v7.2.9] Add authenticode signing for assemblies on linux builds (#18920)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2023-01-10 11:59:46 -08:00
Travis Plunk
b9296ad7ce Merged PR 23538: Change log for 7.2.8
Add generated 7.2 change log
2022-12-13 15:53:52 +00:00
travis plunk
e0ef892ce8 Update CGManifest and ThirdPartyNotices 2022-11-18 10:37:47 -08:00
Travis Plunk
8d46305005 Merged PR 23294: Remove TabExpansion from remote session configuration 2022-11-18 05:07:52 +00:00
travis plunk
28514a7ac7 Update Microsoft.CSharp from 4.3.0 to 4.7.0 2022-11-17 16:42:20 -08:00
Travis Plunk
6254680453
[release/v7.2.8] Update to latest SDK (#18610)
* Update to latest SDK

* Update wix
2022-11-17 14:36:48 -08:00
github-actions[bot]
07ca0cd99f
Allow two-digit revisions in vPack package validation pattern (#18569)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-11-17 12:09:27 -08:00
Travis Plunk
38877e52ec
Update outdated dependencies (#18576) 2022-11-17 12:08:35 -08:00
github-actions[bot]
ab878abfc9
Work around args parsing issue (#18606)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-11-17 19:16:23 +00:00
dependabot[bot]
14851187aa Bump System.Data.SqlClient from 4.8.4 to 4.8.5 in /src/Microsoft.PowerShell.SDK (#18515)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts:
#	src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj
2022-11-15 14:03:34 -08:00
Aditya Patwardhan
978d190594 Merged PR 22914: Changelog for v7.2.7
Change log for v7.2.7
2022-10-20 18:07:39 +00:00
Travis Plunk
205fe1308d
Update cgmanifest (#18319) 2022-10-17 15:43:02 -07:00
Aditya Patwardhan
4ad82b014a
Bump .NET to version 6.0.402 (#18290)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-10-17 11:10:35 -07:00
github-actions[bot]
8259ed4903
[release/v7.2.7] Use Ubuntu 20.04 for SSH remoting test (#18289)
* Use Ubuntu 20.04 for SSH remoting test yaml

* Trigger the ssh remoting test run

* Trigger the ssh remoting test run -2

* Revert the test changes

Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2022-10-14 16:37:58 -07:00
Travis Plunk
e9bada725c
[release/v7.2.7] Fix build.psm1 to find the required .NET SDK version when a higher version is installed (#17299) (#18282)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2022-10-13 16:06:06 -07:00
Travis Plunk
6540a954dd
[release/v7.2.7] On Unix, only explicitly terminate the native process if not in background (#18280)
Co-authored-by: Steve Lee <slee@microsoft.com>
2022-10-13 16:04:46 -07:00
Dongbo Wang
b8602c8034
[release/v7.2.7] Backport of "Fix error formatting to use color defined in $PSStyle.Formatting" (#18287) 2022-10-13 16:02:37 -07:00
github-actions[bot]
8753721320
[release/v7.2.7] Update MSI exit message (#18173)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-10-13 12:39:15 -07:00
github-actions[bot]
5e182aca5a
[release/v7.2.7] Remove XML files for min-size package (#18274)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2022-10-13 12:35:20 -07:00
github-actions[bot]
50ace4032a
[release/v7.2.7] Update list of PS team members in release tools (#18171)
Co-authored-by: Patrick Meinecke <seeminglyscience@gmail.com>
2022-10-13 12:24:07 -07:00
github-actions[bot]
f47f40ff15
[release/v7.2.7] Make the link to minimal package blob public during release (#18174)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2022-10-13 11:49:55 -07:00
github-actions[bot]
703702d879
[release/v7.2.7] Add XML reference documents to NuPkg files for SDK (#18172)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2022-10-13 11:47:19 -07:00
github-actions[bot]
17d19d95b3
[release/v7.2.7] Remove 1s minimum delay in Invoke-WebRequest for small files, and prevent file-download-error suppression. (#18170)
Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
Co-authored-by: Abin Abraham Alichan <abinaa@microsoft.com>
Co-authored-by: Abin <3484074+AAATechGuy@users.noreply.github.com>
2022-10-13 11:29:41 -07:00
Travis Plunk
119bd6d9b6
[release/v7.2.7] Update to use version 2.21.0 of Application Insights (#18271)
Replaces dependabot PR #17733

Co-authored-by: James Truher [MSFT] <jimtru@microsoft.com>
2022-10-13 11:28:47 -07:00
github-actions[bot]
b73123033c
[release/v7.2.7] Enable searching for assemblies in GAC_Arm64 on Windows (#18169)
Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Steve Lee <slee@microsoft.com>
2022-10-13 10:34:15 -07:00
James Truher [MSFT]
c27239afdd
Remove ApplicationType telemetry sends. (#18168) 2022-09-30 16:45:27 -07:00
Aditya Patwardhan
6906f788fb
Bump to .NET SDK 6.0.401 (#18188) 2022-09-30 13:35:48 -07:00
Aditya Patwardhan
5d4b1b760d Merged PR 22095: Changelog for v7.2.6
Changelog for v7.2.6
2022-08-11 00:17:35 +00:00
Aditya Patwardhan
eb2c4accdd Update Wix manifest 2022-08-10 11:38:46 -07:00
Aditya Patwardhan
56a6002a84 Merged PR 22065: Update .NET 6 SDK version and xunit packages
Update .NET 6 SDK version and xunit packages
2022-08-10 17:00:57 +00:00
Aditya Patwardhan
f153a64400 Fix ForEach-Object -Parallel when passing in script block variable (#16564) (#17860) 2022-08-09 16:01:17 -07:00
Aditya Patwardhan
c446ba0e8b Make Out-String and Out-File keep string input unchanged (#17455) (#17859)
Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
2022-08-09 16:01:12 -07:00
github-actions[bot]
efd3c91b92 Update regex used to remove ANSI escape sequences to be more specific to decoration and hyperlinks (#17822) 2022-08-09 16:01:06 -07:00
github-actions[bot]
54497ba018 Fix legacy ErrorView types to use $host.PrivateData colors (#17823) 2022-08-09 16:01:02 -07:00
github-actions[bot]
6caf475f55 Disable RPM SBOM test. (#17821) 2022-08-09 16:00:57 -07:00
github-actions[bot]
d475414ef2 Fix Export-PSSession to not throw error when a rooted path is specified for -OutputModule (#17819) 2022-08-09 16:00:53 -07:00
github-actions[bot]
f432a77ab1 Add AppX capabilities in MSIX manifest so that PS7 can call the AppX APIs (#17820)
Co-authored-by: Steve Lee (POWERSHELL) <slee@microsoft.com>
2022-08-09 16:00:44 -07:00
Aditya Patwardhan
da96d2f7c6 Use Quality only with Channel in dotnet-install (#17847) 2022-08-09 16:00:39 -07:00
Tamás Vajk
d29f7a7035 Fix build.psm1 to not specify both version and quality for dotnet-install (#17589) 2022-08-09 16:00:30 -07:00
Aditya Patwardhan
3800e0cdef Install .NET 3.1 as it is required by the vPack task 2022-06-21 12:06:48 -07:00
Aditya Patwardhan
7a0eb645c7 Merged PR 21268: Changelog for release v7.2.5
Changelog for release v7.2.5
2022-06-21 00:44:09 +00:00
Aditya Patwardhan
0aad398b0e Merged PR 21242: Update Wix file
Update Wix file
2022-06-15 17:00:58 +00:00
Aditya Patwardhan
b29d5dc8db Conditionally add output argument 2022-06-14 16:55:30 -07:00
Aditya Patwardhan
b124d1815d Merged PR 21218: Update global.json for release of v7.2.5
Update global.json for release of v7.2.5
2022-06-14 22:51:10 +00:00
Travis Plunk
cf527b23d9
Rename mariner package to cm (#17506) 2022-06-13 09:58:39 -07:00
github-actions[bot]
d8d1d788b8
Fix native library loading for osx-arm64 (#17495)
Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
2022-06-07 17:55:32 +00:00
github-actions[bot]
f518f0bc4c
Make Assembly Load Native test work on a FX Dependent Linux Install (#17496)
* Make Assembly Load Native test work on a FX Dependent Linux Install

* Update Assembly.LoadNative.Tests.ps1

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-06-07 17:54:40 +00:00
Travis Plunk
ff8311ec60
Backport test fixes for 7.2 (#17494) 2022-06-07 10:39:13 -07:00
Travis Plunk
896466b206
Update dotnet-runtime version (#17472) 2022-06-02 15:23:11 -07:00
James Truher [MSFT]
f1cb6d6b63 Enable more tests to be run in a container. (#17294) 2022-06-01 11:11:09 -07:00
github-actions[bot]
a3385b92e3
Update to use windows-latest as the build agent image (#17418)
* Update to use 'windows-latest' as the build agent image

* Update additional files

* debug test failures

* Added some more wincompat debug info

* Added some more wincompat debug info 2

* Stabilizing some wincompat tests when they are run on OS with compatibility-bugged WindowsPS buitin modules

* Stabilizing some wincompat tests

* Add verbose message to 'Enable-WSManCredSSP' test

* More debugging

* Make the 'Enable-WSManCredSSP' test more stable

* Address feedback

* remove broken tests

* Fix Spelling

* remove more broken TLS tests

* remove broken tests

Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
Co-authored-by: unknown <anmenaga@microsoft.com>
Co-authored-by: Travis Plunk <github@ez13.net>
2022-06-01 10:31:28 -07:00
github-actions[bot]
24acc42d9a
Publish preview versions of mariner to preview repo (#17464)
* Update mapping.json

* Update mapping.json

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-05-31 12:15:56 -07:00
Travis Plunk
72492008c6 Switch to using GitHub action to verify markdown links for PRs (#17281) 2022-05-31 11:55:32 -07:00
Travis Plunk
30aa6c7d26 Move cgmanifest generation to daily (#17258)
* Move cgmanifest generation to daily

* fix PR title
2022-05-31 11:20:18 -07:00
Travis Plunk
5c804e2445 Fix mariner mappings (#17413) 2022-05-31 11:11:48 -07:00
github-actions[bot]
0fe19c1136
Try to stabilize a few tests that fail intermittently (#17426) 2022-05-26 10:03:35 -07:00
github-actions[bot]
580816a575
Make sure we execute tests on LTS package for older LTS releases (#17430)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2022-05-24 16:06:39 -07:00
github-actions[bot]
71843e7236
Add a finalize template which causes jobs with issues to fail (#17428)
Co-authored-by: travis plunk <github@ez13.net>
2022-05-24 16:03:44 -07:00
github-actions[bot]
865394022e
Make mariner packages Framework dependent (#17425) 2022-05-24 13:57:10 -07:00
Travis Plunk
3cfa8eb258
Base work for adding mariner amd64 package (#17417)
Backport #17057
2022-05-24 13:17:15 -07:00
Travis Plunk
8af2f5c611
TLS test fix back-port (#17424)
Cherry-pick part of #17061
2022-05-24 13:13:44 -07:00
Paul Higinbotham
0739d311e1 Merged PR 20757: Update change log for v7.2.4
Update change log for v7.2.4
2022-05-13 18:20:12 +00:00
Anam Navied
209dcc18e2 Add mapping for ubuntu22.04 jammy (#17317) 2022-05-11 12:40:45 -07:00
Travis Plunk
284e7a9fc9 Update to use mcr.microsoft.com (#17272) 2022-05-11 10:30:38 -07:00
PaulHigin
0289c90bee Update third party notices 2022-05-10 13:29:13 -07:00
PaulHigin
960b751680 Update global.json and wix 2022-05-10 13:19:43 -07:00
Travis Plunk
a2c0eba8b2 Put Secure supply chain analysis at correct place (#17273)
* Update releaseBuild.yml

* Add nuget security analysis to where it should be

* Add a display name

* Update tools/releaseBuild/azureDevOps/releaseBuild.yml

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2022-05-09 14:59:24 -07:00
Steve Lee
10230139bf Fix web cmdlets so that an empty Get does not include a content-length header (#16587) 2022-05-09 10:38:51 -07:00
github-actions[bot]
472fcf1296
Update package fallback list for Ubuntu (from those updated for Ubuntu 22.04) (deb) (#17217)
* update package fallback list for ubuntu 22.04 (deb)

* Update tools/packaging/packaging.psm1

* Update tools/packaging/packaging.psm1

Co-authored-by: Anam Navied <anam.naviyou@gmail.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2022-04-28 17:18:36 -07:00
github-actions[bot]
4790f2ee8f
Add sha256 digests to RPM packages (#17215)
Co-authored-by: Nick Hall <nhall@optumserve.com>
2022-04-28 17:11:57 -07:00
github-actions[bot]
8da37f9005
Allow multiple installations of dotnet. (#17216)
* Allow multiple installations of dotnet.

A new flag for removal is now provided, but by default we will add a new version of dotnet.

* Add updated CG manifest.

Co-authored-by: James Truher <jimtru@microsoft.com>
2022-04-28 17:10:24 -07:00
Andrew Menagarishvili
4f25173d97 Merged PR 20440: Changelog for v7.2.3
Changelog for 7.2.3
2022-04-26 22:51:37 +00:00
Andrew Menagarishvili
cfae544379 Merged PR 20239: Making NameObscurerTelemetryInitializer internal - v7.2.3
Making NameObscurerTelemetryInitializer internal
2022-04-15 19:46:00 +00:00
Andrew Menagarishvili
f3e89938a4 Merged PR 20211: Updated files.wxs for 7.2.3
Updated files.wxs for 7.2.3
2022-04-14 23:56:15 +00:00
Andrew Menagarishvili
8ddeb47992 Merged PR 20199: Updated ThirdPartyNotices for 7.2.3
Updated ThirdPartyNotices for 7.2.3
2022-04-14 21:39:00 +00:00
travis plunk
dd8638e741 Work around issue with notice generation 2022-04-14 14:19:51 -07:00
travis plunk
4cdec35269 Replace . in notices container name 2022-04-14 14:19:28 -07:00
Andrew Menagarishvili
82b1e39f93 Merged PR 20188: Do not include node names when sending telemetry. (#16981) to v7.2.3
Do not include node names when sending telemetry. (#16981)
https://github.com/PowerShell/PowerShell/pull/16981
2022-04-14 19:13:40 +00:00
Andrew Menagarishvili
603ca22249 Merged PR 20190: Updated cgmanifest.json by findMissingNotices.ps1 in v7.2.3
Updated cgmanifest.json by findMissingNotices.ps1 -Fix
2022-04-14 19:02:47 +00:00
Andrew Menagarishvili
8124f2f9f6 Merged PR 20170: v7.2.3 - Updated packages using dotnet-outdated global tool
Updated
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0" />
to
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.1" />
2022-04-14 16:58:47 +00:00
Andrew Menagarishvili
00bab545dc Merged PR 20128: Updated to .NET 6.0.4 / SDK 6.0.202
Updated to .NET 6.0.4 / SDK 6.0.202
2022-04-13 22:43:50 +00:00
Travis Plunk
5f2bfe1708 Re-enable PowerShellGet tests targeting PowerShell gallery (#17062)
Re-enable `PowerShellGet` tests targeting PowerShell gallery (#17062)

# Conflicts:
#	test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1
2022-04-13 22:05:07 +00:00
Paul Higinbotham
1a5b53a821 Skip failing scriptblock tests (#17093) 2022-04-13 19:08:41 +00:00
Travis Plunk
bd1dabf361 Merged PR 20126: Fix for partial PowerShell module search paths, that can be resolved to CWD locations
The problem is .NET will return empty strings for special folders that don't exist in some accounts (like System account), and the module path code appends path locations without first checking if the root path is non-empty.  This results in partial paths in the PSModulePath list, which are then interpreted by .NET file APIs as rooted in the current working directory.  And this in turn can allow low privilege users to drop modules in locations that higher privilege accounts will load from, thus gaining escalated privilege code execution.

These changes detect this non-rooted condition and prevents partial paths from being included in search lists.

Cherry picked from !17201
2022-04-12 20:29:40 +00:00
Paul Higinbotham
e9302fe82e Merged PR 19951: Update dotnet-install script download link
Update the link for downloading the dotnet-install.ps1 link for CI.
2022-04-04 23:48:31 +00:00
Dongbo Wang
3d0f7f0faf Merged PR 19935: Create checksum file for global tools (#17056)
Cherry-picking the checksum change:
https://github.com/PowerShell/PowerShell/pull/17056
2022-04-04 22:43:34 +00:00
Dongbo Wang
85bb6a0ff3 Merged PR 19625: Make sure global tool packages are published in stable build
Make sure global tool packages are published in stable build
2022-03-17 23:25:37 +00:00
Dongbo Wang
b12290eec0 Merged PR 19617: Fix release pipeline
Fix release pipeline
2022-03-16 21:45:12 +00:00
Dongbo Wang
2bbf08166f Merged PR 19472: Update change log for the v7.2.2 release
Update change log for the v7.2.2 release
2022-03-16 17:35:15 +00:00
Dongbo Wang
9027d1a433 Merged PR 19460: Update wix file
Update wix file
2022-03-08 23:49:32 +00:00
Dongbo Wang
a8f465d53c Merged PR 19457: Update .NET SDK version
Update .NET SDK version
2022-03-08 22:35:12 +00:00
travis plunk
b238eaaad6 update wix file 2022-03-07 18:34:19 -08:00
github-actions[bot]
f1729f9cda Update experimental feature json files (#16838) 2022-03-07 18:26:36 -08:00
Aditya Patwardhan
00917b05f9 Ensure alpine and arm SKUs have powershell.config.json file with experimental features enabled (#16823) 2022-03-07 18:26:21 -08:00
travis plunk
ea630d0b5a Update .NET SDK 2022-03-07 15:40:30 -08:00
Aditya Patwardhan
555dabe02e Update the vmImage and PowerShell root directory for macOS builds (#16611) 2022-03-07 11:15:33 -08:00
Aditya Patwardhan
357c274a26 Update macOS build image and root folder for build (#16609) 2022-03-07 11:15:21 -08:00
Travis Plunk
10aa268c9f Remove WiX install (#16834) 2022-03-07 10:39:07 -08:00
travis plunk
ba6ad1a348 merge 'release/v7.3.0-preview.2' into master
# Conflicts:
#	.spelling
#	CHANGELOG/preview.md
#	tools/releaseBuild/azureDevOps/templates/nuget.yml
2022-03-07 10:35:16 -08:00
travis plunk
f1c0a0dacd Update dependencies 2022-03-07 10:27:25 -08:00
Travis Plunk
7d44bd2f17 opt-in to - name: BUILDSECMON_OPT_IN (#16911)
value: true
Opt in to security monitoring
2022-03-07 10:19:34 -08:00
Paul Higinbotham
d1d92a35c3 Add SBOM manifest to nuget packages (#16711)
# Conflicts:
#	build.psm1
#	tools/cgmanifest.json
2022-03-07 10:19:09 -08:00
Travis Plunk
d2626e6b1a Add Linux package dependencies for packaging (#16807) 2022-03-07 10:13:46 -08:00
Travis Plunk
f5381d5694 Switch to our custom images for build and release (#16801) 2022-03-07 10:12:56 -08:00
Travis Plunk
64ff0fc799 Remove all references to cmake for the builds in this repo (#16578)
# Conflicts:
#	build.psm1
#	test/perf/benchmarks/assets/compiler.test.ps1
2022-03-07 10:12:23 -08:00
Travis Plunk
e6755c0f35 Register NuGet source when generating CGManifest (#16570)
* Register nuget source

* update cgmanifest
2022-03-07 10:09:26 -08:00
Travis Plunk
d1f8bd29ab Update Images used for release (#16580) 2022-03-07 10:08:42 -08:00
Travis Plunk
7744b0aa24 Update SBOM generation (#16641)
# Conflicts:
#	.vsts-ci/misc-analysis/mdSpell.yml
2022-03-04 16:45:49 -08:00
Andrew Menagarishvili
06535b65ec Merged PR 18421: PS 7.2.1 changelog
Initial 7.2.1 changelog
2021-12-09 23:31:54 +00:00
Aditya Patwardhan
89af531d33 Add explicit job name for approval tasks in Snap stage (#16579) 2021-12-08 16:13:07 -08:00
Andrew Menagarishvili
4f19c4d6d3 Merged PR 18399: Fixing the build by removing duplicate TSAUpload entries
Fixing the build by removing duplicate TSAUpload entries
2021-12-08 20:50:06 +00:00
Travis Plunk
ac30fcd388 Merged PR 18402: Port CGmanifest fixes 2021-12-08 20:35:02 +00:00
Travis Plunk
5d47dd4f50 Merged PR 18403: Update CG Manifest
Update CG Manifest
2021-12-08 19:38:22 +00:00
Andrew Menagarishvili
6cc82777e1 Merged PR 18394: Change default for $PSStyle.OutputRendering to Ansi
Cherry picked from !18333
2021-12-07 21:54:57 +00:00
Andrew Menagarishvili
95a974701d Merged PR 18388: Updated package dependencies for 7.2.1
Updated package dependencies
2021-12-07 21:47:57 +00:00
Steve Lee
80c5ddefa0 Remove declaration of experimental features in Utility module manifest as they are stable (#16460) 2021-12-07 13:04:15 -08:00
Travis Plunk
f85ff3a62e Set clean state before testing UseMU in the MSI (#16543) 2021-12-07 13:03:31 -08:00
Aditya Patwardhan
6d4febaa35 Bring back pwsh.exe for framework dependent packages to support Start-Job (#16535)
* Bring back pwsh.exe for framework dependent packages to support Start-Job

* Update wix file

* Add release tests for fxd packages

* Fix tests

* Fix stage dependencies

* Address CR comments

* Fix typo

* Add value for the hashtable item
2021-12-07 13:03:12 -08:00
Sean Wheeler
eeb0b2a9c5 Update HelpInfoUri for 7.2 release (#16456) 2021-12-07 13:01:34 -08:00
Travis Plunk
b2615a3e1a use different containers for different branches (#16434) 2021-12-07 13:00:40 -08:00
Travis Plunk
c6e3f0e2a5 Use notice task to generate license assuming cgmanifest contains all components (#16340)
* Use notice task to generate license assuming cgmanifest contains all components

* fix capture task

* fix output location

* cgmanifest using latest public

* fix additional attributions path

* split into stages to allow retry without restarting

* manually append additional attributions

* remove dead comment

* Revert "cgmanifest using latest public"

This reverts commit 6bed867300.
2021-12-07 13:00:09 -08:00
Travis Plunk
ab9bfcd0e7 Create compliance build (#16286)
Co-authored-by: Robert Holt <rjmholt@gmail.com>
2021-12-07 12:59:37 -08:00
Travis Plunk
c718f8a7ae Update release instructions with link to new build (#16419) 2021-12-07 12:36:41 -08:00
Steve Lee
74065cb4dc Fix typo for "privacy" in MSI installer (#16407) 2021-12-07 12:36:27 -08:00
Travis Plunk
200b99dd68 Add diagnostics used to take corrective action when releasing buildInfoJson (#16404)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2021-12-07 12:35:58 -08:00
Travis Plunk
bcae5e576d vPack release should use buildInfoJson new to 7.2 (#16402) 2021-12-07 12:35:32 -08:00
Travis Plunk
02e11c383f Update change log for 7.2.0 (#16401)
* Merged PR 17994: Update change log for 7.2.0

Update change log for 7.2.0

# Conflicts:
#	.spelling

* add blank change log for 7.3

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2021-12-07 12:34:35 -08:00
Aditya Patwardhan
14a6e8befe Add checkout to build json stage to get ci.psm1 (#16399) 2021-12-07 12:34:19 -08:00
Aditya Patwardhan
972724e575 Update the usage of metadata.json for getting LTS information (#16381) 2021-12-07 12:31:40 -08:00
Travis Plunk
3a2bae9cf8 Move mapping file into product repo and add Debian 11 (#16316) 2021-12-07 12:26:05 -08:00
Aditya Patwardhan
bec5c36d9d Add an approval for releasing build-info json (#16351) 2021-11-01 15:50:34 -07:00
Travis Plunk
282adddf11 Release build info json when it is preview (#16335) 2021-11-01 15:50:13 -07:00
Aditya Patwardhan
dc478202e9 Update metadata.json for v7.2.0 release 2021-11-01 14:39:23 -07:00
Aditya Patwardhan
ef846a0b4a Fix global tool and SDK tests in release pipeline (#16342) 2021-11-01 12:00:24 -07:00
github-actions[bot]
817117621c Update to the latest notices file (#16339)
Co-authored-by: TravisEz13 <TravisEz13@users.noreply.github.com>
2021-11-01 12:00:15 -07:00
Aditya Patwardhan
10314b17db Fix issues in release build (#16332) 2021-11-01 12:00:05 -07:00
Aditya Patwardhan
6b9c3f3bdc Update feed and analyzer dependency (#16327) 2021-11-01 11:59:41 -07:00
github-actions[bot]
4dc1d605ee Update license and cgmanifest (#16325) 2021-11-01 11:58:45 -07:00
Dongbo Wang
9e5e8a2603 Don't throw exception when trying to resolve a possible link path (#16310) 2021-11-01 11:58:34 -07:00
Aditya Patwardhan
66ea6283c6 Update to latest .NET 6 GA build 6.0.100-rtm.21527.11 (#16309) 2021-11-01 11:58:24 -07:00
Travis Plunk
ae238a4035 Add a major-minor build info JSON file (#16301) 2021-11-01 11:58:11 -07:00
Nikolay Kondratyev
1f2edc66ab Fix Windows build ZIP packaging (#16299) 2021-11-01 11:58:00 -07:00
Dongbo Wang
c0339d31bc Clean up crossgen related build scripts also generate native symbols for R2R images (#16297)
* Clean up crossgen related build scripts

* Fix ci.psm1

* Clean up '-CrossGen' use in a few other files
2021-11-01 11:57:43 -07:00
Aditya Patwardhan
5c4b7c0898 Fix issues reported by code signing verification tool (#16291) 2021-11-01 11:57:26 -07:00
Dongbo Wang
f9f9e53a58 Merged PR 17711: Update change log for v7.2.0-rc.1 release
Update change log for v7.2.0-rc.1 release
2021-10-21 17:45:57 +00:00
Dongbo Wang
141bd8154c Merged PR 17704: Fix rpm packaging
Fix rpm packaging to use `$Distribution` instead of the environment check because we are not building rpm packages on a RedHat family machine.
2021-10-21 05:16:47 +00:00
Aditya Patwardhan
aab7bc935a Update ThirdPartyNotices.txt (#16283) 2021-10-20 12:45:09 -07:00
Aditya Patwardhan
f457e7f7e3 Update testartifacts.yml to use ubuntu-latest image (#16279) 2021-10-20 12:44:11 -07:00
Travis Plunk
061dda9f66 Add script to generate cgmanifest.json (#16278) 2021-10-20 12:43:36 -07:00
Aditya Patwardhan
2663bcdde2 Update version of Microsoft.PowerShell.Native and Microsoft.PowerShell.MarkdownRender packages (#16277) 2021-10-20 12:42:45 -07:00
Travis Plunk
7d3420a450 Disallow all COM for AppLocker system lock down (#16268)
Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
2021-10-20 12:39:10 -07:00
Aditya Patwardhan
895515478c Add cgmanifest.json for generating correct third party notice file (#16266) 2021-10-20 12:38:11 -07:00
Travis Plunk
b390ae01f4 Only upload stable buildinfo for stable releases (#16251) 2021-10-18 13:24:51 -07:00
Travis Plunk
b715465168 Don't upload dep or tar.gz for RPM because there are none. (#16230) 2021-10-18 13:21:33 -07:00
Travis Plunk
b3e96b44f5 Make RPM license recognized (#16189) 2021-10-18 13:20:53 -07:00
Aditya Patwardhan
88ccad98c7 Add condition to generate release files in local dev build only (#16259) 2021-10-18 11:09:44 -07:00
Aditya Patwardhan
d297609bb5 Ensure psoptions.json and manifest.spdx.json files always exist in packages (#16258) 2021-10-18 11:08:56 -07:00
Travis Plunk
c3444b931c change order of try-catch-finally and split out arm runs (#16252) 2021-10-18 11:08:23 -07:00
Aditya Patwardhan
b6f24cf69d Update .NET 6 to version 6.0.100-rc.2.21505.57 (#16249) 2021-10-18 11:07:43 -07:00
Andrew
b4de320605 Removed old not-used-anymore docker-based tests for PS release packages (#16224) 2021-10-18 11:07:06 -07:00
Travis Plunk
fe4ce7ec23 Update to vPack task version to 12 (#16250) 2021-10-18 11:06:15 -07:00
Travis Plunk
ecf3b566d1 Configure ApplicationInsights to not send cloud role name (#16246)
Configure ApplicationInsights to not send cloud role name

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2021-10-18 11:05:40 -07:00
Travis Plunk
2134068884 Disallow Add-Type in NoLanguage mode on a locked down machine (#16245) 2021-10-18 11:05:01 -07:00
Travis Plunk
613966fb0a Sign third party exes (#16229) 2021-10-18 11:04:21 -07:00
Dongbo Wang
93a3788e0e Make property names for the color VT sequences consistent with documentations (#16212) 2021-10-18 11:03:35 -07:00
Travis Plunk
6c73fe04e8 Add Software Bill of Materials to the main packages (#16202) 2021-10-18 11:02:53 -07:00
Steve Lee
a1c1aeba5c Don't allow Move-Item with FileSystemProvider to move a directory into itself (#16198) 2021-10-18 11:02:11 -07:00
Travis Plunk
45f2965573 Upgrade set-value package for markdown test (#16196) 2021-10-18 11:01:14 -07:00
Dongbo Wang
6819dfc75a Change Target from a CodeProperty to be an AliasProperty that points to FileSystemInfo.LinkTarget (#16165) 2021-10-18 11:00:16 -07:00
Travis Plunk
b98812eeaf Fix Microsoft update spelling issue. (#16178) 2021-10-18 10:59:24 -07:00
Travis Plunk
e826202a33 Move vPack build to 1ES Pool (#16169) 2021-10-18 10:58:38 -07:00
229 changed files with 21527 additions and 10565 deletions

View File

@ -114,6 +114,8 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_auto_properties = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
dotnet_style_prefer_compound_assignment = false:silent
dotnet_diagnostic.IDE0031.severity = none
dotnet_code_quality_unused_parameters = non_public:suggestion

View File

@ -0,0 +1,27 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Set-GWVariable {
param(
[Parameter(Mandatory = $true)]
[string]$Name,
[Parameter(Mandatory = $true)]
[string]$Value
)
Write-Verbose "Setting CI variable $Name to $Value" -Verbose
if ($env:GITHUB_ENV) {
"$Name=$Value" | Out-File $env:GITHUB_ENV -Append
}
}
function Get-GWTempPath {
$temp = [System.IO.Path]::GetTempPath()
if ($env:RUNNER_TEMP) {
$temp = $env:RUNNER_TEMP
}
Write-Verbose "Get CI Temp path: $temp" -Verbose
return $temp
}

View File

@ -30,18 +30,16 @@ jobs:
git fetch --prune --unshallow --tags
- name: Execute Update .NET script
run: |
Import-Module .github/workflows/GHWorkflowHelper
$currentVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
Write-Verbose "OLD_VERSION=$currentVersion" -Verbose
"OLD_VERSION=$currentVersion" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name OLD_VERSION -Value $currentVersion
./tools/UpdateDotnetRuntime.ps1 -UpdateMSIPackaging -UseInternalFeed
$newVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
Write-Verbose "NEW_VERSION=$newVersion" -Verbose
"NEW_VERSION=$newVersion" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name NEW_VERSION -Value $newVersion
if ($currentVersion -ne $newVersion) {
Write-Verbose "CREATE_PR=true" -Verbose
"CREATE_PR=true" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name CREATE_PR -Value 'true'
}
- name: Microsoft Teams Notifier
uses: skitionek/notify-microsoft-teams@master
@ -58,5 +56,70 @@ jobs:
title: "Update .NET SDK version from `${{ env.OLD_VERSION }}` to `${{ env.NEW_VERSION }}`"
base: master
branch: dotnet_update
update-tpn:
name: Update Notices File
timeout-minutes: 15
runs-on: windows-latest
if: github.repository == 'PowerShell/PowerShell'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Notices file
run: |
Invoke-WebRequest -Uri https://aka.ms/pwsh-daily-tpn -OutFile ./ThirdPartyNotices.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cprtpn
with:
commit-message: "Update to the latest NOTICES file"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Update to the latest NOTICES file"
reviewers: travisez13
base: master
draft: false
branch: update-cgmanifest
update-cgmanifest:
name: Update cgmanifest
timeout-minutes: 15
runs-on: windows-latest
if: github.repository == 'PowerShell/PowerShell'
env:
CGMANIFEST_PATH: ''
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Sync tags
run: |
git fetch --prune --unshallow --tags
- name: Install Ships provider to deal with project.assets.json
run: |
Install-Module -Name dotnet.project.assets -force
- name: Bootstrap
run: |
Import-Module ./build.psm1
Start-PSBootStrap
- name: Verify cgmanifest is up to date
run: |
Import-Module ./build.psm1
Find-Dotnet
./tools/findMissingNotices.ps1 -Fix
- name: Upload cgmanifest
uses: actions/upload-artifact@v2
if: always() && env.CGMANIFEST_PATH != ''
with:
name: cgmanifest
path: ${{ env.CGMANIFEST_PATH }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cprcgmanifest
if: env.CGMANIFEST_PATH != ''
with:
commit-message: "Update the cgmanifest"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Update the cgmanifest"
reviewers: travisez13
base: master
draft: false
branch: update-cgmanifest

View File

@ -0,0 +1,3 @@
{
"aliveStatusCodes": [504, 503, 403, 200]
}

20
.github/workflows/markdownLink.yml vendored Normal file
View File

@ -0,0 +1,20 @@
on:
pull_request:
branches:
- master
- 'release/**'
paths:
- '**.md'
name: Check links for modified files
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
check-modified-files-only: 'yes'
config-file: .github/workflows/markdown-link/config.json

3
.gitignore vendored
View File

@ -92,3 +92,6 @@ test/tools/Modules/SelfSignedCertificate/
# BenchmarkDotNet artifacts
test/perf/BenchmarkDotNet.Artifacts/
# Ignore logfiles
logfile/*

View File

@ -53,6 +53,7 @@ APIScan
appimage
applocker
appveyor
appx
args
argumentlist
arm32
@ -96,11 +97,13 @@ bugfix
build.json
build.psm1
bulid
buildInfoJson
callmejoebob
catchable
cdxml
celsius
CentOS
CGManifest
changelog
changelog.md
changelogs
@ -115,6 +118,8 @@ childitem
ChrisLGardner
cimsession
cimsupport
ci.psm1
cgmanifest
classlib
clear-itemproperty
cloudydino
@ -277,10 +282,12 @@ filecatalog
filename
filesystem
filesystemprovider
files.wxs
filterhashtable
find-dscresource
find-packageprovider
find-rolecapability
findMissingNotices.ps1
firefox
folderName
foreach
@ -295,6 +302,7 @@ functionprovider
FunctionTable
fxdependent
gabrielsroka
GAC_Arm64
gamified
gc.regions.xml
Generic.SortedList
@ -530,6 +538,7 @@ mvps
mwrock
myget
namedpipe
NameObscurerTelemetryInitializer
nameof
namespace
nano
@ -906,6 +915,7 @@ tracesource
travisez13
travisty
truher
TSAUpload
TValue
tylerleonhardt
typecataloggen
@ -1126,6 +1136,17 @@ Microsoft.Management.UI.Internal
StringComparison
osx-arm64
crossgen2
mcr.microsoft.com
global.json
sha256
PkgES
TabExpansion
PSv2
Microsoft.CSharp
System.Data.SqlClient
azcopy
v7.2.10
7.2.x
- CHANGELOG.md
aavdberg
asrosent
@ -1269,7 +1290,7 @@ package.json
jcotton42
RPMs
PSDesiredStateConfiguration
- CHANGELOG/preview.md
- CHANGELOG/7.2.md
Gimly
jborean93
mkswd
@ -1383,6 +1404,27 @@ lselden
SethFalco
CodeQL
slowy07
rc.2.21505.57
ThirdPartyNotices
ThirdPartyNotices.txt
cgmanifest.json
buildinfo
tar.gz
psoptions.json
manifest.spdx.json
vPack
kondratyev-nv
v7.2.0
v7.2.3
cgmanifest.json
pwsh.exe
6.0.100-rtm.21527.11
6.0.100-rc.2.21505.57
ThirdPartyNotices.txt
rtm.21527.11
SKUs
vmImage
Ubuntu22.04
- CHANGELOG/7.0.md
codesign
release-BuildJson

View File

@ -11,9 +11,9 @@ trigger:
include:
- '*'
exclude:
- /.vsts-ci/misc-analysis.yml
- /.github/ISSUE_TEMPLATE/*
- /.dependabot/config.yml
- .vsts-ci/misc-analysis.yml
- .github/ISSUE_TEMPLATE/*
- .dependabot/config.yml
- test/perf/*
pr:
branches:
@ -30,6 +30,8 @@ pr:
- .vsts-ci/misc-analysis.yml
- .vsts-ci/windows.yml
- .vsts-ci/windows/*
- tools/cgmanifest.json
- LICENSE.txt
- test/common/markdown/*
- test/perf/*
- tools/releaseBuild/*

View File

@ -11,10 +11,10 @@ trigger:
include:
- '*'
exclude:
- /tools/releaseBuild/**/*
- /.vsts-ci/misc-analysis.yml
- /.github/ISSUE_TEMPLATE/*
- /.dependabot/config.yml
- tools/releaseBuild/**/*
- .vsts-ci/misc-analysis.yml
- .github/ISSUE_TEMPLATE/*
- .dependabot/config.yml
- test/perf/*
pr:
branches:
@ -29,8 +29,10 @@ pr:
- .dependabot/config.yml
- .github/ISSUE_TEMPLATE/*
- .vsts-ci/misc-analysis.yml
- /.vsts-ci/windows.yml
- /.vsts-ci/windows/*
- .vsts-ci/windows.yml
- .vsts-ci/windows/*
- tools/cgmanifest.json
- LICENSE.txt
- test/common/markdown/*
- test/perf/*
- tools/packaging/*
@ -97,10 +99,6 @@ stages:
vmImage: macOS-latest
steps:
- pwsh: |
# Remove old .NET SDKs
if (Test-Path -Path $HOME/.dotnet) {
Remove-Item $HOME/.dotnet -Recurse -Force
}
Import-Module .\tools\ci.psm1
New-CodeCoverageAndTestPackage
displayName: CodeCoverage and Test Package

View File

@ -90,20 +90,6 @@ jobs:
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'
- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
- pwsh: |
Import-module ./build.psm1
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
$results = invoke-pester -Script ./test/common -OutputFile $path -OutputFormat NUnitXml -PassThru
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Common Tests;publishRunAttachments=true;resultFiles=$path;]"
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
{
throw "Markdown tests failed"
}
displayName: Run Common Tests
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'
- template: dailyBuildCompliance.yml@ComplianceRepo
parameters:
sourceScanPath: '$(repoPath)'

View File

@ -0,0 +1,56 @@
jobs:
- job: markdown
displayName: Markdown Spelling
pool:
vmImage: ubuntu-20.04
variables:
- name: repoPath
value: $(Agent.BuildDirectory)/$(repoFolder)
steps:
- checkout: self
clean: true
path: $(repoFolder)
- checkout: ComplianceRepo
- powershell: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()
- bash: |
curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash
displayName: Bootstrap Yarn
condition: succeededOrFailed()
- bash: |
sudo yarn global add markdown-spellcheck@0.11.0
displayName: Install mdspell
condition: succeededOrFailed()
- bash: |
mdspell '**/*.md' '!**/Pester/**/*.md' '!**/dotnet-tools/**/*.md' --ignore-numbers --ignore-acronyms --report --en-us;
displayName: Test Spelling in Markdown
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'
- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
- pwsh: |
Import-module ./build.psm1
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
$results = invoke-pester -Script ./test/common/markdown-lint -OutputFile $path -OutputFormat NUnitXml -PassThru
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Markdown Lint;publishRunAttachments=true;resultFiles=$path;]"
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
{
throw "Markdown tests failed"
}
displayName: Run Markdown Lint Tests
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'
- template: dailyBuildCompliance.yml@ComplianceRepo
parameters:
sourceScanPath: '$(repoPath)/test/common'

View File

@ -34,6 +34,8 @@ resources:
clean: true
jobs:
- job: SSHRemotingTests
pool:
vmImage: ubuntu-20.04
container: mcr.microsoft.com/powershell/test-deps:ubuntu-18.04
displayName: SSH Remoting Tests

View File

@ -1,5 +1,5 @@
parameters:
pool: 'vs2017-win2016'
pool: 'windows-latest'
jobName: 'win_build'
displayName: Windows Build
@ -11,38 +11,31 @@ jobs:
displayName: ${{ parameters.displayName }}
steps:
- powershell: |
- pwsh: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
- ${{ if ne(variables['AzDevOpsFeed'], '') }}:
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
- pwsh: |
if (Test-Path -Path $HOME/.dotnet) {
Remove-Item $HOME/.dotnet -Recurse -Force
}
displayName: Remove Old .NET SDKs
condition: succeededOrFailed()
- pwsh: |
Import-Module .\tools\ci.psm1
Invoke-CIInstall -SkipUser
displayName: Bootstrap
condition: succeeded()
- powershell: |
- pwsh: |
Import-Module .\tools\ci.psm1
Invoke-CIBuild
displayName: Build
condition: succeeded()
- powershell: |
- pwsh: |
Import-Module .\tools\ci.psm1
Restore-PSOptions
Invoke-CIxUnit -SkipFailing

View File

@ -1,12 +1,12 @@
parameters:
pool: 'Hosted VS2017'
pool: 'windows-latest'
jobName: 'credscan'
displayName: Secret Scan
jobs:
- job: ${{ parameters.jobName }}
pool:
name: ${{ parameters.pool }}
vmImage: ${{ parameters.pool }}
displayName: ${{ parameters.displayName }}

View File

@ -1,5 +1,5 @@
parameters:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
jobName: 'Nanoserver_Tests'
continueOnError: false

View File

@ -33,13 +33,6 @@ jobs:
displayName: 'Capture Artifacts Directory'
continueOnError: true
- pwsh: |
if (Test-Path -Path $HOME/.dotnet) {
Remove-Item $HOME/.dotnet -Recurse -Force
}
displayName: Remove Old .NET SDKs
condition: succeededOrFailed()
- pwsh: |
Import-Module .\tools\ci.psm1
Invoke-CIInstall -SkipUser

View File

@ -1,6 +1,6 @@
parameters:
parentJobs: []
pool: 'vs2017-win2016'
pool: 'windows-latest'
jobName: 'xunit_verify'
jobs:

View File

@ -1,5 +1,5 @@
parameters:
pool: 'Hosted VS2017'
pool: 'windows-latest'
parentJobs: []
purpose: ''
tagSet: 'CI'
@ -9,7 +9,7 @@ jobs:
dependsOn:
${{ parameters.parentJobs }}
pool:
name: ${{ parameters.pool }}
vmImage: ${{ parameters.pool }}
displayName: Windows Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }}

View File

@ -53,7 +53,7 @@ stages:
jobs:
- job: win_test
pool:
vmImage: vs2017-win2016
vmImage: windows-latest
displayName: Windows Test
timeoutInMinutes: 90

View File

@ -11,9 +11,9 @@ trigger:
include:
- '*'
exclude:
- /.vsts-ci/misc-analysis.yml
- /.github/ISSUE_TEMPLATE/*
- /.dependabot/config.yml
- .vsts-ci/misc-analysis.yml
- .github/ISSUE_TEMPLATE/*
- .dependabot/config.yml
- test/perf/*
pr:
branches:
@ -28,6 +28,8 @@ pr:
- .dependabot/config.yml
- .github/ISSUE_TEMPLATE/*
- .vsts-ci/misc-analysis.yml
- tools/cgmanifest.json
- LICENSE.txt
- test/common/markdown/*
- test/perf/*
- tools/packaging/*

View File

@ -1,25 +1,53 @@
parameters:
pool: 'Hosted VS2017'
jobName: 'win_packaging'
architecture: 'x64'
channel: 'preview'
parentJobs: []
- name: pool
default: 'windows-latest'
- name: jobName
default: 'win_packaging'
- name: runtimePrefix
default: 'win7'
- name: architecture
default: 'x64'
- name: channel
default: 'preview'
jobs:
- job: ${{ parameters.jobName }}_${{ parameters.channel }}_${{ parameters.architecture }}
dependsOn:
${{ parameters.parentJobs }}
variables:
- name: repoFolder
value: PowerShell
- name: repoPath
value: $(Agent.BuildDirectory)\$(repoFolder)
- name: complianceRepoFolder
value: compliance
- name: complianceRepoPath
value: $(Agent.BuildDirectory)\$(complianceRepoFolder)
pool:
name: ${{ parameters.pool }}
vmImage: ${{ parameters.pool }}
displayName: Windows Packaging - ${{ parameters.architecture }} - ${{ parameters.channel }}
steps:
- checkout: self
clean: true
path: $(repoFolder)
- checkout: ComplianceRepo
clean: true
path: $(complianceRepoFolder)
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()
- pwsh: |
$PSVersionTable
displayName: Capture PowerShell Version Table
condition: succeededOrFailed()
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
- pwsh: |
@ -27,9 +55,25 @@ jobs:
Invoke-CIInstall -SkipUser
displayName: Bootstrap
condition: succeeded()
workingDirectory: $(repoPath)
- pwsh: |
Import-Module .\tools\ci.psm1
New-CodeCoverageAndTestPackage
Invoke-CIFinish -Runtime win7-${{ parameters.architecture }} -channel ${{ parameters.channel }}
displayName: Build and Test Package
Invoke-CIFinish -Runtime ${{ parameters.runtimePrefix }}-${{ parameters.architecture }} -channel ${{ parameters.channel }} -Stage Build
displayName: Build
workingDirectory: $(repoPath)
- template: Sbom.yml@ComplianceRepo
parameters:
BuildDropPath: '$(System.ArtifactsDirectory)/mainBuild'
Build_Repository_Uri: $(build.repository.uri)
displayName: SBOM
sourceScanPath: '$(repoPath)\tools'
- pwsh: |
Import-Module .\tools\ci.psm1
New-CodeCoverageAndTestPackage
Invoke-CIFinish -Runtime ${{ parameters.runtimePrefix }}-${{ parameters.architecture }} -channel ${{ parameters.channel }} -Stage Package
displayName: Package and Test
workingDirectory: $(repoPath)

View File

@ -51,6 +51,7 @@ pr:
- src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj
- src/Modules/PSGalleryModules.csproj
- src/powershell-win-core/powershell-win-core.csproj
- test/packaging/windows/*
- tools/ci.psm1
- tools/packaging/*
@ -67,10 +68,17 @@ variables:
- name: __SuppressAnsiEscapeSequences
value: 1
- group: fakeNugetKey
- name: SBOMGenerator_Formats
value: spdx:2.2
resources:
- repo: self
clean: true
repositories:
- repository: ComplianceRepo
type: github
endpoint: PowerShell
name: PowerShell/compliance
ref: master
stages:
- stage: PackagingWin
displayName: Packaging for Windows
@ -86,3 +94,13 @@ stages:
parameters:
channel: preview
architecture: x86
- template: templates/windows-packaging.yml
parameters:
channel: preview
architecture: arm
runtimePrefix: win
- template: templates/windows-packaging.yml
parameters:
channel: preview
architecture: arm64
runtimePrefix: win

View File

@ -1,7 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0-rc2.21458.5" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
</ItemGroup>
</Project>

1513
CHANGELOG/7.2.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,15 @@
{
"sdk": {
"channel": "6.0.1xx-rc1",
"quality": "signed",
"channel": "6.0.4xx",
"quality": "ga",
"qualityFallback": "daily",
"packageVersionPattern": "6.0.0-rc.1",
"sdkImageVersion": "6.0.100",
"nextChannel": "6.0.1xx-rc1"
"packageVersionPattern": "6.0.0",
"sdkImageVersion": "6.0.410",
"nextChannel": "6.0.4xx",
"azureFeed": "",
"sdkImageOverride": "6.0.410"
},
"internalfeed" : {
"url": "https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.1.21458.32-shipping/nuget/v2"
"url": ""
}
}

View File

@ -138,6 +138,7 @@
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -171,10 +172,11 @@
<!-- Define all OS, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Define windows, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' == 'true' ">
<!-- Define all OS, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'StaticAnalysis' ">
<Optimize>true</Optimize>
<!-- This is required to be full for compliance tools !-->
<DebugType>full</DebugType>
@ -186,13 +188,6 @@
Debugging the issues resolves the problem
-->
<Optimize>false</Optimize>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Define all OS, CodeCoverage configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
<!-- This is required to be portable to Coverlet tool !-->
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup>

View File

@ -143,7 +143,7 @@ For more information on how and why we built this dashboard, check out this [blo
## Discussions
[GitHub Discussions](https://docs.github.com/en/free-pro-team@latest/discussions/quickstart) is a feature to enable fluid and open discussions within the community
[GitHub Discussions](https://docs.github.com/discussions/quickstart) is a feature to enable fluid and open discussions within the community
for topics that are not related to code, unlike issues.
This is an experiment we are trying in our repositories to see if it helps move discussions out of issues so that issues remain actionable by the team or members of the community.

File diff suppressed because it is too large Load Diff

View File

@ -45,5 +45,7 @@
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources" />
<rescap:Capability Name="packageManagement" />
<rescap:Capability Name="packageQuery" />
</Capabilities>
</Package>

View File

@ -1,46 +1,42 @@
## Used to generate a new TPN
## Copy this into the additional attributions fields
## Copy everything below here, but do not include this line
---------------------------------------------
File: PSReadLine
---------------------------------------------
-------------------------------------------------------------------
https://github.com/lzybkr/PSReadLine
-------------------------------------------------------------------
Copyright (c) 2013, Jason Shirk
Additional -
All rights reserved.
-------------------------------------------------
Microsoft.PowerShell.Archive
-------------------------------------------------
BSD License
Copyright (c) 2016 Microsoft Corporation.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
The MIT License (MIT)
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
----------------------------------------------
File: Hashtables from ConvertFrom-json
----------------------------------------------
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
https://stackoverflow.com/questions/22002748/hashtables-from-convertfrom-json-have-different-type-from-powershells-built-in-h
-------------------------------------------------
Microsoft.Management.Infrastructure.Runtime.Unix
Microsoft.Management.Infrastructure
-------------------------------------------------
Copyright (c) 2015 Dave Wyatt. All rights reserved.
Copyright (c) Microsoft Corporation
All rights reserved.
@ -52,33 +48,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------
PackageManagement
-------------------------------------------------
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------
• NuGet.Common
• NuGet.Configuration
@ -108,3 +77,116 @@ Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-------------------------------------------------
PackageManagement
-------------------------------------------------
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------------------------------
PowerShellGet
-------------------------------------------------
Copyright (c) Microsoft Corporation
All rights reserved.
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---------------------------------------------
File: PSReadLine
---------------------------------------------
https://github.com/PowerShell/PSReadLine
Copyright (c) 2013, Jason Shirk
All rights reserved.
BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------
ThreadJob
-------------------------------------------------
Copyright (c) 2018 Paul Higinbotham
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -110,7 +110,7 @@
<UI>
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="yes" Text="!(loc.ExitDialogBitmap)" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" TabSkip="yes" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Bigger}!(loc.Error1707)" TabSkip="yes" />
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" TabSkip="yes" />
<!-- divider between check boxes and button row -->
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" TabSkip="yes" />
@ -350,7 +350,7 @@
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" TabSkip="yes" />
<Control Id="Description" Type="Text" X="25" Y="54" Width="280" Height="100" Transparent="yes" NoPrefix="yes" Text="Microsoft Update helps keep your computer secure and up to date for Windows and other Microsoft products, including PowerShell 7. Updates will be delivered based on your current update settings. You can review or change these settings from the Windows Update control panel." TabSkip="yes" />
<!-- If the checkboxes are defined first, then they are first in the tab order and can be ticked and unticked using the spacebar -->
<Control Id="UseMuCheckBox" Type="CheckBox" X="20" Y="100" Width="290" Height="27" Property="USE_MU" CheckBoxValue="1" Text="Enable updating PowerShell through Microsft Update or WSUS (recommended)"/>
<Control Id="UseMuCheckBox" Type="CheckBox" X="20" Y="100" Width="290" Height="27" Property="USE_MU" CheckBoxValue="1" Text="Enable updating PowerShell through Microsoft Update or WSUS (recommended)"/>
<Control Id="EnableMuCheckBox" Type="CheckBox" X="20" Y="130" Width="290" Height="17" Property="ENABLE_MU" CheckBoxValue="1" Text="Use Microsoft Update when I check for updates (recommended)">
</Control>
<Control Id="MuWarningText" Type="Text" X="20" Y="160" Width="290" Height="27" Text="Without Microsoft Update enabled, you will need to use another update solution like WSUS or SCCM in order to receive automatic updates.">
@ -361,7 +361,7 @@
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-FAQ">See the Microsoft Update FAQ</a>]]></Text>
</Control>
<Control Id="PrivacyLink" Type="Hyperlink" X="20" Y="210" Width="290" Height="17">
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-Privacy-Statement">Read the Microsoft Update Priacy Statement</a>]]></Text>
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-Privacy-Statement">Read the Microsoft Update Privacy Statement</a>]]></Text>
</Control>
<!-- divider and bottom buttons -->
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" TabSkip="yes"/>

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch
AllowRemoval="yes"
Manufacturer="Microsoft Powershell"
MoreInfoURL="https://github.com/powershell/powershell"
DisplayName="Sample Patch"
Description="Small Update Patch"
Classification="Update"
>
<Media Id="5000" Cabinet="RTM.cab">
<PatchBaseline Id="RTM"/>
</Media>
<PatchFamilyRef Id="SamplePatchFamily"/>
</Patch>
<Fragment>
<PatchFamily Id='SamplePatchFamily' Version='6.1.1' Supersede='yes'>
<PropertyRef Id="ProductVersion"/>
</PatchFamily>
</Fragment>
</Wix>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
# Docker tests
## Windows and Linux containers
The tests must be run separately on the Windows and Linux docker daemons. You can use the Linux docker daemon on Windows, but that will only test Linux containers not Windows Containers.
## To building and basic behavior of the containers
```PowerShell
Invoke-Pester
```
Note: be sure to do this using both the Windows and Linux docker daemon.
## To test the productions containers
```PowerShell
Invoke-Pester -Tag Behavior
```
## To test only building the containers
```PowerShell
Invoke-Pester -Tag Build
```

View File

@ -1,23 +0,0 @@
FROM centos:7
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN yum install -y \
curl \
glibc-locale-source \
git
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME \
&& yum install -y $PACKAGENAME
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,29 +0,0 @@
FROM debian:stretch
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
curl \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN dpkg -i $PACKAGENAME || :
RUN apt-get install -y -f --no-install-recommends
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,26 +0,0 @@
FROM fedora:28
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN dnf install -y \
curl \
glibc-locale-source \
git \
compat-openssl10 \
&& dnf upgrade-minimal -y --security \
&& dnf clean all
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN dnf install -y $PACKAGENAME
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,31 +0,0 @@
FROM centos:7
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN yum install -y \
glibc-locale-source \
git
# Install dotnet-runtime
RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
RUN yum install -y \
dotnet-runtime-2.1
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,31 +0,0 @@
FROM microsoft/dotnet:2.1.7-runtime-stretch-slim
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,31 +0,0 @@
FROM microsoft/dotnet:3.0.100-preview-sdk
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell \
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,38 +0,0 @@
FROM fedora:28
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN dnf install -y \
glibc-locale-source \
git \
compat-openssl10 \
&& dnf upgrade-minimal -y --security \
&& dnf clean all
# Install dotnet-runtime
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc
ADD https://packages.microsoft.com/config/fedora/27/prod.repo .
RUN mv prod.repo /etc/yum.repos.d/microsoft-prod.repo
RUN dnf install -y \
dotnet-runtime-2.1 \
&& dnf upgrade-minimal -y --security \
&& dnf clean all
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell \
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,41 +0,0 @@
FROM opensuse:42.3
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN zypper --non-interactive update --skip-interactive \
&& zypper --non-interactive install \
glibc-locale \
glibc-i18ndata \
tar \
libunwind \
libicu \
openssl \
git
# Install dotnet-runtime
ADD https://packages.microsoft.com/keys/microsoft.asc .
RUN rpmkeys --import microsoft.asc
ADD https://packages.microsoft.com/config/opensuse/42.2/prod.repo .
RUN mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo
RUN zypper --non-interactive update --skip-interactive \
&& zypper --non-interactive install \
dotnet-runtime-2.1
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,39 +0,0 @@
FROM ubuntu:xenial
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
apt-transport-https \
locales \
git \
&& apt-get clean
# Install dotnet-runtime
ADD https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb .
RUN dpkg -i packages-microsoft-prod.deb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
dotnet-runtime-2.1 \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell \
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,31 +0,0 @@
FROM microsoft/dotnet:2.1.7-runtime-bionic
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
# Install PowerShell package
ADD $PACKAGELOCATION/$PACKAGENAME .
RUN mkdir -p /opt/microsoft/powershell \
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Download and run tests
RUN $TESTDOWNLOADCOMMAND
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,39 +0,0 @@
FROM opensuse:42.3
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
ARG POWERSHELL_LINKFILE=/usr/bin/pwsh
# Install dependencies
RUN zypper --non-interactive update --skip-interactive \
&& zypper --non-interactive install \
glibc-locale \
glibc-i18ndata \
tar \
curl \
libunwind \
libicu \
openssl \
git
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
# Create the target folder where powershell will be placed
RUN mkdir -p /opt/microsoft/powershell
# Expand powershell to the target folder
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
# Create the symbolic link that points to powershell
RUN ln -s /opt/microsoft/powershell/pwsh $POWERSHELL_LINKFILE
RUN $TESTDOWNLOADCOMMAND
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,29 +0,0 @@
FROM ubuntu:xenial
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
curl \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN dpkg -i $PACKAGENAME || :
RUN apt-get install -y -f --no-install-recommends
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,29 +0,0 @@
FROM ubuntu:bionic
ARG PACKAGENAME
ARG PACKAGELOCATION
ARG PREVIEWSUFFIX=
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ca-certificates \
curl \
apt-transport-https \
locales \
git \
&& apt-get clean
# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN locale-gen $LANG && update-locale
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN dpkg -i $PACKAGENAME || :
RUN apt-get install -y -f --no-install-recommends
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"

View File

@ -1,370 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
$script:forcePull = $true
# Get docker Engine OS
function Get-DockerEngineOs
{
docker info --format '{{ .OperatingSystem }}'
}
# Call Docker with appropriate result checksfunction Invoke-Docker
function Invoke-Docker
{
param(
[Parameter(Mandatory=$true)]
[string[]]
$Command,
[ValidateSet("error","warning",'ignore')]
$FailureAction = 'error',
[Parameter(Mandatory=$true)]
[string[]]
$Params,
[switch]
$PassThru,
[switch]
$SuppressHostOutput
)
$ErrorActionPreference = 'Continue'
# Log how we are running docker for troubleshooting issues
Write-Verbose "Running docker $command $params" -Verbose
if($SuppressHostOutput.IsPresent)
{
$result = docker $command $params 2>&1
}
else
{
&'docker' $command $params 2>&1 | Tee-Object -Variable result -ErrorAction SilentlyContinue | Out-String -Stream -ErrorAction SilentlyContinue | Write-Host -ErrorAction SilentlyContinue
}
$dockerExitCode = $LASTEXITCODE
if($PassThru.IsPresent)
{
Write-Verbose "passing through docker result$($result.length)..." -Verbose
return $result
}
elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'error')
{
Write-Error "docker $command failed with: $result" -ErrorAction Stop
return $false
}
elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'warning')
{
Write-Warning "docker $command failed with: $result"
return $false
}
elseif($dockerExitCode -ne 0)
{
return $false
}
return $true
}
# Return a list of Linux Container Test Cases
function Get-LinuxContainer
{
foreach($os in 'centos7','ubuntu16.04')
{
Write-Output @{
Name = $os
Path = "$PSScriptRoot/../release/$os"
}
}
}
# Return a list of Windows Container Test Cases
function Get-WindowsContainer
{
foreach($os in 'windowsservercore','nanoserver')
{
Write-Output @{
Name = $os
Path = "$PSScriptRoot/../release/$os"
}
}
}
$script:repoName = 'microsoft/powershell'
function Get-RepoName
{
return $script:repoName
}
function Set-RepoName
{
param([string]$RepoName)
$script:repoName = $RepoName
$script:forcePull = $false
}
function Test-SkipWindows
{
[bool] $canRunWindows = (Get-DockerEngineOs) -like 'Windows*'
return ($IsLinux -or $IsMacOS -or !$canRunWindows)
}
function Test-SkipLinux
{
$os = Get-DockerEngineOs
switch -wildcard ($os)
{
'*Linux*' {
return $false
}
'*Mac' {
return $false
}
# Docker for Windows means we are running the linux kernel
'Docker for Windows' {
return $false
}
'Windows*' {
return $true
}
default {
throw "Unknown docker os '$os'"
}
}
}
function Get-TestContext
{
param(
[ValidateSet('Linux','Windows','macOS')]
[string]$Type
)
$resultFileName = 'results.xml'
$logFileName = 'results.log'
$containerTestDrive = '/test'
# Return a windows context if the Context in Windows *AND*
# the current system is windows, otherwise Join-path will fail.
if($Type -eq 'Windows' -and $IsWindows)
{
$ContainerTestDrive = 'C:\test'
}
$resolvedTestDrive = (Resolve-Path "Testdrive:\").providerPath
return @{
ResolvedTestDrive = $resolvedTestDrive
ResolvedXmlPath = Join-Path $resolvedTestDrive -ChildPath $resultFileName
ResolvedLogPath = Join-Path $resolvedTestDrive -ChildPath $logFileName
ContainerTestDrive = $ContainerTestDrive
ContainerXmlPath = Join-Path $containerTestDrive -ChildPath $resultFileName
ContainerLogPath = Join-Path $containerTestDrive -ChildPath $logFileName
Type = $Type
ForcePull = $script:forcePull
}
}
function Get-ContainerPowerShellVersion
{
param(
[HashTable] $TestContext,
[string] $RepoName,
[string] $Name
)
$imageTag = "${script:repoName}:${Name}"
if($TestContext.ForcePull)
{
$null=Invoke-Docker -Command 'image', 'pull' -Params $imageTag -SuppressHostOutput
}
$runParams = @()
$localVolumeName = $testContext.resolvedTestDrive
$runParams += '--rm'
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
# use a container volume on windows because host volumes are not automatic
$volumeName = "test-volume-" + (Get-Random -Minimum 100 -Maximum 999)
# using alpine because it's tiny
$null=Invoke-Docker -Command create -Params '-v', '/test', '--name', $volumeName, 'alpine' -SuppressHostOutput
$runParams += '--volumes-from'
$runParams += $volumeName
}
else {
$runParams += '-v'
$runParams += "${localVolumeName}:$($testContext.containerTestDrive)"
}
$runParams += $imageTag
$runParams += 'pwsh'
$runParams += '-c'
$runParams += ('$PSVersionTable.PSVersion.ToString() | out-string | out-file -encoding ascii -FilePath '+$testContext.containerLogPath)
$null = Invoke-Docker -Command run -Params $runParams -SuppressHostOutput
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
$null = Invoke-Docker -Command cp -Params "${volumeName}:$($testContext.containerLogPath)", $TestContext.ResolvedLogPath
$null = Invoke-Docker -Command container, rm -Params $volumeName, '--force' -SuppressHostOutput
}
return (Get-Content -Encoding Ascii $testContext.resolvedLogPath)[0]
}
# Function defines a config mapping for testing Preview packages.
# The list of supported OS for each release can be found here:
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
function Get-DefaultPreviewConfigForPackageValidation
{
# format: <DockerfileFolderName>=<PartOfPackageFilename>
@{ 'centos7'='rhel.7';
'debian.9'='debian.9';
'fedora28'='rhel.7';
'opensuse42.3'='linux-x64.tar.gz';
'ubuntu16.04'='ubuntu.16.04';
'ubuntu18.04'='ubuntu.18.04';
'fxdependent-centos7'='linux-x64-fxdependent.tar.gz';
'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz';
'fxdependent-fedora28'='linux-x64-fxdependent.tar.gz';
'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz';
'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz';
'fxdependent-ubuntu18.04'='linux-x64-fxdependent.tar.gz';
'fxdependent-dotnetsdk-latest'='linux-x64-fxd-dotnetsdk.tar.gz'
}
}
# Function defines a config mapping for testing Stable packages.
# The list of supported OS for each release can be found here:
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
function Get-DefaultStableConfigForPackageValidation
{
# format: <DockerfileFolderName>=<PartOfPackageFilename>
@{ 'centos7'='rhel.7';
'debian.9'='debian.9';
'opensuse42.3'='linux-x64.tar.gz';
'ubuntu16.04'='ubuntu.16.04';
'fxdependent-centos7'='linux-x64-fxdependent.tar.gz';
'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz';
'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz';
'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz'
}
}
# Returns a list of files in a specified Azure container.
function Get-PackageNamesOnAzureBlob
{
param(
[string]
$ContainerUrl,
# $SAS (shared access signature) param should include beginning '?' and trailing '&'
[string]
$SAS
)
$response = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')
$xmlResponce = [xml]$response.Substring($response.IndexOf('<EnumerationResults')) # remove some bad chars in the beginning that break XML parsing
($xmlResponce.EnumerationResults.Blobs.Blob).Name
}
# This function is used for basic validation of PS packages during a release;
# During the process Docker files are filled out and executed with Docker build;
# During the build PS packages are downloaded onto Docker containers, installed and selected Pester tests from PowerShell Github repo are executed.
# This function must be run on a Docker host machine in 'Linux containers' mode, such as Windows 10 server with Hyper-V role installed.
function Test-PSPackage
{
param(
[string]
[Parameter(Mandatory=$true)]
$PSPackageLocation, # e.g. Azure container storage url
[string]
$SAS,# $SAS (shared access signature) param should include beginning '?' and trailing '&'
[Hashtable]
$Config, # hashtable that maps packages to dockerfiles; for example see Get-DefaultConfigForPackageValidation
[string]
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module",
[string]
$TestDownloadCommand = "git clone --recursive https://github.com/PowerShell/PowerShell.git",
[switch]
$Preview = $false
)
$PSPackageLocation = $PSPackageLocation.TrimEnd('/','\') # code below assumes there is no trailing separator in PSPackageLocation url
$RootFolder = Join-Path $PSScriptRoot 'Templates'
$packageList = Get-PackageNamesOnAzureBlob -ContainerUrl $PSPackageLocation -SAS $SAS
if (!$Config)
{
if ($Preview)
{
$Config = Get-DefaultPreviewConfigForPackageValidation
}
else
{
$Config = Get-DefaultStableConfigForPackageValidation
}
}
# pre-process $Config: verify build directories and packages exist
$map = @{}
foreach($kp in $Config.GetEnumerator())
{
$buildDir = Join-Path $RootFolder $kp.Key
$packageName = $packageList | Where-Object {$_ -like $('*'+$kp.Value+'*')}
if (-not (Test-Path $buildDir))
{
Write-Error "Directory does Not exist - $buildDir; Check `$Config parameter and '$RootFolder' folder"
}
elseif (-not ($packageName))
{
Write-Error "Can not find package that matches filter *$($kp.Value)*; Check `$Config parameter and '$PSPackageLocation'"
}
else
{
$map.Add($buildDir, $packageName)
}
}
Write-Verbose "Using configuration:" -Verbose
Write-Verbose ($map | Format-List | Out-String) -Verbose
$results = @{}
$returnValue = $true
# run builds sequentially, but don't block for errors so that configs after failed one can run
foreach($kp in $map.GetEnumerator())
{
$dockerDirPath = $kp.Key
$packageFileName = $kp.Value
$buildArgs = @()
$buildArgs += "--build-arg","PACKAGENAME=$packageFileName"
$buildArgs += "--build-arg","PACKAGELOCATION=$PSPackageLocation"
if ($Preview)
{
$buildArgs += "--build-arg","PREVIEWSUFFIX=-preview"
}
$buildArgs += "--build-arg","TESTLIST=$TestList"
$buildArgs += "--build-arg","TESTDOWNLOADCOMMAND=$TestDownloadCommand"
$buildArgs += "--no-cache"
$buildArgs += $dockerDirPath
$dockerResult = Invoke-Docker -Command 'build' -Params $buildArgs -FailureAction warning
$confName = Split-Path -Leaf $dockerDirPath
$results.Add($confName, $dockerResult)
if (-not $dockerResult) {$returnValue = $false}
}
# in the end print results for all configurations
Write-Verbose "Package validation results:" -Verbose
$results
return $returnValue
}

View File

@ -18,8 +18,7 @@ refer to the [Working with the PowerShell Repository](../git/README.md),
### Toolchain Setup
We use the [.NET Command-Line Interface][dotnet-cli] (`dotnet`) to build the managed components,
and [CMake][] to build the native components.
We use the [.NET Command-Line Interface][dotnet-cli] (`dotnet`) to build the managed components.
Installing the toolchain is as easy as running `Start-PSBootstrap` in PowerShell.
Of course, this requires a self-hosted copy of PowerShell on Linux.
@ -55,7 +54,6 @@ The `Start-PSBootstrap` function does the following:
If you want to use `dotnet` outside of `Start-PSBuild`, add `~/.dotnet` to your `PATH` environment variable.
[dotnet-cli]: https://docs.microsoft.com/dotnet/core/tools/
[CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html
## Build using our module

View File

@ -14,7 +14,7 @@ From `pwsh.exe`, run `Import-Module ./build.psm1` and use `Start-PSBootstrap` to
The `Start-PSBootstrap` function does the following:
- Uses `brew` or `port` to install CMake, OpenSSL, and GNU WGet
- Uses `brew` or `port` to install OpenSSL, and GNU WGet
- Uninstalls any prior versions of .NET CLI
- Downloads and installs .NET Core SDK to `~/.dotnet`

View File

@ -0,0 +1,15 @@
[
"PSAMSIMethodInvocationLogging",
"PSAnsiRenderingFileInfo",
"PSCleanBlock",
"PSCommandNotFoundSuggestion",
"PSExec",
"PSLoadAssemblyFromNativeCode",
"PSNativeCommandArgumentPassing",
"PSNativeCommandErrorActionPreference",
"PSNativePSPathResolution",
"PSSubsystemPluginModel",
"PSModuleAutoLoadSkipOfflineFiles",
"PSFeedbackProvider",
"PSCommandWithArgs"
]

View File

@ -0,0 +1,15 @@
[
"PSAMSIMethodInvocationLogging",
"PSAnsiRenderingFileInfo",
"PSCleanBlock",
"PSCommandNotFoundSuggestion",
"PSExec",
"PSLoadAssemblyFromNativeCode",
"PSNativeCommandArgumentPassing",
"PSNativeCommandErrorActionPreference",
"PSNativePSPathResolution",
"PSSubsystemPluginModel",
"PSModuleAutoLoadSkipOfflineFiles",
"PSFeedbackProvider",
"PSCommandWithArgs"
]

View File

@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.100-rc.1.21458.32"
"version": "6.0.410"
}
}

View File

@ -4,10 +4,11 @@
<clear />
<add key="dotnet" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v2" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-internal" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.1.21430.44-shipping/nuget/v2" />
<add key="dotnet-internal" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rtm.21524.1-shipping/nuget/v2" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>

11
prquantifier.yaml Normal file
View File

@ -0,0 +1,11 @@
# https://github.com/microsoft/PullRequestQuantifier/blob/main/docs/prquantifier-yaml.md
Excluded:
# defaults
- '*.csproj'
- prquantifier.yaml
- package-lock.json
- '*.md'
- '*.sln'
# autogenerated files
- tools/cgmanifest.json
- assets/wix/files.wxs

View File

@ -47,7 +47,7 @@
<ItemGroup>
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
</ItemGroup>
</Project>

View File

@ -306,7 +306,7 @@ foreach ($computerName in $array[1])
ComputerName = $computerName
ScriptBlock = { $true }
SessionOption = NewPSSessionOption -NoMachineProfile
SessionOption = New-PSSessionOption -NoMachineProfile
ErrorAction = 'SilentlyContinue'
}

View File

@ -7,8 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Markdig.Signed" Version="0.31.0" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
<PackageReference Include="Namotion.Reflection" Version="2.0.10" />
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.0-preview.2" />
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.1" />
</ItemGroup>
<PropertyGroup>
@ -31,9 +34,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-4.final" />
<PackageReference Include="System.Threading.AccessControl" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="System.Threading.AccessControl" Version="6.0.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="NJsonSchema" Version="10.5.2" />
</ItemGroup>

View File

@ -11,6 +11,7 @@ using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Management.Automation.Security;
using System.Reflection;
using System.Runtime.Loader;
using System.Security;
@ -549,8 +550,10 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
protected override void BeginProcessing()
{
// Prevent code compilation in ConstrainedLanguage mode
if (SessionState.LanguageMode == PSLanguageMode.ConstrainedLanguage)
// Prevent code compilation in ConstrainedLanguage mode, or NoLanguage mode under system lock down.
if (SessionState.LanguageMode == PSLanguageMode.ConstrainedLanguage ||
(SessionState.LanguageMode == PSLanguageMode.NoLanguage &&
SystemPolicy.GetSystemLockdownPolicy() == SystemEnforcementMode.Enforce))
{
ThrowTerminatingError(
new ErrorRecord(

View File

@ -71,7 +71,13 @@ namespace Microsoft.PowerShell.Commands
if (ShouldProcess(dateToUse.ToString()))
{
#if UNIX
if (!Platform.NonWindowsSetDate(dateToUse))
// We are not validating the native call here.
// We just want to be sure that we're using the value the user provided us.
if (Dbg.Internal.InternalTestHooks.SetDate)
{
WriteObject(dateToUse);
}
else if (!Platform.NonWindowsSetDate(dateToUse))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
@ -86,16 +92,23 @@ namespace Microsoft.PowerShell.Commands
systemTime.Second = (ushort)dateToUse.Second;
systemTime.Milliseconds = (ushort)dateToUse.Millisecond;
#pragma warning disable 56523
if (!NativeMethods.SetLocalTime(ref systemTime))
if (Dbg.Internal.InternalTestHooks.SetDate)
{
throw new Win32Exception(Marshal.GetLastWin32Error());
WriteObject(systemTime);
}
// MSDN says to call this twice to account for changes
// between DST
if (!NativeMethods.SetLocalTime(ref systemTime))
else
{
throw new Win32Exception(Marshal.GetLastWin32Error());
if (!NativeMethods.SetLocalTime(ref systemTime))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
// MSDN says to call this twice to account for changes
// between DST
if (!NativeMethods.SetLocalTime(ref systemTime))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
}
#pragma warning restore 56523
#endif
@ -106,7 +119,11 @@ namespace Microsoft.PowerShell.Commands
PSNoteProperty note = new("DisplayHint", DisplayHint);
outputObj.Properties.Add(note);
WriteObject(outputObj);
// If we've turned on the SetDate test hook, don't emit the output object here because we emitted it earlier.
if (!Dbg.Internal.InternalTestHooks.SetDate)
{
WriteObject(outputObj);
}
}
#endregion

View File

@ -1260,9 +1260,15 @@ namespace Microsoft.PowerShell.Commands
}
}
// Add the content headers
if (request.Content == null)
// For other methods like Put where empty content has meaning, we need to fill in the content
if (request.Content is null)
{
// If this is a Get request and there is no content, then don't fill in the content as empty content gets rejected by some web services per RFC7230
if ((IsStandardMethodSet() && request.Method == HttpMethod.Get && ContentType is null) || (IsCustomMethodSet() && CustomMethod.ToUpperInvariant() == "GET"))
{
return;
}
request.Content = new StringContent(string.Empty);
request.Content.Headers.Clear();
}

View File

@ -289,16 +289,14 @@ namespace Microsoft.PowerShell.Commands
ActivityId,
WebCmdletStrings.WriteRequestProgressActivity,
WebCmdletStrings.WriteRequestProgressStatus);
try
{
do
while (!copyTask.Wait(1000, cancellationToken))
{
record.StatusDescription = StringUtil.Format(WebCmdletStrings.WriteRequestProgressStatus, output.Position);
cmdlet.WriteProgress(record);
Task.Delay(1000).Wait(cancellationToken);
}
while (!copyTask.IsCompleted && !cancellationToken.IsCancellationRequested);
if (copyTask.IsCompleted)
{

View File

@ -432,7 +432,7 @@ namespace Microsoft.PowerShell
host.ShouldEndSession = shouldEndSession;
}
// Creation of the tread and starting it should be an atomic operation.
// Creation of the thread and starting it should be an atomic operation.
// otherwise the code in Run method can get instance of the breakhandlerThread
// after it is created and before started and call join on it. This will result
// in ThreadStateException.

View File

@ -729,7 +729,7 @@ namespace Microsoft.PowerShell
}
TextWriter writer = Console.IsOutputRedirected ? Console.Out : _parent.ConsoleTextWriter;
value = GetOutputString(value, SupportsVirtualTerminal, Console.IsOutputRedirected);
value = GetOutputString(value, SupportsVirtualTerminal);
if (_parent.IsRunningAsync)
{
@ -1215,7 +1215,7 @@ namespace Microsoft.PowerShell
{
if (SupportsVirtualTerminal)
{
WriteLine(GetFormatStyleString(FormatStyle.Debug, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message) + PSStyle.Instance.Reset);
WriteLine(GetFormatStyleString(FormatStyle.Debug) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message) + PSStyle.Instance.Reset);
}
else
{
@ -1276,7 +1276,7 @@ namespace Microsoft.PowerShell
{
if (SupportsVirtualTerminal)
{
WriteLine(GetFormatStyleString(FormatStyle.Verbose, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message) + PSStyle.Instance.Reset);
WriteLine(GetFormatStyleString(FormatStyle.Verbose) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message) + PSStyle.Instance.Reset);
}
else
{
@ -1320,7 +1320,7 @@ namespace Microsoft.PowerShell
{
if (SupportsVirtualTerminal)
{
WriteLine(GetFormatStyleString(FormatStyle.Warning, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message) + PSStyle.Instance.Reset);
WriteLine(GetFormatStyleString(FormatStyle.Warning) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message) + PSStyle.Instance.Reset);
}
else
{

View File

@ -8,7 +8,7 @@
<ItemGroup>
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0" />
</ItemGroup>
</Project>

View File

@ -6,6 +6,7 @@
<AssemblyName>Microsoft.PowerShell.GlobalTool.Shim</AssemblyName>
<OutputType>EXE</OutputType>
<RootNamespace>Microsoft.PowerShell.GlobalTool.Shim</RootNamespace>
<UseAppHost>False</UseAppHost>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" Condition="'$(SDKToUse)' == 'Microsoft.NET.Sdk' " />

View File

@ -16,21 +16,22 @@
<ItemGroup>
<!-- the following package(s) are from https://github.com/dotnet/fxdac -->
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.17" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.IO.Packaging" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.IO.Packaging" Version="6.0.0" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.1" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
<!-- the following package(s) are from https://github.com/dotnet/wcf -->
<PackageReference Include="System.ServiceModel.Duplex" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.ServiceModel.Http" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.ServiceModel.Security" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.Private.ServiceModel" Version="4.9.0-preview1.21220.1" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.Security" Version="4.9.0" />
<PackageReference Include="System.Private.ServiceModel" Version="4.9.0" />
<!-- the source could not be found for the following package(s) -->
<PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="1.0.1" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.6" />
</ItemGroup>
</Project>

View File

@ -10,7 +10,7 @@
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
<ProjectReference Include="..\Microsoft.WSMan.Runtime\Microsoft.WSMan.Runtime.csproj" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
</ItemGroup>
<PropertyGroup>

View File

@ -10,5 +10,5 @@ FunctionsToExport = @()
CmdletsToExport="Start-Transcript", "Stop-Transcript"
AliasesToExport = @()
NestedModules="Microsoft.PowerShell.ConsoleHost.dll"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -7,7 +7,7 @@ ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
FunctionsToExport = @()
AliasesToExport = @("gcb", "gtz", "scb")
CmdletsToExport=@("Add-Content",

View File

@ -10,5 +10,5 @@ FunctionsToExport = @()
CmdletsToExport="Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-PfxCertificate" , "Protect-CmsMessage", "Unprotect-CmsMessage", "Get-CmsMessage"
AliasesToExport = @()
NestedModules="Microsoft.PowerShell.Security.dll"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -30,19 +30,5 @@ CmdletsToExport = @(
FunctionsToExport = @()
AliasesToExport = @('fhx')
NestedModules = @("Microsoft.PowerShell.Commands.Utility.dll")
HelpInfoURI = 'https://aka.ms/powershell71-help'
PrivateData = @{
PSData = @{
ExperimentalFeatures = @(
@{
Name = 'Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace'
Description = 'Enables -BreakAll parameter on Debug-Runspace and Debug-Job cmdlets to allow users to decide if they want PowerShell to break immediately in the current location when they attach a debugger. Enables -Runspace parameter on *-PSBreakpoint cmdlets to support management of breakpoints in another runspace.'
}
@{
Name = 'Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck'
Description = 'Enable -SkipLimitCheck switch for Import-PowerShellDataFile to not enforce built-in hashtable limits'
}
)
}
}
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -14,5 +14,5 @@ CmdletsToExport= "Get-CimAssociatedInstance", "Get-CimClass", "Get-CimInstance",
"Remove-CimSession","Set-CimInstance",
"Export-BinaryMiLog","Import-BinaryMiLog"
AliasesToExport = "gcim","scim","ncim", "rcim","icim","gcai","rcie","ncms","rcms","gcms","ncso","gcls"
HelpInfoUri="https://aka.ms/powershell71-help"
HelpInfoUri="https://aka.ms/powershell72-help"
}

View File

@ -12,5 +12,5 @@ AliasesToExport = @()
NestedModules="Microsoft.PowerShell.Commands.Diagnostics.dll"
TypesToProcess="GetEvent.types.ps1xml"
FormatsToProcess="Event.format.ps1xml", "Diagnostics.format.ps1xml"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -7,7 +7,7 @@ ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
FunctionsToExport = @()
AliasesToExport = @("gcb", "gin", "gtz", "scb", "stz")
CmdletsToExport=@("Add-Content",

View File

@ -10,5 +10,5 @@ FunctionsToExport = @()
CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog"
AliasesToExport = @()
NestedModules="Microsoft.PowerShell.Security.dll"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -29,19 +29,5 @@ CmdletsToExport = @(
FunctionsToExport = @()
AliasesToExport = @('fhx')
NestedModules = @("Microsoft.PowerShell.Commands.Utility.dll")
HelpInfoURI = 'https://aka.ms/powershell71-help'
PrivateData = @{
PSData = @{
ExperimentalFeatures = @(
@{
Name = 'Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace'
Description = 'Enables -BreakAll parameter on Debug-Runspace and Debug-Job cmdlets to allow users to decide if they want PowerShell to break immediately in the current location when they attach a debugger. Enables -Runspace parameter on *-PSBreakpoint cmdlets to support management of breakpoints in another runspace.'
}
@{
Name = 'Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck'
Description = 'Enable -NoLimit switch for Import-PowerShellDataFile to not enforce built-in hashtable limits'
}
)
}
}
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -11,5 +11,5 @@ CmdletsToExport="Disable-WSManCredSSP", "Enable-WSManCredSSP", "Get-WSManCredSSP
AliasesToExport = @()
NestedModules="Microsoft.WSMan.Management.dll"
FormatsToProcess="WSMan.format.ps1xml"
HelpInfoURI = 'https://aka.ms/powershell71-help'
HelpInfoURI = 'https://aka.ms/powershell72-help'
}

View File

@ -10,5 +10,5 @@
FunctionsToExport="Disable-PSTrace","Disable-PSWSManCombinedTrace","Disable-WSManTrace","Enable-PSTrace","Enable-PSWSManCombinedTrace","Enable-WSManTrace","Get-LogProperties","Set-LogProperties","Start-Trace","Stop-Trace"
CmdletsToExport = @()
AliasesToExport = @()
HelpInfoUri="https://aka.ms/powershell71-help"
HelpInfoUri="https://aka.ms/powershell72-help"
}

View File

@ -232,6 +232,9 @@ namespace System.Management.Automation
/// |
/// |--- 'osx-x64' subfolder
/// | |--- native.dylib
/// |
/// |--- 'osx-arm64' subfolder
/// | |--- native.dylib
/// </summary>
internal static IntPtr NativeDllHandler(Assembly assembly, string libraryName)
{
@ -362,14 +365,14 @@ namespace System.Management.Automation
if (!assemblyFound)
{
string gacBitnessAwarePath = null;
string gacBitnessAwarePath;
if (Environment.Is64BitProcess)
{
if (string.IsNullOrEmpty(_gacPath64))
{
// cache value of '_gacPath64' folder in member variable.
_gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64";
var gacName = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "GAC_Arm64" : "GAC_64";
_gacPath64 = Path.Join(_winDir, "Microsoft.NET", "assembly", gacName);
}
gacBitnessAwarePath = _gacPath64;
@ -378,8 +381,7 @@ namespace System.Management.Automation
{
if (string.IsNullOrEmpty(_gacPath32))
{
// cache value of '_gacPath32' folder in member variable.
_gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32";
_gacPath32 = Path.Join(_winDir, "Microsoft.NET", "assembly", "GAC_32");
}
gacBitnessAwarePath = _gacPath32;
@ -552,7 +554,7 @@ namespace System.Management.Automation
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
folderName = "osx-x64";
folderName = "osx-" + processArch;
ext = ".dylib";
}

View File

@ -516,11 +516,6 @@ namespace System.Management.Automation
return Unix.IsHardLink(fileInfo);
}
internal static string NonWindowsInternalGetTarget(string path)
{
return Unix.NativeMethods.FollowSymLink(path);
}
internal static string NonWindowsGetUserFromPid(int path)
{
return Unix.NativeMethods.GetUserFromPid(path);

View File

@ -811,33 +811,18 @@ namespace System.Management.Automation.Runspaces
$ellipsis = ""`u{2026}""
$resetColor = ''
$errorColor = ''
$accentColor = ''
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
if ($null -ne $psstyle) {
$errorColor = $psstyle.Formatting.Error
}
$resetColor = [System.Management.Automation.VTUtility]::GetEscapeSequence(
[System.Management.Automation.VTUtility+VT]::Reset
)
}
function Get-VT100Color([ConsoleColor] $color) {
if (!$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
return ''
}
return [System.Management.Automation.VTUtility]::GetEscapeSequence($color)
$resetColor = $PSStyle.Reset
$errorColor = $psstyle.Formatting.Error
$accentColor = $PSStyle.Formatting.FormatAccent
}
function Show-ErrorRecord($obj, [int]$indent = 0, [int]$depth = 1) {
$newline = [Environment]::Newline
$output = [System.Text.StringBuilder]::new()
$prefix = ' ' * $indent
$accentColor = ''
if ($null -ne $Host.PrivateData) {
$accentColor = Get-VT100Color ($Host.PrivateData.FormatAccentColor ?? $Host.PrivateData.ErrorForegroundColor)
}
$expandTypes = @(
'Microsoft.Rest.HttpRequestMessageWrapper'
@ -1066,37 +1051,18 @@ namespace System.Management.Automation.Runspaces
Set-StrictMode -Off
$newline = [Environment]::Newline
$resetColor = ''
$errorColor = ''
$accentColor = ''
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
$resetColor = $PSStyle.Reset
$errorColor = $PSStyle.Formatting.Error
$accentColor = $PSStyle.Formatting.ErrorAccent
}
function Get-ConciseViewPositionMessage {
$resetColor = ''
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
$resetColor = [System.Management.Automation.VTUtility]::GetEscapeSequence(
[System.Management.Automation.VTUtility+VT]::Reset
)
}
function Get-VT100Color([ConsoleColor] $color) {
if (!$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
return ''
}
return [System.Management.Automation.VTUtility]::GetEscapeSequence($color)
}
# return length of string sans VT100 codes
function Get-RawStringLength($string) {
$vtCodes = ""`e[0m"", ""`e[2;30m"", ""`e[2;31m"", ""`e[2;32m"", ""`e[2;33m"", ""`e[2;34m"",
""`e[2;35m"", ""`e[2;36m"", ""`e[2;37m"", ""`e[1;30m"", ""`e[1;31m"", ""`e[1;32m"",
""`e[1;33m"", ""`e[1;34m"", ""`e[1;35m"", ""`e[1;36m"", ""`e[1;37m""
$newString = $string
foreach ($vtCode in $vtCodes) {
$newString = $newString.Replace($vtCode, '')
}
return $newString.Length
}
# returns a string cut to last whitespace
function Get-TruncatedString($string, [int]$length) {
@ -1107,14 +1073,6 @@ namespace System.Management.Automation.Runspaces
return ($string.Substring(0,$length) -split '\s',-2)[0]
}
$errorColor = ''
$accentColor = ''
if ($null -ne $Host.PrivateData) {
$errorColor = Get-VT100Color $Host.PrivateData.ErrorForegroundColor
$accentColor = Get-VT100Color ($Host.PrivateData.ErrorAccentColor ?? $errorColor)
}
$posmsg = ''
$headerWhitespace = ''
$offsetWhitespace = ''
@ -1217,7 +1175,7 @@ namespace System.Management.Automation.Runspaces
# if rendering line information, break up the message if it's wider than the console
if ($myinv -and $myinv.ScriptName -or $err.CategoryInfo.Category -eq 'ParserError') {
$prefixLength = Get-RawStringLength -string $prefix
$prefixLength = [System.Management.Automation.Internal.StringDecorated]::new($prefix).ContentLength
$prefixVtLength = $prefix.Length - $prefixLength
# replace newlines in message so it lines up correct
@ -1297,71 +1255,76 @@ namespace System.Management.Automation.Runspaces
}
if ($err.FullyQualifiedErrorId -eq 'NativeCommandErrorMessage' -or $err.FullyQualifiedErrorId -eq 'NativeCommandError') {
$err.Exception.Message
return ""${errorColor}$($err.Exception.Message)${resetcolor}""
}
$myinv = $err.InvocationInfo
if ($ErrorView -eq 'DetailedView') {
$message = Get-Error | Out-String
return ""${errorColor}${message}${resetcolor}""
}
if ($ErrorView -eq 'CategoryView') {
$message = $err.CategoryInfo.GetMessage()
return ""${errorColor}${message}${resetcolor}""
}
$posmsg = ''
if ($ErrorView -eq 'ConciseView') {
$posmsg = Get-ConciseViewPositionMessage
}
elseif ($myinv -and ($myinv.MyCommand -or ($err.CategoryInfo.Category -ne 'ParserError'))) {
$posmsg = $myinv.PositionMessage
}
if ($posmsg -ne '') {
$posmsg = $newline + $posmsg
}
if ($err.PSMessageDetails) {
$posmsg = ' : ' + $err.PSMessageDetails + $posmsg
}
if ($ErrorView -eq 'ConciseView') {
if ($err.PSMessageDetails) {
$posmsg = ""${errorColor}${posmsg}""
}
return $posmsg
}
$indent = 4
$errorCategoryMsg = $err.ErrorCategory_Message
if ($null -ne $errorCategoryMsg)
{
$indentString = '+ CategoryInfo : ' + $err.ErrorCategory_Message
}
else
{
$myinv = $err.InvocationInfo
if ($ErrorView -eq 'DetailedView') {
return (Get-Error | Out-String)
}
elseif ($ErrorView -eq 'ConciseView') {
$posmsg = Get-ConciseViewPositionMessage
}
elseif ($myinv -and ($myinv.MyCommand -or ($err.CategoryInfo.Category -ne 'ParserError'))) {
$posmsg = $myinv.PositionMessage
} else {
$posmsg = ''
}
if ($posmsg -ne '')
{
$posmsg = $newline + $posmsg
}
if ($err.PSMessageDetails) {
$posmsg = ' : ' + $err.PSMessageDetails + $posmsg
}
if ($ErrorView -eq 'ConciseView') {
return $posmsg
}
$indent = 4
$errorCategoryMsg = $err.ErrorCategory_Message
if ($null -ne $errorCategoryMsg)
{
$indentString = '+ CategoryInfo : ' + $err.ErrorCategory_Message
}
else
{
$indentString = '+ CategoryInfo : ' + $err.CategoryInfo
}
$posmsg += $newline + $indentString
$indentString = ""+ FullyQualifiedErrorId : "" + $err.FullyQualifiedErrorId
$posmsg += $newline + $indentString
$originInfo = $err.OriginInfo
if (($null -ne $originInfo) -and ($null -ne $originInfo.PSComputerName))
{
$indentString = ""+ PSComputerName : "" + $originInfo.PSComputerName
$posmsg += $newline + $indentString
}
if ($ErrorView -eq 'CategoryView') {
$err.CategoryInfo.GetMessage()
}
elseif (! $err.ErrorDetails -or ! $err.ErrorDetails.Message) {
$err.Exception.Message + $posmsg
} else {
$err.ErrorDetails.Message + $posmsg
}
$indentString = '+ CategoryInfo : ' + $err.CategoryInfo
}
$posmsg += $newline + $indentString
$indentString = ""+ FullyQualifiedErrorId : "" + $err.FullyQualifiedErrorId
$posmsg += $newline + $indentString
$originInfo = $err.OriginInfo
if (($null -ne $originInfo) -and ($null -ne $originInfo.PSComputerName))
{
$indentString = ""+ PSComputerName : "" + $originInfo.PSComputerName
$posmsg += $newline + $indentString
}
$finalMsg = if ($err.ErrorDetails.Message) {
$err.ErrorDetails.Message + $posmsg
} else {
$err.Exception.Message + $posmsg
}
""${errorColor}${finalMsg}${resetcolor}""
")
.EndEntry()
.EndControl());
@ -2082,37 +2045,37 @@ namespace System.Management.Automation.Runspaces
.AddItemScriptBlock(@"""$($_.FileInfo.Executable)$($_.FileInfo.Executable.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "FileInfo.Executable")
.AddItemScriptBlock(@"""$([string]::Join(',',$_.FileInfo.Extension.Keys))""", label: "FileInfo.Extension")
.AddItemScriptBlock(@"""$($_.Foreground.Black)$($_.Foreground.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Black")
.AddItemScriptBlock(@"""$($_.Foreground.BrightBlack)$($_.Foreground.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightBlack")
.AddItemScriptBlock(@"""$($_.Foreground.White)$($_.Foreground.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.White")
.AddItemScriptBlock(@"""$($_.Foreground.DarkGray)$($_.Foreground.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.DarkGray")
.AddItemScriptBlock(@"""$($_.Foreground.LightGray)$($_.Foreground.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightGray")
.AddItemScriptBlock(@"""$($_.Foreground.BrightWhite)$($_.Foreground.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightWhite")
.AddItemScriptBlock(@"""$($_.Foreground.Red)$($_.Foreground.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Red")
.AddItemScriptBlock(@"""$($_.Foreground.LightRed)$($_.Foreground.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightRed")
.AddItemScriptBlock(@"""$($_.Foreground.BrightRed)$($_.Foreground.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightRed")
.AddItemScriptBlock(@"""$($_.Foreground.Magenta)$($_.Foreground.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Magenta")
.AddItemScriptBlock(@"""$($_.Foreground.LightMagenta)$($_.Foreground.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightMagenta")
.AddItemScriptBlock(@"""$($_.Foreground.BrightMagenta)$($_.Foreground.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightMagenta")
.AddItemScriptBlock(@"""$($_.Foreground.Blue)$($_.Foreground.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Blue")
.AddItemScriptBlock(@"""$($_.Foreground.LightBlue)$($_.Foreground.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightBlue")
.AddItemScriptBlock(@"""$($_.Foreground.BrightBlue)$($_.Foreground.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightBlue")
.AddItemScriptBlock(@"""$($_.Foreground.Cyan)$($_.Foreground.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Cyan")
.AddItemScriptBlock(@"""$($_.Foreground.LightCyan)$($_.Foreground.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightCyan")
.AddItemScriptBlock(@"""$($_.Foreground.BrightCyan)$($_.Foreground.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightCyan")
.AddItemScriptBlock(@"""$($_.Foreground.Green)$($_.Foreground.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Green")
.AddItemScriptBlock(@"""$($_.Foreground.LightGreen)$($_.Foreground.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightGreen")
.AddItemScriptBlock(@"""$($_.Foreground.BrightGreen)$($_.Foreground.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightGreen")
.AddItemScriptBlock(@"""$($_.Foreground.Yellow)$($_.Foreground.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Yellow")
.AddItemScriptBlock(@"""$($_.Foreground.LightYellow)$($_.Foreground.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightYellow")
.AddItemScriptBlock(@"""$($_.Foreground.BrightYellow)$($_.Foreground.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightYellow")
.AddItemScriptBlock(@"""$($_.Background.Black)$($_.Background.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Black")
.AddItemScriptBlock(@"""$($_.Background.BrightBlack)$($_.Background.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightBlack")
.AddItemScriptBlock(@"""$($_.Background.White)$($_.Background.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.White")
.AddItemScriptBlock(@"""$($_.Background.DarkGray)$($_.Background.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.DarkGray")
.AddItemScriptBlock(@"""$($_.Background.LightGray)$($_.Background.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightGray")
.AddItemScriptBlock(@"""$($_.Background.BrightWhite)$($_.Background.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightWhite")
.AddItemScriptBlock(@"""$($_.Background.Red)$($_.Background.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Red")
.AddItemScriptBlock(@"""$($_.Background.LightRed)$($_.Background.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightRed")
.AddItemScriptBlock(@"""$($_.Background.BrightRed)$($_.Background.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightRed")
.AddItemScriptBlock(@"""$($_.Background.Magenta)$($_.Background.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Magenta")
.AddItemScriptBlock(@"""$($_.Background.LightMagenta)$($_.Background.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightMagenta")
.AddItemScriptBlock(@"""$($_.Background.BrightMagenta)$($_.Background.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightMagenta")
.AddItemScriptBlock(@"""$($_.Background.Blue)$($_.Background.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Blue")
.AddItemScriptBlock(@"""$($_.Background.LightBlue)$($_.Background.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightBlue")
.AddItemScriptBlock(@"""$($_.Background.BrightBlue)$($_.Background.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightBlue")
.AddItemScriptBlock(@"""$($_.Background.Cyan)$($_.Background.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Cyan")
.AddItemScriptBlock(@"""$($_.Background.LightCyan)$($_.Background.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightCyan")
.AddItemScriptBlock(@"""$($_.Background.BrightCyan)$($_.Background.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightCyan")
.AddItemScriptBlock(@"""$($_.Background.Green)$($_.Background.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Green")
.AddItemScriptBlock(@"""$($_.Background.LightGreen)$($_.Background.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightGreen")
.AddItemScriptBlock(@"""$($_.Background.BrightGreen)$($_.Background.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightGreen")
.AddItemScriptBlock(@"""$($_.Background.Yellow)$($_.Background.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Yellow")
.AddItemScriptBlock(@"""$($_.Background.LightYellow)$($_.Background.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightYellow")
.AddItemScriptBlock(@"""$($_.Background.BrightYellow)$($_.Background.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightYellow")
.EndEntry()
.EndList());
}
@ -2185,46 +2148,46 @@ namespace System.Management.Automation.Runspaces
ListControl.Create()
.StartEntry()
.AddItemScriptBlock(@"""$($_.Black)$($_.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Black")
.AddItemScriptBlock(@"""$($_.BrightBlack)$($_.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlack")
.AddItemScriptBlock(@"""$($_.White)$($_.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "White")
.AddItemScriptBlock(@"""$($_.DarkGray)$($_.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "DarkGray")
.AddItemScriptBlock(@"""$($_.LightGray)$($_.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGray")
.AddItemScriptBlock(@"""$($_.BrightWhite)$($_.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightWhite")
.AddItemScriptBlock(@"""$($_.Red)$($_.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Red")
.AddItemScriptBlock(@"""$($_.LightRed)$($_.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightRed")
.AddItemScriptBlock(@"""$($_.BrightRed)$($_.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightRed")
.AddItemScriptBlock(@"""$($_.Magenta)$($_.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Magenta")
.AddItemScriptBlock(@"""$($_.LightMagenta)$($_.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightMagenta")
.AddItemScriptBlock(@"""$($_.BrightMagenta)$($_.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightMagenta")
.AddItemScriptBlock(@"""$($_.Blue)$($_.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Blue")
.AddItemScriptBlock(@"""$($_.LightBlue)$($_.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightBlue")
.AddItemScriptBlock(@"""$($_.BrightBlue)$($_.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlue")
.AddItemScriptBlock(@"""$($_.Cyan)$($_.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Cyan")
.AddItemScriptBlock(@"""$($_.LightCyan)$($_.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightCyan")
.AddItemScriptBlock(@"""$($_.BrightCyan)$($_.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightCyan")
.AddItemScriptBlock(@"""$($_.Green)$($_.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Green")
.AddItemScriptBlock(@"""$($_.LightGreen)$($_.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGreen")
.AddItemScriptBlock(@"""$($_.BrightGreen)$($_.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightGreen")
.AddItemScriptBlock(@"""$($_.Yellow)$($_.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Yellow")
.AddItemScriptBlock(@"""$($_.LightYellow)$($_.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightYellow")
.AddItemScriptBlock(@"""$($_.BrightYellow)$($_.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightYellow")
.EndEntry()
.EndList());
}
private static IEnumerable<FormatViewDefinition> ViewsOf_System_Management_Automation_PSStyleBackgroundColor()
{
yield return new FormatViewDefinition("System.Management.Automation.PSStyle+ForegroundColor",
yield return new FormatViewDefinition("System.Management.Automation.PSStyle+BackgroundColor",
ListControl.Create()
.StartEntry()
.AddItemScriptBlock(@"""$($_.Black)$($_.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Black")
.AddItemScriptBlock(@"""$($_.BrightBlack)$($_.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlack")
.AddItemScriptBlock(@"""$($_.White)$($_.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "White")
.AddItemScriptBlock(@"""$($_.DarkGray)$($_.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "DarkGray")
.AddItemScriptBlock(@"""$($_.LightGray)$($_.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGray")
.AddItemScriptBlock(@"""$($_.BrightWhite)$($_.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightWhite")
.AddItemScriptBlock(@"""$($_.Red)$($_.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Red")
.AddItemScriptBlock(@"""$($_.LightRed)$($_.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightRed")
.AddItemScriptBlock(@"""$($_.BrightRed)$($_.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightRed")
.AddItemScriptBlock(@"""$($_.Magenta)$($_.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Magenta")
.AddItemScriptBlock(@"""$($_.LightMagenta)$($_.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightMagenta")
.AddItemScriptBlock(@"""$($_.BrightMagenta)$($_.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightMagenta")
.AddItemScriptBlock(@"""$($_.Blue)$($_.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Blue")
.AddItemScriptBlock(@"""$($_.LightBlue)$($_.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightBlue")
.AddItemScriptBlock(@"""$($_.BrightBlue)$($_.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlue")
.AddItemScriptBlock(@"""$($_.Cyan)$($_.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Cyan")
.AddItemScriptBlock(@"""$($_.LightCyan)$($_.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightCyan")
.AddItemScriptBlock(@"""$($_.BrightCyan)$($_.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightCyan")
.AddItemScriptBlock(@"""$($_.Green)$($_.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Green")
.AddItemScriptBlock(@"""$($_.LightGreen)$($_.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGreen")
.AddItemScriptBlock(@"""$($_.BrightGreen)$($_.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightGreen")
.AddItemScriptBlock(@"""$($_.Yellow)$($_.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Yellow")
.AddItemScriptBlock(@"""$($_.LightYellow)$($_.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightYellow")
.AddItemScriptBlock(@"""$($_.BrightYellow)$($_.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightYellow")
.EndEntry()
.EndList());
}

View File

@ -552,7 +552,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
else
{
_lo.WriteLine(rte.text);
// Write out raw text without any changes to it.
_lo.WriteRawText(rte.text);
}
return;

View File

@ -195,6 +195,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// </param>
internal abstract void WriteLine(string s);
/// <summary>
/// Write a line of string as raw text to the output device, with no change to the string.
/// For example, keeping VT escape sequences intact in it.
/// </summary>
/// <param name="s">The raw text to be written to the device.</param>
internal virtual void WriteRawText(string s) => WriteLine(s);
internal WriteStreamType WriteStream
{
get;
@ -376,7 +383,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// Implementation of the ILineOutput interface accepting an instance of a
/// TextWriter abstract class.
/// </summary>
internal class TextWriterLineOutput : LineOutput
internal sealed class TextWriterLineOutput : LineOutput
{
#region ILineOutput methods
@ -412,9 +419,17 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// <param name="s"></param>
internal override void WriteLine(string s)
{
CheckStopProcessing();
WriteRawText(PSHostUserInterface.GetOutputString(s, isHost: false));
}
s = PSHostUserInterface.GetOutputString(s, isHost: false);
/// <summary>
/// Write a raw text by delegating to the writer underneath, with no change to the text.
/// For example, keeping VT escape sequences intact in it.
/// </summary>
/// <param name="s">The raw text to be written to the device.</param>
internal override void WriteRawText(string s)
{
CheckStopProcessing();
if (_suppressNewline)
{
@ -425,6 +440,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
_writer.WriteLine(s);
}
}
#endregion
/// <summary>

View File

@ -53,19 +53,9 @@ namespace System.Management.Automation
public string Black { get; } = "\x1b[30m";
/// <summary>
/// Gets the color blue.
/// Gets the color red.
/// </summary>
public string Blue { get; } = "\x1b[34m";
/// <summary>
/// Gets the color cyan.
/// </summary>
public string Cyan { get; } = "\x1b[36m";
/// <summary>
/// Gets the color dark gray.
/// </summary>
public string DarkGray { get; } = "\x1b[90m";
public string Red { get; } = "\x1b[31m";
/// <summary>
/// Gets the color green.
@ -73,39 +63,14 @@ namespace System.Management.Automation
public string Green { get; } = "\x1b[32m";
/// <summary>
/// Gets the color light blue.
/// Gets the color yellow.
/// </summary>
public string LightBlue { get; } = "\x1b[94m";
public string Yellow { get; } = "\x1b[33m";
/// <summary>
/// Gets the color light cyan.
/// Gets the color blue.
/// </summary>
public string LightCyan { get; } = "\x1b[96m";
/// <summary>
/// Gets the color light gray.
/// </summary>
public string LightGray { get; } = "\x1b[97m";
/// <summary>
/// Gets the color light green.
/// </summary>
public string LightGreen { get; } = "\x1b[92m";
/// <summary>
/// Gets the color light magenta.
/// </summary>
public string LightMagenta { get; } = "\x1b[95m";
/// <summary>
/// Gets the color light red.
/// </summary>
public string LightRed { get; } = "\x1b[91m";
/// <summary>
/// Gets the color light yellow.
/// </summary>
public string LightYellow { get; } = "\x1b[93m";
public string Blue { get; } = "\x1b[34m";
/// <summary>
/// Gets the color magenta.
@ -113,9 +78,9 @@ namespace System.Management.Automation
public string Magenta { get; } = "\x1b[35m";
/// <summary>
/// Gets the color read.
/// Gets the color cyan.
/// </summary>
public string Red { get; } = "\x1b[31m";
public string Cyan { get; } = "\x1b[36m";
/// <summary>
/// Gets the color white.
@ -123,9 +88,44 @@ namespace System.Management.Automation
public string White { get; } = "\x1b[37m";
/// <summary>
/// Gets the color yellow.
/// Gets the color bright black.
/// </summary>
public string Yellow { get; } = "\x1b[33m";
public string BrightBlack { get; } = "\x1b[90m";
/// <summary>
/// Gets the color bright red.
/// </summary>
public string BrightRed { get; } = "\x1b[91m";
/// <summary>
/// Gets the color bright green.
/// </summary>
public string BrightGreen { get; } = "\x1b[92m";
/// <summary>
/// Gets the color bright yellow.
/// </summary>
public string BrightYellow { get; } = "\x1b[93m";
/// <summary>
/// Gets the color bright blue.
/// </summary>
public string BrightBlue { get; } = "\x1b[94m";
/// <summary>
/// Gets the color bright magenta.
/// </summary>
public string BrightMagenta { get; } = "\x1b[95m";
/// <summary>
/// Gets the color bright cyan.
/// </summary>
public string BrightCyan { get; } = "\x1b[96m";
/// <summary>
/// Gets the color bright white.
/// </summary>
public string BrightWhite { get; } = "\x1b[97m";
/// <summary>
/// Set as RGB (Red, Green, Blue).
@ -168,19 +168,9 @@ namespace System.Management.Automation
public string Black { get; } = "\x1b[40m";
/// <summary>
/// Gets the color blue.
/// Gets the color red.
/// </summary>
public string Blue { get; } = "\x1b[44m";
/// <summary>
/// Gets the color cyan.
/// </summary>
public string Cyan { get; } = "\x1b[46m";
/// <summary>
/// Gets the color dark gray.
/// </summary>
public string DarkGray { get; } = "\x1b[100m";
public string Red { get; } = "\x1b[41m";
/// <summary>
/// Gets the color green.
@ -188,39 +178,14 @@ namespace System.Management.Automation
public string Green { get; } = "\x1b[42m";
/// <summary>
/// Gets the color light blue.
/// Gets the color yellow.
/// </summary>
public string LightBlue { get; } = "\x1b[104m";
public string Yellow { get; } = "\x1b[43m";
/// <summary>
/// Gets the color light cyan.
/// Gets the color blue.
/// </summary>
public string LightCyan { get; } = "\x1b[106m";
/// <summary>
/// Gets the color light gray.
/// </summary>
public string LightGray { get; } = "\x1b[107m";
/// <summary>
/// Gets the color light green.
/// </summary>
public string LightGreen { get; } = "\x1b[102m";
/// <summary>
/// Gets the color light magenta.
/// </summary>
public string LightMagenta { get; } = "\x1b[105m";
/// <summary>
/// Gets the color light red.
/// </summary>
public string LightRed { get; } = "\x1b[101m";
/// <summary>
/// Gets the color light yellow.
/// </summary>
public string LightYellow { get; } = "\x1b[103m";
public string Blue { get; } = "\x1b[44m";
/// <summary>
/// Gets the color magenta.
@ -228,9 +193,9 @@ namespace System.Management.Automation
public string Magenta { get; } = "\x1b[45m";
/// <summary>
/// Gets the color read.
/// Gets the color cyan.
/// </summary>
public string Red { get; } = "\x1b[41m";
public string Cyan { get; } = "\x1b[46m";
/// <summary>
/// Gets the color white.
@ -238,9 +203,44 @@ namespace System.Management.Automation
public string White { get; } = "\x1b[47m";
/// <summary>
/// Gets the color yellow.
/// Gets the color bright black.
/// </summary>
public string Yellow { get; } = "\x1b[43m";
public string BrightBlack { get; } = "\x1b[100m";
/// <summary>
/// Gets the color bright red.
/// </summary>
public string BrightRed { get; } = "\x1b[101m";
/// <summary>
/// Gets the color bright green.
/// </summary>
public string BrightGreen { get; } = "\x1b[102m";
/// <summary>
/// Gets the color bright yellow.
/// </summary>
public string BrightYellow { get; } = "\x1b[103m";
/// <summary>
/// Gets the color bright blue.
/// </summary>
public string BrightBlue { get; } = "\x1b[104m";
/// <summary>
/// Gets the color bright magenta.
/// </summary>
public string BrightMagenta { get; } = "\x1b[105m";
/// <summary>
/// Gets the color bright cyan.
/// </summary>
public string BrightCyan { get; } = "\x1b[106m";
/// <summary>
/// Gets the color bright white.
/// </summary>
public string BrightWhite { get; } = "\x1b[107m";
/// <summary>
/// The color set as RGB (Red, Green, Blue).

View File

@ -101,8 +101,14 @@ namespace System.Management.Automation.Internal
}
}
// graphics/color mode ESC[1;2;...m
private const string GraphicsRegex = @"(\x1b\[\d+(;\d+)*m)";
// CSI escape sequences
private const string CsiRegex = @"(\x1b\[\?\d+[hl])";
// replace regex with .NET 6 API once available
internal static readonly Regex AnsiRegex = new Regex(@"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])", RegexOptions.Compiled);
internal static readonly Regex AnsiRegex = new Regex($"{GraphicsRegex}|{CsiRegex}", RegexOptions.Compiled);
/// <summary>
/// Initializes a new instance of the <see cref="ValueStringDecorated"/> struct.

View File

@ -12,23 +12,28 @@
<ItemGroup>
<!-- the following package(s) are from https://github.com/JamesNK/Newtonsoft.Json -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<!-- Newtonsoft.Json brings in an old version of CSharp
So, we are forcing a newer version.
-->
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<!-- the Application Insights package -->
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.18.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.DirectoryServices" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Management" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Security.AccessControl" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Security.Permissions" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0-rc.1.21451.13" />
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.1" />
<PackageReference Include="System.DirectoryServices" Version="6.0.1" />
<!--PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" /-->
<PackageReference Include="System.Management" Version="6.0.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Security.AccessControl" Version="6.0.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.3" />
<PackageReference Include="System.Security.Permissions" Version="6.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<!-- the following package(s) are from the powershell org -->
<PackageReference Include="Microsoft.Management.Infrastructure" Version="2.0.0" />
<PackageReference Include="Microsoft.PowerShell.Native" Version="7.2.0-preview.2" />
<PackageReference Include="Microsoft.PowerShell.Native" Version="7.2.1" />
</ItemGroup>
<PropertyGroup>

View File

@ -2977,13 +2977,20 @@ namespace System.Management.Automation.Runspaces
HashSet<string> unresolvedCmdsToExpose)
{
RunspaceOpenModuleLoadException exceptionToReturn = null;
List<PSModuleInfo> processedModules = new List<PSModuleInfo>();
foreach (object module in moduleList)
{
string moduleName = module as string;
if (moduleName != null)
{
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleName, null, path, publicCommands);
exceptionToReturn = ProcessOneModule(
initializedRunspace: initializedRunspace,
name: moduleName,
moduleInfoToLoad: null,
path: path,
publicCommands: publicCommands,
processedModules: processedModules);
}
else
{
@ -2994,7 +3001,13 @@ namespace System.Management.Automation.Runspaces
{
// if only name is specified in the module spec, just try import the module
// ie., don't take the performance overhead of calling GetModule.
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleSpecification.Name, null, path, publicCommands);
exceptionToReturn = ProcessOneModule(
initializedRunspace: initializedRunspace,
name: moduleSpecification.Name,
moduleInfoToLoad: null,
path: path,
publicCommands: publicCommands,
processedModules: processedModules);
}
else
{
@ -3002,7 +3015,13 @@ namespace System.Management.Automation.Runspaces
if (moduleInfos != null && moduleInfos.Count > 0)
{
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleSpecification.Name, moduleInfos[0], path, publicCommands);
exceptionToReturn = ProcessOneModule(
initializedRunspace: initializedRunspace,
name: moduleSpecification.Name,
moduleInfoToLoad: moduleInfos[0],
path: path,
publicCommands: publicCommands,
processedModules: processedModules);
}
else
{
@ -3051,7 +3070,11 @@ namespace System.Management.Automation.Runspaces
string commandToMakeVisible = Utils.ParseCommandName(unresolvedCommand, out moduleName);
bool found = false;
foreach (CommandInfo cmd in LookupCommands(commandToMakeVisible, moduleName, initializedRunspace.ExecutionContext))
foreach (CommandInfo cmd in LookupCommands(
commandPattern: commandToMakeVisible,
moduleName: moduleName,
context: initializedRunspace.ExecutionContext,
processedModules: processedModules))
{
if (!found)
{
@ -3102,11 +3125,13 @@ namespace System.Management.Automation.Runspaces
/// <param name="commandPattern"></param>
/// <param name="moduleName"></param>
/// <param name="context"></param>
/// <param name="processedModules"></param>
/// <returns></returns>
private static IEnumerable<CommandInfo> LookupCommands(
string commandPattern,
string moduleName,
ExecutionContext context)
ExecutionContext context,
List<PSModuleInfo> processedModules)
{
bool isWildCardPattern = WildcardPattern.ContainsWildcardCharacters(commandPattern);
var searchOptions = isWildCardPattern ?
@ -3120,7 +3145,11 @@ namespace System.Management.Automation.Runspaces
CommandOrigin cmdOrigin = CommandOrigin.Runspace;
while (true)
{
foreach (CommandInfo commandInfo in context.SessionState.InvokeCommand.GetCommands(commandPattern, CommandTypes.All, searchOptions, cmdOrigin))
foreach (CommandInfo commandInfo in context.SessionState.InvokeCommand.GetCommands(
name: commandPattern,
commandTypes: CommandTypes.All,
options: searchOptions,
commandOrigin: cmdOrigin))
{
// If module name is provided then use it to restrict returned results.
if (haveModuleName && !moduleName.Equals(commandInfo.ModuleName, StringComparison.OrdinalIgnoreCase))
@ -3150,13 +3179,43 @@ namespace System.Management.Automation.Runspaces
// Next try internal search.
cmdOrigin = CommandOrigin.Internal;
}
// If the command is associated with a module, try finding the command in the imported module list.
// The SessionState function table holds only one command name, and if two or more modules contain
// a command with the same name, only one of them will appear in the function table search above.
if (!found && haveModuleName)
{
var pattern = new WildcardPattern(commandPattern);
foreach (PSModuleInfo moduleInfo in processedModules)
{
if (moduleInfo.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase))
{
foreach (var cmd in moduleInfo.ExportedCommands.Values)
{
if (pattern.IsMatch(cmd.Name))
{
yield return cmd;
}
}
break;
}
}
}
}
/// <summary>
/// If <paramref name="moduleInfoToLoad"/> is null, import module using <paramref name="name"/>. Otherwise,
/// import module using <paramref name="moduleInfoToLoad"/>
/// </summary>
private RunspaceOpenModuleLoadException ProcessOneModule(Runspace initializedRunspace, string name, PSModuleInfo moduleInfoToLoad, string path, HashSet<CommandInfo> publicCommands)
private RunspaceOpenModuleLoadException ProcessOneModule(
Runspace initializedRunspace,
string name,
PSModuleInfo moduleInfoToLoad,
string path,
HashSet<CommandInfo> publicCommands,
List<PSModuleInfo> processedModules)
{
using (PowerShell pse = PowerShell.Create())
{
@ -3193,6 +3252,11 @@ namespace System.Management.Automation.Runspaces
c = new CmdletInfo("Out-Default", typeof(OutDefaultCommand), null, null, initializedRunspace.ExecutionContext);
pse.AddCommand(new Command(c));
}
else
{
// For runspace init module processing, pass back the PSModuleInfo to the output pipeline.
cmd.Parameters.Add("PassThru");
}
pse.Runspace = initializedRunspace;
// Module import should be run in FullLanguage mode since it is running in
@ -3201,7 +3265,10 @@ namespace System.Management.Automation.Runspaces
pse.Runspace.ExecutionContext.LanguageMode = PSLanguageMode.FullLanguage;
try
{
pse.Invoke();
// For runspace init module processing, collect the imported PSModuleInfo returned in the output pipeline.
// In other cases, this collection will be empty.
Collection<PSModuleInfo> moduleInfos = pse.Invoke<PSModuleInfo>();
processedModules.AddRange(moduleInfos);
}
finally
{
@ -4489,7 +4556,7 @@ end {
SpecialVariables.PSStyle,
PSStyle.Instance,
RunspaceInit.PSStyleDescription,
ScopedItemOptions.None),
ScopedItemOptions.Constant),
// Variable which controls the encoding for piping data to a NativeCommand
new SessionStateVariableEntry(

View File

@ -381,17 +381,6 @@ namespace Microsoft.PowerShell.Commands
private Exception _taskCollectionException;
private string _currentLocationPath;
// List of Foreach-Object command names and aliases.
// TODO: Look into using SessionState.Internal.GetAliasTable() to find all user created aliases.
// But update Alias command logic to maintain reverse table that lists all aliases mapping
// to a single command definition, for performance.
private static readonly string[] forEachNames = new string[]
{
"ForEach-Object",
"foreach",
"%"
};
private void InitParallelParameterSet()
{
// The following common parameters are not (yet) supported in this parameter set.
@ -422,8 +411,7 @@ namespace Microsoft.PowerShell.Commands
_usingValuesMap = ScriptBlockToPowerShellConverter.GetUsingValuesForEachParallel(
scriptBlock: Parallel,
isTrustedInput: allowUsingExpression,
context: this.Context,
foreachNames: forEachNames);
context: this.Context);
// Validate using values map, which is a map of '$using:' variables referenced in the script.
// Script block variables are not allowed since their behavior is undefined outside the runspace

View File

@ -7210,6 +7210,9 @@ namespace Microsoft.PowerShell.Commands
CommandOrigin.Internal,
targetSessionState.ExecutionContext);
// Note that the module 'func' and the function table 'functionInfo' instances are now linked
// together (see 'CopiedCommand' in CommandInfo class), so setting visibility on one also
// sets it on the other.
SetCommandVisibility(isImportModulePrivate, functionInfo);
functionInfo.Module = sourceModule;

View File

@ -958,7 +958,8 @@ namespace System.Management.Automation
#if UNIX
return Platform.SelectProductNameForDirectory(Platform.XDG_Type.USER_MODULES);
#else
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Utils.ModuleDirectory);
string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
return string.IsNullOrEmpty(myDocumentsPath) ? null : Path.Combine(myDocumentsPath, Utils.ModuleDirectory);
#endif
}
@ -1180,7 +1181,18 @@ namespace System.Management.Automation
currentProcessModulePath = hkcuUserModulePath; // = EVT.User
}
currentProcessModulePath += Path.PathSeparator;
if (string.IsNullOrEmpty(currentProcessModulePath))
{
if (currentProcessModulePath is null)
{
currentProcessModulePath = string.Empty;
}
}
else
{
currentProcessModulePath += Path.PathSeparator;
}
if (string.IsNullOrEmpty(hklmMachineModulePath)) // EVT.Machine does Not exist
{
currentProcessModulePath += CombineSystemModulePaths(); // += (SharedModulePath + $PSHome\Modules)
@ -1201,11 +1213,23 @@ namespace System.Management.Automation
// personalModulePath
// sharedModulePath
// systemModulePath
currentProcessModulePath = AddToPath(currentProcessModulePath, personalModulePathToUse, 0);
int insertIndex = PathContainsSubstring(currentProcessModulePath, personalModulePathToUse) + personalModulePathToUse.Length + 1;
currentProcessModulePath = AddToPath(currentProcessModulePath, sharedModulePath, insertIndex);
insertIndex = PathContainsSubstring(currentProcessModulePath, sharedModulePath) + sharedModulePath.Length + 1;
currentProcessModulePath = AddToPath(currentProcessModulePath, systemModulePathToUse, insertIndex);
int insertIndex = 0;
if (!string.IsNullOrEmpty(personalModulePathToUse))
{
currentProcessModulePath = AddToPath(currentProcessModulePath, personalModulePathToUse, insertIndex);
insertIndex = PathContainsSubstring(currentProcessModulePath, personalModulePathToUse) + personalModulePathToUse.Length + 1;
}
if (!string.IsNullOrEmpty(sharedModulePath))
{
currentProcessModulePath = AddToPath(currentProcessModulePath, sharedModulePath, insertIndex);
insertIndex = PathContainsSubstring(currentProcessModulePath, sharedModulePath) + sharedModulePath.Length + 1;
}
if (!string.IsNullOrEmpty(systemModulePathToUse))
{
currentProcessModulePath = AddToPath(currentProcessModulePath, systemModulePathToUse, insertIndex);
}
}
return currentProcessModulePath;

View File

@ -326,7 +326,7 @@ namespace System.Management.Automation
catch (Exception)
{
// Do cleanup in case of exception
CleanUp();
CleanUp(killBackgroundProcess: true);
throw;
}
}
@ -348,7 +348,7 @@ namespace System.Management.Automation
catch (Exception)
{
// Do cleanup in case of exception
CleanUp();
CleanUp(killBackgroundProcess: true);
throw;
}
}
@ -782,7 +782,7 @@ namespace System.Management.Automation
finally
{
// Do some cleanup
CleanUp();
CleanUp(killBackgroundProcess: false);
}
// An exception was thrown while attempting to run the program
@ -979,15 +979,30 @@ namespace System.Management.Automation
#if UNIX
return false;
#else
if (!Platform.IsWindowsDesktop) { return false; }
// SHGetFileInfo() does not understand reparse points and returns 0 ("non exe or error")
// so we are trying to get a real path before.
// It is a workaround for Microsoft Store applications.
string realPath = Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods.WinInternalGetTarget(fileName);
if (realPath is not null)
if (!Platform.IsWindowsDesktop)
{
fileName = realPath;
return false;
}
// The function 'SHGetFileInfo()' does not understand reparse points and returns 0 ("non exe or error")
// for a symbolic link file, so we try to get the immediate link target in that case.
// Why not get the final target (use 'returnFinalTarget: true')? Because:
// 1. When starting a process on Windows, if the 'FileName' is a symbolic link, the immediate link target will automatically be used,
// but the OS does not do recursive resolution when the immediate link target is also a symbolic link.
// 2. Keep the same behavior as before adopting the 'LinkTarget' and 'ResolveLinkTarget' APIs in .NET 6.
try
{
string linkTarget = File.ResolveLinkTarget(fileName, returnFinalTarget: false)?.FullName;
if (linkTarget is not null)
{
fileName = linkTarget;
}
}
catch
{
// An exception may be thrown from 'File.ResolveLinkTarget' when it fails to resolve a link path,
// for example, when the underlying file system doesn't support reparse points.
// Just use the original file name in this case.
}
SHFILEINFO shinfo = new SHFILEINFO();
@ -1045,7 +1060,8 @@ namespace System.Management.Automation
/// <summary>
/// Aggressively clean everything up...
/// </summary>
private void CleanUp()
/// <param name="killBackgroundProcess">If set, also terminate background process.</param>
private void CleanUp(bool killBackgroundProcess)
{
// We need to call 'NotifyEndApplication' as appropriate during cleanup
if (_hasNotifiedBeginApplication)
@ -1055,23 +1071,23 @@ namespace System.Management.Automation
try
{
if (_nativeProcess != null)
{
// on Unix, we need to kill the process to ensure it terminates as Dispose() merely
// closes the redirected streams and the processs does not exit on macOS. However,
// on Windows, a winexe like notepad should continue running so we don't want to kill it.
// on Unix, we need to kill the process (if not running in background) to ensure it terminates,
// as Dispose() merely closes the redirected streams and the process does not exit.
// However, on Windows, a winexe like notepad should continue running so we don't want to kill it.
#if UNIX
if (killBackgroundProcess || !_isRunningInBackground)
{
try
{
_nativeProcess.Kill();
_nativeProcess?.Kill();
}
catch
{
// Ignore all exception since it is cleanup.
// Ignore all exceptions since it is cleanup.
}
#endif
_nativeProcess.Dispose();
}
#endif
_nativeProcess.Dispose();
}
catch (Exception)
{

View File

@ -1245,11 +1245,18 @@ namespace System.Management.Automation
name != null,
"The caller should verify the name");
var functionInfos = GetFunctions();
FunctionInfo existingValue;
Dictionary<string, FunctionInfo> functionInfos = GetFunctions();
FunctionInfo result;
if (!functionInfos.TryGetValue(name, out existingValue))
// Functions are equal only if they have the same name and if they come from the same module (if any).
// If the function is not associated with a module then the info 'ModuleName' property is set to empty string.
// If the new function has the same name of an existing function, but different module names, then the
// existing table function is replaced with the new function.
if (!functionInfos.TryGetValue(name, out FunctionInfo existingValue) ||
(originalFunction != null &&
!existingValue.ModuleName.Equals(originalFunction.ModuleName, StringComparison.OrdinalIgnoreCase)))
{
// Add new function info to function table and return.
result = functionFactory(name, function, originalFunction, options, context, helpFile);
functionInfos[name] = result;
@ -1257,81 +1264,78 @@ namespace System.Management.Automation
{
GetAllScopeFunctions()[name] = result;
}
return result;
}
// Update the existing function.
// Make sure the function isn't constant or readonly.
SessionState.ThrowIfNotVisible(origin, existingValue);
if (IsFunctionOptionSet(existingValue, ScopedItemOptions.Constant) ||
(!force && IsFunctionOptionSet(existingValue, ScopedItemOptions.ReadOnly)))
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionNotWritable",
SessionStateStrings.FunctionNotWritable);
throw e;
}
// Ensure we are not trying to set the function to constant as this can only be
// done at creation time.
if ((options & ScopedItemOptions.Constant) != 0)
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionCannotBeMadeConstant",
SessionStateStrings.FunctionCannotBeMadeConstant);
throw e;
}
// Ensure we are not trying to remove the AllScope option.
if ((options & ScopedItemOptions.AllScope) == 0 &&
IsFunctionOptionSet(existingValue, ScopedItemOptions.AllScope))
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionAllScopeOptionCannotBeRemoved",
SessionStateStrings.FunctionAllScopeOptionCannotBeRemoved);
throw e;
}
FunctionInfo existingFunction = existingValue;
// If the function type changes (i.e.: function to workflow or back)
// then we need to replace what was there.
FunctionInfo newValue = functionFactory(name, function, originalFunction, options, context, helpFile);
bool changesFunctionType = existingFunction.GetType() != newValue.GetType();
// Since the options are set after the script block, we have to
// forcefully apply the script block if the options will be
// set to not being ReadOnly.
if (changesFunctionType ||
((existingFunction.Options & ScopedItemOptions.ReadOnly) != 0 && force))
{
result = newValue;
functionInfos[name] = newValue;
}
else
{
// Make sure the function isn't constant or readonly
SessionState.ThrowIfNotVisible(origin, existingValue);
if (IsFunctionOptionSet(existingValue, ScopedItemOptions.Constant) ||
(!force && IsFunctionOptionSet(existingValue, ScopedItemOptions.ReadOnly)))
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionNotWritable",
SessionStateStrings.FunctionNotWritable);
throw e;
}
// Ensure we are not trying to set the function to constant as this can only be
// done at creation time.
if ((options & ScopedItemOptions.Constant) != 0)
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionCannotBeMadeConstant",
SessionStateStrings.FunctionCannotBeMadeConstant);
throw e;
}
// Ensure we are not trying to remove the AllScope option
if ((options & ScopedItemOptions.AllScope) == 0 &&
IsFunctionOptionSet(existingValue, ScopedItemOptions.AllScope))
{
SessionStateUnauthorizedAccessException e =
new SessionStateUnauthorizedAccessException(
name,
SessionStateCategory.Function,
"FunctionAllScopeOptionCannotBeRemoved",
SessionStateStrings.FunctionAllScopeOptionCannotBeRemoved);
throw e;
}
FunctionInfo existingFunction = existingValue;
FunctionInfo newValue = null;
// If the function type changes (i.e.: function to workflow or back)
// then we need to blast what was there
newValue = functionFactory(name, function, originalFunction, options, context, helpFile);
bool changesFunctionType = existingFunction.GetType() != newValue.GetType();
// Since the options are set after the script block, we have to
// forcefully apply the script block if the options will be
// set to not being ReadOnly
if (changesFunctionType ||
((existingFunction.Options & ScopedItemOptions.ReadOnly) != 0 && force))
{
result = newValue;
functionInfos[name] = newValue;
}
else
{
bool applyForce = force || (options & ScopedItemOptions.ReadOnly) == 0;
existingFunction.Update(newValue, applyForce, options, helpFile);
result = existingFunction;
}
bool applyForce = force || (options & ScopedItemOptions.ReadOnly) == 0;
existingFunction.Update(newValue, applyForce, options, helpFile);
result = existingFunction;
}
return result;

View File

@ -680,10 +680,7 @@ namespace System.Management.Automation.Runspaces
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Target",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods), @"GetTarget"),
setterCodeReference: null),
new PSAliasProperty(@"Target", @"LinkTarget", conversionType: null),
typeMembers,
isOverride: false);
@ -808,10 +805,7 @@ namespace System.Management.Automation.Runspaces
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Target",
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods), @"GetTarget"),
setterCodeReference: null),
new PSAliasProperty(@"Target", @"LinkTarget", conversionType: null),
typeMembers,
isOverride: false);

View File

@ -1574,7 +1574,6 @@ namespace System.Management.Automation.Internal
internal static bool BypassAppLockerPolicyCaching;
internal static bool BypassOnlineHelpRetrieval;
internal static bool ForcePromptForChoiceDefaultOption;
internal static bool BypassOutputRedirectionCheck;
internal static bool NoPromptForPassword;
internal static bool ForceFormatListFixedLabelWidth;
@ -1593,6 +1592,8 @@ namespace System.Management.Automation.Internal
internal static bool SetConsoleWidthToZero;
internal static bool SetConsoleHeightToZero;
internal static bool SetDate;
// A location to test PSEdition compatibility functionality for Windows PowerShell modules with
// since we can't manipulate the System32 directory in a test
internal static string TestWindowsPowerShellPSHomeLocation;

View File

@ -304,18 +304,12 @@ namespace System.Management.Automation.Host
/// <param name="formatStyle">
/// The format style to get the escape sequence for.
/// </param>
/// <param name="isOutputRedirected">
/// True if the output is redirected.
/// </param>
/// <returns>
/// The ANSI escape sequence for the given format style.
/// </returns>
public static string GetFormatStyleString(FormatStyle formatStyle, bool isOutputRedirected)
public static string GetFormatStyleString(FormatStyle formatStyle)
{
// redirected console gets plaintext output to preserve existing behavior
if (!InternalTestHooks.BypassOutputRedirectionCheck &&
(PSStyle.Instance.OutputRendering == OutputRendering.PlainText ||
isOutputRedirected))
if (PSStyle.Instance.OutputRendering == OutputRendering.PlainText)
{
return string.Empty;
}
@ -353,30 +347,22 @@ namespace System.Management.Automation.Host
/// <param name="supportsVirtualTerminal">
/// True if the host supports virtual terminal.
/// </param>
/// <param name="isOutputRedirected">
/// True if the output is redirected.
/// </param>
/// <returns>
/// The formatted text.
/// </returns>
public static string GetOutputString(string text, bool supportsVirtualTerminal, bool isOutputRedirected)
public static string GetOutputString(string text, bool supportsVirtualTerminal)
{
return GetOutputString(text, isHost: true, supportsVirtualTerminal: supportsVirtualTerminal, isOutputRedirected: isOutputRedirected);
return GetOutputString(text, isHost: true, supportsVirtualTerminal: supportsVirtualTerminal);
}
internal static string GetOutputString(string text, bool isHost, bool? supportsVirtualTerminal = null, bool isOutputRedirected = false)
internal static string GetOutputString(string text, bool isHost, bool? supportsVirtualTerminal = null)
{
var sd = new ValueStringDecorated(text);
if (sd.IsDecorated)
{
var outputRendering = OutputRendering.Ansi;
if (InternalTestHooks.BypassOutputRedirectionCheck)
{
isOutputRedirected = false;
}
if (isOutputRedirected || ShouldOutputPlainText(isHost, supportsVirtualTerminal))
if (ShouldOutputPlainText(isHost, supportsVirtualTerminal))
{
outputRendering = OutputRendering.PlainText;
}

View File

@ -1011,10 +1011,6 @@ namespace System.Management.Automation.Internal
CommandState.Started,
commandProcessor.Command.MyInvocation);
// Telemetry here
// the type of command should be sent along
// commandProcessor.CommandInfo.CommandType
ApplicationInsightsTelemetry.SendTelemetryMetric(TelemetryType.ApplicationType, commandProcessor.Command.CommandInfo.CommandType.ToString());
#if LEGACYTELEMETRY
Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI.TraceExecutedCommand(commandProcessor.Command.CommandInfo, commandProcessor.Command.CommandOrigin);
#endif

View File

@ -125,234 +125,6 @@ namespace System.Management.Automation
// to client to let client know if the negotiation succeeded.
internal const string IsNegotiationSucceeded = "IsNegotiationSucceeded";
#region "PSv2 Tab Expansion Function"
internal const string PSv2TabExpansionFunction = "TabExpansion";
/// <summary>
/// This is the PSv2 function for tab expansion. It's only for legacy purpose - used in
/// an interactive remote session from a win7 machine to a win8 machine (or later).
/// </summary>
internal const string PSv2TabExpansionFunctionText = @"
param($line, $lastWord)
& {
function Write-Members ($sep='.')
{
Invoke-Expression ('$_val=' + $_expression)
$_method = [Management.Automation.PSMemberTypes] `
'Method,CodeMethod,ScriptMethod,ParameterizedProperty'
if ($sep -eq '.')
{
$params = @{view = 'extended','adapted','base'}
}
else
{
$params = @{static=$true}
}
foreach ($_m in ,$_val | Get-Member @params $_pat |
Sort-Object membertype,name)
{
if ($_m.MemberType -band $_method)
{
# Return a method...
$_base + $_expression + $sep + $_m.name + '('
}
else {
# Return a property...
$_base + $_expression + $sep + $_m.name
}
}
}
# If a command name contains any of these chars, it needs to be quoted
$_charsRequiringQuotes = ('`&@''#{}()$,;|<> ' + ""`t"").ToCharArray()
# If a variable name contains any of these characters it needs to be in braces
$_varsRequiringQuotes = ('-`&@''#{}()$,;|<> .\/' + ""`t"").ToCharArray()
switch -regex ($lastWord)
{
# Handle property and method expansion rooted at variables...
# e.g. $a.b.<tab>
'(^.*)(\$(\w|:|\.)+)\.([*\w]*)$' {
$_base = $matches[1]
$_expression = $matches[2]
$_pat = $matches[4] + '*'
Write-Members
break;
}
# Handle simple property and method expansion on static members...
# e.g. [datetime]::n<tab>
'(^.*)(\[(\w|\.|\+)+\])(\:\:|\.){0,1}([*\w]*)$' {
$_base = $matches[1]
$_expression = $matches[2]
$_pat = $matches[5] + '*'
Write-Members $(if (! $matches[4]) {'::'} else {$matches[4]})
break;
}
# Handle complex property and method expansion on static members
# where there are intermediate properties...
# e.g. [datetime]::now.d<tab>
'(^.*)(\[(\w|\.|\+)+\](\:\:|\.)(\w+\.)+)([*\w]*)$' {
$_base = $matches[1] # everything before the expression
$_expression = $matches[2].TrimEnd('.') # expression less trailing '.'
$_pat = $matches[6] + '*' # the member to look for...
Write-Members
break;
}
# Handle variable name expansion...
'(^.*\$)([*\w:]+)$' {
$_prefix = $matches[1]
$_varName = $matches[2]
$_colonPos = $_varname.IndexOf(':')
if ($_colonPos -eq -1)
{
$_varName = 'variable:' + $_varName
$_provider = ''
}
else
{
$_provider = $_varname.Substring(0, $_colonPos+1)
}
foreach ($_v in Get-ChildItem ($_varName + '*') | sort Name)
{
$_nameFound = $_v.name
$(if ($_nameFound.IndexOfAny($_varsRequiringQuotes) -eq -1) {'{0}{1}{2}'}
else {'{0}{{{1}{2}}}'}) -f $_prefix, $_provider, $_nameFound
}
break;
}
# Do completion on parameters...
'^-([*\w0-9]*)' {
$_pat = $matches[1] + '*'
# extract the command name from the string
# first split the string into statements and pipeline elements
# This doesn't handle strings however.
$_command = [regex]::Split($line, '[|;=]')[-1]
# Extract the trailing unclosed block e.g. ls | foreach { cp
if ($_command -match '\{([^\{\}]*)$')
{
$_command = $matches[1]
}
# Extract the longest unclosed parenthetical expression...
if ($_command -match '\(([^()]*)$')
{
$_command = $matches[1]
}
# take the first space separated token of the remaining string
# as the command to look up. Trim any leading or trailing spaces
# so you don't get leading empty elements.
$_command = $_command.TrimEnd('-')
$_command,$_arguments = $_command.Trim().Split()
# now get the info object for it, -ArgumentList will force aliases to be resolved
# it also retrieves dynamic parameters
try
{
$_command = @(Get-Command -type 'Alias,Cmdlet,Function,Filter,ExternalScript' `
-Name $_command -ArgumentList $_arguments)[0]
}
catch
{
# see if the command is an alias. If so, resolve it to the real command
if(Test-Path alias:\$_command)
{
$_command = @(Get-Command -Type Alias $_command)[0].Definition
}
# If we were unsuccessful retrieving the command, try again without the parameters
$_command = @(Get-Command -type 'Cmdlet,Function,Filter,ExternalScript' `
-Name $_command)[0]
}
# remove errors generated by the command not being found, and break
if(-not $_command) { $error.RemoveAt(0); break; }
# expand the parameter sets and emit the matching elements
# need to use psbase.Keys in case 'keys' is one of the parameters
# to the cmdlet
foreach ($_n in $_command.Parameters.psbase.Keys)
{
if ($_n -like $_pat) { '-' + $_n }
}
break;
}
# Tab complete against history either #<pattern> or #<id>
'^#(\w*)' {
$_pattern = $matches[1]
if ($_pattern -match '^[0-9]+$')
{
Get-History -ea SilentlyContinue -Id $_pattern | ForEach-Object { $_.CommandLine }
}
else
{
$_pattern = '*' + $_pattern + '*'
Get-History -Count 32767 | Sort-Object -Descending Id| ForEach-Object { $_.CommandLine } | where { $_ -like $_pattern }
}
break;
}
# try to find a matching command...
default {
# parse the script...
$_tokens = [System.Management.Automation.PSParser]::Tokenize($line,
[ref] $null)
if ($_tokens)
{
$_lastToken = $_tokens[$_tokens.count - 1]
if ($_lastToken.Type -eq 'Command')
{
$_cmd = $_lastToken.Content
# don't look for paths...
if ($_cmd.IndexOfAny('/\:') -eq -1)
{
# handle parsing errors - the last token string should be the last
# string in the line...
if ($lastword.Length -ge $_cmd.Length -and
$lastword.substring($lastword.length-$_cmd.length) -eq $_cmd)
{
$_pat = $_cmd + '*'
$_base = $lastword.substring(0, $lastword.length-$_cmd.length)
# get files in current directory first, then look for commands...
$( try {Resolve-Path -ea SilentlyContinue -Relative $_pat } catch {} ;
try { $ExecutionContext.InvokeCommand.GetCommandName($_pat, $true, $false) |
Sort-Object -Unique } catch {} ) |
# If the command contains non-word characters (space, ) ] ; ) etc.)
# then it needs to be quoted and prefixed with &
ForEach-Object {
if ($_.IndexOfAny($_charsRequiringQuotes) -eq -1) { $_ }
elseif ($_.IndexOf('''') -ge 0) {'& ''{0}''' -f $_.Replace('''','''''') }
else { '& ''{0}''' -f $_ }} |
ForEach-Object {'{0}{1}' -f $_base,$_ }
}
}
}
}
}
}
}
";
#endregion "PSv2 Tab Expansion Function"
#region Host Related Strings
internal const string CallId = "ci";

Some files were not shown because too many files have changed in this diff Show More