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 摘要。