Build Microsoft.PowerShell.CrossCompatibility for net8 like Engine and Rules

未關閉
#2,300 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
csharp, powershell

研究方向

Start with Microsoft.PowerShell.CrossCompatibility.csproj and compare its target frameworks and references with the Engine project. Then check PSCompatibilityCollector.psm1, PSCompatibilityCollector/build.ps1, and Directory.Packages.props to trace where the framework and package are selected. Done means CrossCompatibility builds for net8 and net462, Rules no longer receives the extra PowerShellStandard.Library reference, and the collector uses the matching Core build.

由索引模型根據 Issue 內容生成。

描述

Summary of the new feature

Since #2073, Engine and Rules target net8;net462 and compile against System.Management.Automation 7.4. Microsoft.PowerShell.CrossCompatibility, which Rules references, still targets netstandard2.0;net462 and compiles against PowerShellStandard.Library 5.1.1 for the Core build.

This has two effects:

  • PowerShellStandard.Library flows from CrossCompatibility into Rules, next to System.Management.Automation 7.4, so Rules gets two reference assemblies for System.Management.Automation. It only works because the SDK's conflict resolution picks the higher assembly version.
  • Building PSScriptAnalyzer needs PowerShellStandard.Library just for this one project.

The netstandard2.0 build lets PSCompatibilityCollector load on any PowerShell 6 or newer. Every supported PowerShell 7 is 7.4 or newer, which runs a net8 build, and the shipped profiles were last collected for PowerShell 7.0 (#1429).

Proposed technical implementation details (optional)

Target net8;net462 in CrossCompatibility, with System.Management.Automation for net8 like Engine:

  • Microsoft.PowerShell.CrossCompatibility.csproj: netstandard2.0 becomes net8, PowerShellStandard.Library becomes System.Management.Automation.
  • PSCompatibilityCollector.psm1 and PSCompatibilityCollector/build.ps1: netstandard2.0 becomes net8.
  • Directory.Packages.props: drop PowerShellStandard.Library.

The collector would then need PowerShell 7.4 or newer on Core. Windows PowerShell keeps the net462 build.

If you'd rather keep netstandard2.0, PrivateAssets="all" on the PowerShellStandard.Library reference would at least keep it from flowing into Rules, as it's only needed for compiling.

I can open a PR for either.

What is the latest version of PSScriptAnalyzer at the point of writing

1.25.0

主要語言
C#
星號
2.2k
分支
422
平均合併
2 小時 23 分鐘
30 天內合併 PR
25

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

PowerShell/PSScriptAnalyzer 的其他 Issue

查看 PowerShell/PSScriptAnalyzer 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。