dotnet-outdated fails on new mstest template switch to Sdk MSTest.Sdk

Aberta
#589 2 comentários 1 reação 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
22/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
cli, csharp

Direção de pesquisa

The failure is in dotnet-outdated's package upgrade path when the project uses the MSTest.Sdk Project Sdk= attribute or Central Package Management, so start with the upgrade code that rewrites PackageReference and version entries in the project file. Reproduce by creating a project with <Project Sdk="MSTest.Sdk/3.5.1"> and running dotnet outdated -u, then check the error the tool swallows. Done means the upgrade succeeds for SDK-based and CPM projects and the existing tests still pass.

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

Descrição

With latest SDK Microsoft has introduced an new SDK for MSTest so there's no explicit package references in in csproj

dotnet-outdated correctly identifies packages that needs to be updated

» testmstest
  [net9.0]
  Microsoft.NET.Test.Sdk                     17.10.0 -> 17.11.1
  Microsoft.Testing.Extensions.CodeCoverage  17.11.3 -> 17.12.4
  Microsoft.Testing.Extensions.TrxReport     1.3.2   -> 1.4.0
  MSTest.Analyzers                           3.5.1   -> 3.6.0
  MSTest.TestAdapter                         3.5.1   -> 3.6.0
  MSTest.TestFramework                       3.5.1   -> 3.6.0

But when executing dotnet outdated -u all updates fails

Upgrading package Microsoft.NET.Test.Sdk...
An error occurred while upgrading testmstest


Upgrading package Microsoft.Testing.Extensions.CodeCoverage...
An error occurred while upgrading testmstest


Upgrading package Microsoft.Testing.Extensions.TrxReport...
An error occurred while upgrading testmstest


Upgrading package MSTest.Analyzers...
An error occurred while upgrading testmstest


Upgrading package MSTest.TestAdapter...
An error occurred while upgrading testmstest


Upgrading package MSTest.TestFramework...
An error occurred while upgrading testmstest

The csproj now looks like this:

<Project Sdk="MSTest.Sdk/3.5.1">

  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <LangVersion>latest</LangVersion>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <!--
      Displays error on console in addition to the log file. Note that this feature comes with a performance impact.
      For more information, visit https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-failure-per-test
      -->
    <TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
  </PropertyGroup>

</Project>

Updating SDK manually resolved most problems

- <Project Sdk="MSTest.Sdk/3.5.1">
+ <Project Sdk="MSTest.Sdk/3.6.0">

Results in one package still out of date

» testmstest
  [net9.0]
  Microsoft.NET.Test.Sdk  17.11.0 -> 17.11.1

update still fails

Upgrading package Microsoft.NET.Test.Sdk...
An error occurred while upgrading testmstest

Executing .NET Add manually results in this error which might be a lead.

dotnet add package Microsoft.NET.Test.Sdk --version 17.11.1

Build succeeded in 0,6s
info : X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
info : X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
info : Adding PackageReference for package 'Microsoft.NET.Test.Sdk' into project 'C:\temp\testmstest\testmstest.csproj'.
info : Restoring packages for C:\temp\testmstest\testmstest.csproj...
info :   CACHE https://api.nuget.org/v3/vulnerabilities/index.json
info :   CACHE https://api.nuget.org/v3-vulnerabilities/2024.09.24.23.37.09/vulnerability.base.json
info :   CACHE https://api.nuget.org/v3-vulnerabilities/2024.09.24.23.37.09/2024.09.25.17.37.11/vulnerability.update.json
info : Package 'Microsoft.NET.Test.Sdk' is compatible with all the specified frameworks in project 'C:\temp\testmstest\testmstest.csproj'.
error: Value cannot be null. (Parameter 'version')

Switching to Central Package Management (CPM) makes the update silently fail regardless if the package version exists or not in Directory.Packages.props

dotnet outdated
» testmstest
  [net9.0]
  Microsoft.NET.Test.Sdk  17.11.0 -> 17.11.1

Version color legend:
<red>   : Major version update or pre-release version. Possible breaking changes.
<yellow>: Minor version update. Backwards-compatible features added.
<green> : Patch version update. Backwards-compatible bug fixes.

You can upgrade packages to the latest version by passing the -u or -u:prompt option.
Elapsed: 00:00:02.3225000
Linguagem predominante
C#
Estrelas
1.7k
Forks
172
Merge médio
1d 19h
PRs com merge (30d)
39

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

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 dotnet-outdated/dotnet-outdated

Todas as issues de dotnet-outdated/dotnet-outdated

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.