Overview
Cuemon.Extensions.Diagnostics adds a narrow bridge between System.Diagnostics.FileVersionInfo and the VersionResult model from Cuemon.Diagnostics. Its two extension methods let callers promote raw assembly metadata strings into the same typed version value used elsewhere in the Cuemon diagnostics stack.
That makes the package useful at the point where binary metadata becomes application logic. You keep using the framework API to inspect an assembly, then convert the selected version field once and continue with a value that fits the surrounding Cuemon diagnostics abstractions.
Key APIs
FileVersionInfoExtensions is the package's only public type. It keeps the conversion entry points attached to FileVersionInfo, so consumers can stay on the BCL metadata type instead of routing version extraction through a separate helper object.
ToProductVersion reads FileVersionInfo.ProductVersion and wraps that string in a VersionResult. Use it when the product version is the value you expose in release labels, diagnostics, or package metadata.
ToFileVersion reads FileVersionInfo.FileVersion and wraps that string in a VersionResult. This is the lower-level assembly file version path when you need the exact file version field instead of the product-facing version field.
Basic usage
using System.Diagnostics;
using Codebelt.Extensions.Xunit;
using Cuemon.Extensions.Diagnostics;
using Xunit;
namespace Contoso.ReleaseChecks.Tests;
public class AssemblyVersionSnapshotTest : Test
{
public AssemblyVersionSnapshotTest(ITestOutputHelper output) : base(output)
{
}
[Fact]
public void ShouldCaptureAssemblyProductAndFileVersionsAsVersionResults()
{
var versionInfo = FileVersionInfo.GetVersionInfo(typeof(AssemblyVersionSnapshotTest).Assembly.Location);
var productVersion = versionInfo.ToProductVersion();
var fileVersion = versionInfo.ToFileVersion();
TestOutput.WriteLine($"Product version: {productVersion}");
TestOutput.WriteLine($"File version: {fileVersion}");
Assert.Equal(versionInfo.ProductVersion, productVersion.ToString());
Assert.Equal(versionInfo.FileVersion, fileVersion.ToString());
}
}
Use this pattern when release or support code starts from FileVersionInfo but the rest of the workflow expects Cuemon version values instead of raw strings. It matters because the conversion stays at the metadata boundary and avoids repeating ad hoc version parsing logic throughout the calling code.
Installation
dotnet add package Cuemon.Extensions.Diagnostics
Usage guidance
Use this package when you already inspect assemblies with FileVersionInfo and want the result to flow into Cuemon's VersionResult model without custom conversion code. If raw ProductVersion or FileVersion strings are enough, stay with the framework API, and if you need broader timing or exception-description features, look to Cuemon.Diagnostics as the underlying package this extension layer builds on.
Family packages
- 🌐Cuemon.AspNetCore
- 🏭Cuemon.AspNetCore.App
- 🌐Cuemon.AspNetCore.Authentication
- 🌐Cuemon.AspNetCore.Mvc
- 🌐Cuemon.AspNetCore.Razor.TagHelpers
- 📦Cuemon.Core
- 🏭Cuemon.Core.App
- 🗄️Cuemon.Data
- 🗄️Cuemon.Data.Integrity
- 🗄️Cuemon.Data.SqlClient
- 🩺Cuemon.Diagnostics
- 🌐Cuemon.Extensions.AspNetCore
- 🌐Cuemon.Extensions.AspNetCore.Authentication
- 🌐Cuemon.Extensions.AspNetCore.Mvc
- 🌐Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json
- 🌐Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml
- 🌐Cuemon.Extensions.AspNetCore.Mvc.RazorPages
- 🌐Cuemon.Extensions.AspNetCore.Text.Json
- 🌐Cuemon.Extensions.AspNetCore.Xml
- 📦Cuemon.Extensions.Collections.Generic
- 📦Cuemon.Extensions.Collections.Specialized
- 📦Cuemon.Extensions.Core
- 🗄️Cuemon.Extensions.Data
- 🗄️Cuemon.Extensions.Data.Integrity
- 📦Cuemon.Extensions.DependencyInjection
- 🏗️Cuemon.Extensions.Hosting
- 📦Cuemon.Extensions.IO
- 📦Cuemon.Extensions.Net
- 📦Cuemon.Extensions.Reflection
- 📦Cuemon.Extensions.Runtime.Caching
- 📝Cuemon.Extensions.Text
- 📝Cuemon.Extensions.Text.Json
- 📦Cuemon.Extensions.Threading
- 📦Cuemon.Extensions.Xml
- 📦Cuemon.IO
- ⚙️Cuemon.Kernel
- 📦Cuemon.Net
- 📦Cuemon.Resilience
- 📦Cuemon.Runtime.Caching
- 🔐Cuemon.Security.Cryptography
- 📦Cuemon.Threading
- 📦Cuemon.Xml