Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this version update is correct, I've noticed that this dependency and others (like xunit) are declared with explicit versions in multiple .csproj files. This can make dependency management cumbersome and error-prone.

To improve maintainability and ensure version consistency across all test projects, you could centralize package version management. A common way to achieve this in .NET projects is by using a Directory.Build.props file at the root of your solution or a shared parent directory. This would also be a good place to standardize other properties like LangVersion, which is currently inconsistent across projects (latest vs 10.0).

For example, you could create a Directory.Build.props file with the following content:

<Project>
  <PropertyGroup>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
    <PackageVersion Include="xunit" Version="2.9.3" />
    <PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
    <!-- Note: Aligning xunit.runner.visualstudio version -->
    <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
    <PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
    <PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
    <!-- etc. for other common packages -->
  </ItemGroup>
</Project>

Then, in your .csproj files, you can omit the Version attribute from the <PackageReference> elements. MSBuild will automatically use the versions defined in Directory.Build.props.

<PackageReference Include="Microsoft.NET.Test.Sdk" />

This would centralize version definitions, making future updates much simpler and ensuring consistency. As part of this, you could align the xunit.runner.visualstudio version, which is currently 2.4.3 in this project but 2.8.2 in Google.Apis.IntegrationTests.csproj.

<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<ProjectReference Include="..\Google.Apis.Auth\Google.Apis.Auth.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Src/Support/Google.Apis.Tests/Google.Apis.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
Expand Down