DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,911 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Kevin Wang
Kevin Wang

Posted on

using github action to triage your nuget packages for .net solutions

Do you often work on a .net solution with many projects?

Do you ever find Newtonsoft.Json is installed with different versions across the whole solution?

And do you find some nuget packages are 5 years old that never have been updated or even been no longer maintained and unpublished?

Or find your projects/solutions are using pre-released packages that are not very reliable for production usage?

I have been struggling with these stuff during most of my projects. It is not a difficult task to fix them up, but it definitely requires some sort of trigger to examine the above scenarios regularly from time to time.

So I am wondering if I can make it part of the CI/CD process, regularly perform checks against consumed nuget packages, for solutions/projects. With nuget.org’s public API and I chuck in some dotnet core to build a little console app to achieve sanity triage of all these installed nuget dependencies. And it works out really well for me.

Here it comes NuSight

NuSight is tiny .net core console app I built to help your triage your .net solutions for the nuget packages. It is open source and you can find the source code from github. Also it has been published to nuget.org as a dotnet tool
NuSight 1.2.2
*This is a .net tool that analyze your solution folder, discover all your project files and diagnose all the nuget…*www.nuget.org

To install it and use it, you need dotnet CLI and run this command,

dotnet tool install --global NuSight

Use it with github actions

Submission Category:

[Note]: # Maintainer Must-Haves

Yaml File or Link to Code

name: Build-Nusight

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.1.301    
    - name: Install dependencies
      working-directory: ./NuSightConsole
      run: dotnet restore
    - name: Build
      working-directory: ./NuSightConsole
      run: dotnet build --configuration Release --no-restore
    - name: Nuget triage
      working-directory: ./NuSightConsole
      run: | 
        dotnet tool install -g NuSight
        nusight list -o -i -p -u

Additional Resources / Info

https://github.com/superwalnut/NuSight

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.