Skip to content

Instantly share code, notes, and snippets.

View dasMulli's full-sized avatar

Martin Andreas Ullrich dasMulli

  • Tietoevry Austria
  • Vienna, Austria
View GitHub Profile
@dasMulli
dasMulli / DemoSetup.wixproj
Last active February 21, 2022 07:22
Demo wix project to publish a self-contained .NET Core app
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>91e4dc15-312a-4e90-bc1c-01de5dc99447</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>CoreConsoleAppSetup</OutputName>
<OutputType>Package</OutputType>
@dasMulli
dasMulli / NSObject+MethodBlockReplacement.Tests.m
Last active April 7, 2018 14:53
Method replacement - dynamic subclassing in objective c
//
// InterceptionTests.m
//
// Created by Martin Ullrich on 19.07.13.
// Copyright (c) 2013 CSS Computer-Systems-Support GmbH. All rights reserved.
//
#import "InterceptionTests.h"
#import <RootKit/RootKit.h>
#import <objc/message.h>
@dasMulli
dasMulli / GitVersionedProject.csproj
Last active March 6, 2017 23:25
Demo of using Git branch with mapping + commit count to set version properties in csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<GitBranchToReleaseLabelMapping Include="master" ReleaseLabel="rtm" />
<GitBranchToReleaseLabelMapping Include="develop" ReleaseLabel="beta" />
@dasMulli
dasMulli / build.proj
Created March 14, 2017 22:19
Sample CI build definition using MSBuild
<Project>
<ItemGroup>
<Solution Include="*.sln" />
<PublishProject Include="XXX.Mvc\XXX.Mvc.csproj" />
<TestProject Include="**\*.Test*.*proj" Exclude="XXX.Tests.Shared\XXX.Tests.Shared.csproj" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(Solution)" Targets="Restore" ContinueOnError="ErrorAndStop" UnloadProjectsOnCompletion="true" UseResultsCache="false" />
<MSBuild Projects="@(PublishProject)" Targets="Publish" Properties="Configuration=Release" ContinueOnError="ErrorAndContinue" />
@dasMulli
dasMulli / ci-publish.proj.xml
Last active April 19, 2017 16:41
Publish (multiple) classic web application projects in multiple configurations to an output folder
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- CONFIGURE the configurations to publish for here -->
<PropertyGroup>
<ConfigurationsToPublish>Release;CD;UAT;Customer1;Customer2</ConfigurationsToPublish>
</PropertyGroup>
<!-- CONFIGURE the web projects to publish here. -->
<ItemGroup>
@dasMulli
dasMulli / TFSAggregatorPolicies.xml
Created March 24, 2017 14:57
Auto-activates and resolves work items when child work items change
<rule name="AutoActivate" appliesTo="Task,User Story,Feature,Bug">
<![CDATA[
if((string)self["System.State"] == "Active")
{
string currentParentState = null;
var requirementTypeNames = new[] { "User Story", "Feature", "Epic" };
if(self.HasParent() && (currentParentState = (string)self.Parent["System.State"]) != "Active")
{
string reason;
if (requirementTypeNames.Contains(self.Parent.TypeName))
@dasMulli
dasMulli / msbuild.sh
Last active May 9, 2017 20:14
Invokes msbuild with .net core sdk path on mac and linux. Copied with some edits from omnisharp-roslyn
#!/usr/bin/env bash
DOTNET_CLI_PATH="$(dirname $(which dotnet))/sdk/$(dotnet --version)"
export MSBuildExtensionsPath="$DOTNET_CLI_PATH/"
export CscToolExe="$DOTNET_CLI_PATH/Roslyn/RunCsc.sh"
export MSBuildSDKsPath="$DOTNET_CLI_PATH/Sdks"
msbuild /nologo /v:minimal "$@"
@dasMulli
dasMulli / build-with-docker.sh
Last active August 7, 2017 14:03
Sample asp.net core / .net core build setup
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
SRC_DIR="$(cd -P "$(dirname "$SOURCE")"&&pwd)"
WORKDIR="/usr/src"
IMAGENAME="microsoft/aspnetcore-build"
COMMAND="./build.sh"
docker pull "$IMAGENAME"
docker run --rm -w "$WORKDIR" -v "$SRC_DIR":"$WORKDIR" -- "$IMAGENAME" $COMMAND
@dasMulli
dasMulli / Directory.Build.targets
Last active February 27, 2020 17:18
Add Git commit count to version
<Project>
<PropertyGroup>
<GenerateNuspecDependsOn>AddGitCommitCountToVersion;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
<!-- this is only used in NuGet 4.6.0 -->
<GetPackageVersionDependsOn>AddGitCommitCountToVersion;$(GetPackageVersionDependsOn)</GetPackageVersionDependsOn>
</PropertyGroup>
<Target Name="AddGitCommitCountToVersion"
BeforeTargets="PrepareForBuild;_GenerateRestoreProjectSpec"
Condition=" '$(DisableGitVersionSuffix)' != 'true' ">
@dasMulli
dasMulli / Directory.Build.targets
Last active December 30, 2023 19:48
PublishAll target to publish for all frameworks and runtimes
<Project>
<Target Name="PublishProjectIfFrameworkSet"
DependsOnTargets="Publish"
Condition=" '$(TargetFramework)' != '' " />
<Target Name="PublishProjectForAllRIDsIfTargetFrameworkSet" Condition=" '$(TargetFramework)' != '' and '$(RuntimeIdentifiers)' != '' and '$(RuntimeIdentifier)' == '' ">
<ItemGroup>
<_PublishRuntimeIdentifier Include="$(RuntimeIdentifiers)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="PublishAll" Properties="TargetFramework=$(TargetFramework);RuntimeIdentifier=%(_PublishRuntimeIdentifier.Identity)" />