Skip to content

Instantly share code, notes, and snippets.

View gep13's full-sized avatar

Gary Ewan Park gep13

View GitHub Profile
@iamarcel
iamarcel / Structuring Neat .NET Core Command Line Apps Neatly.org
Created September 7, 2016 07:30
Structuring Neat .NET Core Command Line Apps Neatly
@iamarcel
iamarcel / Creating Neat .NET Core Command Line Apps.md
Last active November 28, 2023 10:41
Creating Neat .NET Core Command Line Apps

Creating Neat .NET Core Command Line Apps

You can now read this on my (pretty) website! Check it out here.

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat

@haf
haf / Usage.txt
Last active April 20, 2018 13:33
Unlist lots of NuGet packages
Unlist all v4.* packages:
$ ./unlist.rb MyPackage v4.
Unlist specific version:
$ ./unlist.rb MyPackage v2.3.5
Unlist all versions:

Thoughts on project files

I missed last night's ASP.NET Community Standup on account of being shattered after a long day and falling asleep. Then I checked Twitter on the train this morning and discovered that the .NET world had, apparently, been burned to the ground by marauding Microsofties (again). It seemed to have something to do with project files, JSON vs XML, and suchlike.

Finally, lunchtime happened and I could watch the recording of the standup, and I got to understand what everyone was on about. In case you've missed it:

The TL;DR history

  1. In the beginning, there was make, and Gates did not own make, so Gates said "Let there be MSBuild" and there was MSBuild.
  2. And MSBuild used the *.*proj files from Visual Studio as its inputs, which were formed of terrible XML, and verily it was impossible to use without a Visual Studio license.
@dvdstelt
dvdstelt / PackageVersionsUsedInDeployments.cs
Created April 29, 2016 05:50
LINQPad script for retrieving package versions used in deployments
var endpoint = new OctopusServerEndpoint("http://54.169.230.0:8085/", "API-xxxxxxxxxxxxxxxxxxxxxxxxxx");
var client = new OctopusClient(endpoint);
var repo = new OctopusRepository(client);
var projects = repo.Projects.GetAll().Select (p => repo.Projects.Get(p.Id));
var allDeployments = projects.SelectMany(p=>repo.Deployments.FindMany(d=>d.ProjectId.Equals(p.Id)).Take(5)).GroupBy (p => p.ProjectId).SelectMany (p => p);
var nugetPackageIds = new List<string>(new string[]{"Webshop.Frontend", "Webshop.Backend", "Webshop.BusinessRules", "Webshop.Messages"});
foreach(var deployment in allDeployments)
@davidfowl
davidfowl / Example1.cs
Last active September 2, 2024 12:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
DotCoverCover(tool => {
tool.NUnit3(testDlls, new NUnit3Settings {
NoResults = true,
TeamCity = isOnTeamCity
});
},
@patriksvensson
patriksvensson / powershell.cake
Created March 8, 2016 09:20
Run PowerShell scripts from Cake
// Tools and addins
#addin "nuget:?package=System.Management.Automation&version=6.1.7601.17515"
using System.Collections;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Management.Automation.Runspaces;
using System.Threading;
///////////////////////////////////////////////////////////////////////////////
@ferventcoder
ferventcoder / RubyStack.ps1
Last active April 5, 2018 17:48
Full Ruby Stack Install using Chocolatey and PowerShell
# https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches
# Powershell specific argument passing
# You must be on the latest beta of chocolatey for this to work properly (redownload files)
choco upgrade chocolatey -pre
$originalPath = $env:PATH
choco install ruby --version 1.9.3.55100 -my --install-arguments '/verysilent /dir=""c:\tools\ruby193"" /tasks=""assocfiles""' --override-arguments
# DevKit for Ruby 1.x

Nuget package dependency resolution is broken by design. It incorrectly with resolve the oldest dependency listed, no matter how many bugs have been fixed in more recent versions. So please remember to do a nuget update to check if any newer versions of dependencies are available. The recommended approach is to update to the Highest Minor