Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Andreas Ullrich dasMulli

  • Tieto Austria
  • Vienna, Austria
View GitHub Profile
@dasMulli
dasMulli / build.proj
Created Mar 14, 2017
Sample CI build definition using MSBuild
View build.proj
<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 / DemoSetup.wixproj
Last active Mar 12, 2021
Demo wix project to publish a self-contained .NET Core app
View DemoSetup.wixproj
<?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 / Directory.Build.targets
Last active Jan 18, 2021
Allow `dotnet test` to be run from solution directory
View Directory.Build.targets
<Project>
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>
</Project>
@dasMulli
dasMulli / Directory.Build.targets
Last active Nov 6, 2020
TFM based feature flags as compiler constants
View Directory.Build.targets
<Project>
<ItemGroup>
<FeatureFlag Include="SUPPORTS_ECDSA" MinimumTargetFrameworks="netstandard1.6;net47" />
<FeatureFlag Include="SUPPORTS_GENERIC_HOST" MinimumTargetFrameworks="netcoreapp2.2;netstandard2.1" />
<FeatureFlag Include="SUPPORTS_SERVICE_PROVIDER_IN_HTTP_MESSAGE_HANDLER_BUILDER" MinimumTargetFrameworks="netcoreapp2.2;netstandard2.1" />
<FeatureFlag Include="SUPPORTS_CERTIFICATE_HASHING_WITH_SPECIFIED_ALGORITHM" MinimumTargetFrameworks="netcoreapp2.1;netstandard2.1;net48" />
</ItemGroup>
<!--
@dasMulli
dasMulli / Directory.Build.targets
Created Oct 17, 2020
Compiler consant for minimum framework version
View Directory.Build.targets
<Project>
<!--
neeeds to be in Directory.Build.targets to be included
after SDK's TargetFrameworkIdentifier/-Version inference
-->
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NetCoreApp'
and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))">
<DefineConstants>$(DefineConstants);AT_LEAST_NET5_0</DefineConstants>
</PropertyGroup>
</Project>
@dasMulli
dasMulli / traversal.proj
Created Jun 4, 2020
Traversal project
View traversal.proj
<Project>
<ItemGroup>
<Projects Include="$(MSBuildStartupDirectory)\**\*.*proj" />
</ItemGroup>
<Target Name="VSTest">
<Message Importance="High" Text="Found project: %(Projects.Identity)" />
<MSBuild Projects="@(Projects)" Targets="VSTest" BuildInParallel="true" SkipNonexistentTargets="true" />
</Target>
<Target Name="Restore">
<Message Importance="High" Text="Found project: %(Projects.Identity)" />
@dasMulli
dasMulli / Directory.Build.targets
Last active Mar 31, 2020
CI build script for a mvc + Webpack SPA app
View Directory.Build.targets
<Project>
<Target Name="NpmInstall" Condition="Exists('package.json')">
<Exec Command="npm install" />
</Target>
<Target Name="NpmCiTest" Condition="Exists('package.json')">
<Exec Command="npm run ci-test" />
<ItemGroup Condition="'$(TestResultsOutputPath)' != ''">
<TestResultFiles Include="obj\karma-testresults\**" />
@dasMulli
dasMulli / Directory.Build.targets
Last active Feb 27, 2020
Add Git commit count to version
View Directory.Build.targets
<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 / ns.cmd
Created Feb 25, 2020
Kubernetes namespace switching utility for Windows
View ns.cmd
@echo off
if "%~1"=="" GOTO PRINTNAMESPACE
: SETNAMESPACE
kubectl config set-context --current --namespace="%~1"
: PRINTNAMESPACE
@dasMulli
dasMulli / profiles.json
Created Sep 16, 2019
Windows Terminal config with VS 2019 Devekioer Command Prompt / PowerShell
View profiles.json
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"initialCols" : 160,
"initialRows" : 40,
"keybindings" :
[
{