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

Aberta
#2,300 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
55/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
csharp, powershell
Domínio
backend, build-system

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
C#
Estrelas
2.2k
Forks
422
Merge médio
2h 23min
PRs com merge (30d)
25

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PowerShell/PSScriptAnalyzer

Todas as issues de PowerShell/PSScriptAnalyzer

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.