Skip to content

Instantly share code, notes, and snippets.

@rglos
rglos / GetFileVersion.ps1
Last active July 9, 2018 20:17
Get versions of file via PowerShell
$path = "C:\Path\To\Some.dll"
$versionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($path)
$assemblyName = [System.Reflection.AssemblyName]::GetAssemblyName($path)
Write-Host ("FileName: {0}" -f $versionInfo.FileName)
Write-Host ("AssemblyVersion: {0}" -f $assemblyName.Version)
Write-Host ("AssemblyFileVersion: {0}" -f $versionInfo.FileVersion)
Write-Host ("AssemblyInformationalVersion: {0}" -f $versionInfo.ProductVersion)
# To return a result string in which absent digits or leading zeroes are replaced by spaces, use
# the composite formatting feature and specify a field width
# https://docs.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting
# specify 3 spaces
Write-Host ("{0,3:N0} 2345" -f 1)
# Output:
# 1 2345
@rglos
rglos / TrekAssignment.cs
Created October 16, 2017 19:03
Interview Assignment
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace PopularBikes
{