Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added support for updating dependencies file - #535

#535
Open
careri wants to merge 1 commit into
dotnet-outdated:masterdotnet-outdated/dotnet-outdated:masterfrom
careri:dependencies-file-supportcareri/dotnet-outdated:dependencies-file-supportCopy head branch name to clipboard
Open

Added support for updating dependencies file#535
careri wants to merge 1 commit into
dotnet-outdated:masterdotnet-outdated/dotnet-outdated:masterfrom
careri:dependencies-file-supportcareri/dotnet-outdated:dependencies-file-supportCopy head branch name to clipboard

Conversation

@careri

@careri careri commented Mar 13, 2024

Copy link
Copy Markdown

Added support for updating a shared dependencies file that updates the defined package references in csproj files.
E.g. A csproj without versions defined:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" />
    <PackageReference Include="Swashbuckle.AspNetCore" />
    <PackageReference Include="Newtonsoft.Json" />
    <PackageReference Include="Mediatr" />
    <PackageReference Include="OpenTelemetry" />
    <PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
    <PackageReference Include="OpenTelemetry.Exporter.Console" />
    <PackageReference Include="OpenTelemetry.Extensions.Hosting" />
    <PackageReference Include="OpenTelemetry.Instrumentation.Http" />
    <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
  </ItemGroup>

</Project>

And the versions in the dependencies file:

<?xml version="1.0" encoding="utf-8"?>
<Project>
  <PropertyGroup>
    <NetCoreVersion>8.0.3</NetCoreVersion>
    <NetAnalyzersVersion>8.0.0</NetAnalyzersVersion>
    <RoslynatorVersion>4.11.0</RoslynatorVersion>
    <OpenTelemetryVersion>1.7.0</OpenTelemetryVersion>
    <OpenTelemetryInstrumentationVersion>$(OpenTelemetryVersion)</OpenTelemetryInstrumentationVersion>
  </PropertyGroup>
  <ItemGroup Label="Microsoft">
    <PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(NetCoreVersion)" />
    <PackageReference Update="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
  </ItemGroup>
  <ItemGroup Label="Others">
    <PackageReference Update="Swashbuckle.AspNetCore" Version="6.5.0" />
    <PackageReference Update="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Update="Mediatr" Version="12.2.0" />
    <PackageReference Update="OpenTelemetry" Version="$(OpenTelemetryVersion)" />
    <PackageReference Update="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="$(OpenTelemetryVersion)" />
    <PackageReference Update="OpenTelemetry.Exporter.Console" Version="$(OpenTelemetryVersion)" />
    <PackageReference Update="OpenTelemetry.Extensions.Hosting" Version="$(OpenTelemetryVersion)" />
    <PackageReference Update="OpenTelemetry.Instrumentation.Http" Version="$(OpenTelemetryInstrumentationVersion)" />
    <PackageReference Update="OpenTelemetry.Instrumentation.AspNetCore" Version="$(OpenTelemetryInstrumentationVersion)" />
  </ItemGroup>
</Project>

The new DependencyFileAddPackageService will only update the versions in the properties file.
To run with the DependencyFileAddPackageService you provide the new option

[Option(CommandOptionType.SingleValue, Description = "Use a dependencies update file. csproj files will remain unmodified",
            ShortName = "dpf", LongName = "dependency-file")]

I also refactored the Program.cs a bit to simplify testing with mocked out components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.