UoN.AspNetCore.VersionMiddleware 1.1.1

dotnet add package UoN.AspNetCore.VersionMiddleware --version 1.1.1
NuGet\Install-Package UoN.AspNetCore.VersionMiddleware -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UoN.AspNetCore.VersionMiddleware" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UoN.AspNetCore.VersionMiddleware --version 1.1.1
#r "nuget: UoN.AspNetCore.VersionMiddleware, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UoN.AspNetCore.VersionMiddleware as a Cake Addin
#addin nuget:?package=UoN.AspNetCore.VersionMiddleware&version=1.1.1

// Install UoN.AspNetCore.VersionMiddleware as a Cake Tool
#tool nuget:?package=UoN.AspNetCore.VersionMiddleware&version=1.1.1

UoN.AspNetCore.VersionMiddleware

License Build Status NuGet

What is it?

This is middleware for ASP.Net Core designed to report on version information related to your project.

We use it at UoN so that we can check the version of a web app wherever it's deployed, without having to display it publicly to users who don't care. This is useful for ensuring testers know which builds they're working with and therefore what fixes to test.

What are its features?

It exposes the version output of UoN.VersionInformation as JSON data at an http endpoint.

Middleware Extension Methods

It provides three IApplicationBuilder Extension methods for you to use in Startup.Configure():

  • app.UseVersion(source)
    • adds a /version route to the ASP.Net Core pipeline.
    • expects a valid source accepted by VersionInformationService
  • app.MapVersion(path, source)
    • behaves as above but with a custom route path
  • app.MapVersion(path, assembly)
    • provides a custom route path
    • returns AssemblyInformationalVersion for the specified assembly as a JSON string

Dependencies

The library targets netstandard2.0 and depends upon ASP.NET Core 2.0 and UoN.VersionInformation.

If you can use ASP.NET Core 2, you can use this library.

Example usage

Startup.cs
public class Startup
{
  ...

  // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
    if (env.IsDevelopment())
    {
      app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Home/Error");
    }

    app.UseVersion(); //adds `/version` to the pipeline, so if that endpoint is requested, the pipeline will short circuit here
    
    app.UseStaticFiles();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });
  }
}

Building from source

We recommend building with the dotnet cli, but since the package targets netstandard2.0 and depends only on ASP.Net Core 2.0, you should be able to build it in any tooling that supports those requirements.

  • Have the .NET Core SDK 2.0 or newer
  • dotnet build
  • Optionally dotnet pack
  • Reference the resulting assembly, or NuGet package.

Contributing

Contributions are unlikely to be needed often as this is a library with a very specific purpose.

If there are issues open, please feel free to make pull requests for them, and they will be reviewed.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 9,023 5/9/2018
1.1.0 962 5/2/2018
1.0.0 885 11/10/2017

This release makes the JSON output from the middleware indented.