In windows 8.1 Environment.OSVersion underlying Win32 GetVersionEx function changed to for compatibility reasons report latest version app is compiled for.
Console.WriteLine(
System.Environment.OSVersion
);
<# | |
.SYNOPSIS | |
This is a Powershell script to dump console buffer as html to file. | |
.DESCRIPTION | |
This Powershell script will iterate over the current console buffer and | |
output it as html preserving colors. | |
.PARAMETER FilePath |
# Get last 100 log entries as a PowerShell object | |
$gitHist = (git log --format="%ai`t%H`t%an`t%ae`t%s" -n 100) | ConvertFrom-Csv -Delimiter "`t" -Header ("Date","CommitId","Author","Email","Subject") | |
# Now you can do iterate over each commit in PowerShell, group sort etc. | |
# Example to get a commit top list | |
$gitHist|Group-Object -Property Author -NoElement|Sort-Object -Property Count -Descending | |
# Example do something for each commit | |
$gitHist|% {if ($_.Author -eq "Mattias Karlsson") {"Me"} else {"Someone else"} } |
public class BuildData | |
{ | |
public string TaskName { get; set; } | |
} | |
Setup(context => new BuildData()); | |
TaskSetup<BuildData>( | |
(context, data) => data.TaskName = context.Task.Name | |
); |
[Tt]ools/ | |
[Aa]rtifacts/ | |
[Oo]bj/ | |
[Bb]in/ | |
.vscode/ |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp1.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" /> | |
</ItemGroup> |
Task("BOOM") | |
.Does(() => throw new Exception("BOOM")); | |
Teardown(ctx => { | |
for(var i = 1; i <= 15; i++) | |
{ | |
Information("Teardown {0}", i); | |
} | |
}); |
$CakeVersion = "0.34.1" | |
if (![string]::IsNullOrWhiteSpace($env:CAKE_VERSION)) | |
{ | |
$CakeVersion = $env:CAKE_VERSION | |
} | |
$IsRunningOnUnix = [System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Unix | |
# Make sure tools folder exists | |
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | |
$ToolPath = Join-Path $PSScriptRoot "tools" | |
if (!(Test-Path $ToolPath)) { |
// Switch expression | |
static string ToLevel(this Verbosity verbosity) | |
=> verbosity switch | |
{ | |
Verbosity.Diagnostic => "[****]", | |
Verbosity.Verbose => "[*** ]", | |
Verbosity.Normal => "[** ]", | |
Verbosity.Minimal => "[* ]", | |
Verbosity.Quiet => "[ ]", | |
_ => throw new ArgumentOutOfRangeException(message: "invalid enum value", |
$postSlackMessage = @{token="*topsecret*";channel="#general";text="Hello from PowerShell!";username="PowerShell";icon_url="https://pbs.twimg.com/profile_images/1604347359/logo_512x512_normal.png"} | |
Invoke-RestMethod -Uri https://slack.com/api/chat.postMessage -Body $postSlackMessage |