Skip to content

Instantly share code, notes, and snippets.

View sliekens's full-sized avatar

Steven sliekens

View GitHub Profile
@sliekens
sliekens / MOVED.md
Last active January 5, 2017 11:51
T-SQL migration helpers
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OnAfterPipelineCollectFilesPhase>
$(OnAfterPipelineCollectFilesPhase);
MSDeploySetParametersFile;
MSDeploySetParameters;
MSDeploySetParametersUpdate;
</OnAfterPipelineCollectFilesPhase>
</PropertyGroup>
@sliekens
sliekens / DeploymentWellKnownTag.cs
Created April 26, 2016 11:39
DeploymentWellKnownTag
namespace Microsoft.Web.Deployment
{
public enum DeploymentWellKnownTag
{
None = 0b0000000000000000000000000000000000000000000000000000000000000000,
AppHostConfig = 0b0000000000000000000000000000000000000000000000000000000000000001,
AppPoolConfig = 0b0000000000000000000000000000000000000000000000000000000000000010,
Boolean = 0b0000000000000000000000000000000000000000000000000000000000000100,
ComObject32 = 0b0000000000000000000000000000000000000000000000000000000000001000,
ComObject64 = 0b0000000000000000000000000000000000000000000000000000000000010000,
@sliekens
sliekens / AddProjectReferences.ps1
Last active February 16, 2016 13:18
PowerShell script to recursively add all project references to a solution for the selected project.
function AddProjectReferences($project, $solution, $fullName)
{
$projects = $solution | select FullName
if ($projects.FullName -notcontains $fullName)
{
$solution.AddFromFile($fullName)
}
$dir = [System.IO.Path]::GetDirectoryName($fullName)
[xml]$msbuild = Get-Content $fullName
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(WebPublishMethod)' == 'FileSystem'">
<publishUrl Condition="!HasTrailingSlash('$(publishUrl)')">$(publishUrl)\</publishUrl>
<publishUrl>$(publishUrl)$(Configuration)\</publishUrl>
</PropertyGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Windows specific commands -->
<NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
@sliekens
sliekens / target.xml
Created January 25, 2016 08:28
A list of all <Target /> tags that ship with MSBuild / Visual Studio
C:\Program Files (x86)\MSBuild\12.0\Bin\Microsoft.Common.CurrentVersion.targets
<Target Name="_CheckForInvalidConfigurationAndPlatform"></Target>
<Target Name="Build" Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(BuildDependsOn)" Returns="$(TargetPath)" />
<Target Name="BeforeBuild" />
<Target Name="AfterBuild" />
<Target Name="CoreBuild" DependsOnTargets="$(CoreBuildDependsOn)"></Target>
<Target Name="Rebuild" Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(RebuildDependsOn)" Returns="$(TargetPath)" />
<Target Name="BeforeRebuild" />
<Target Name="AfterRebuild" />
<Target Name="BuildGenerateSources" DependsOnTargets="BuildGenerateSourcesTraverse;$(BuildGenerateSourcesAction)" />
@sliekens
sliekens / App.csproj
Last active January 20, 2016 13:31
BuildPackage
<Target Name="AfterBuild" DependsOnTargets="BuildPackage" />
<Target Name="BuildPackage" DependsOnTargets="BuildPackageCore" Outputs="$(Packages)" Condition=" '$(BuildPackage)' == 'True' " />
<Target Name="BuildPackageCore">
<PropertyGroup>
<!-- Escape the OutDir's trailing slash -->
<_PackagesOutDir Condition="HasTrailingSlash('$(OutDir)')">"$(OutDir)\"</_PackagesOutDir>
<_PackagesOutDir Condition="!HasTrailingSlash('$(OutDir)')">"$(OutDir)\\"</_PackagesOutDir>
</PropertyGroup>
<Exec ContinueOnError="ErrorAndContinue" ConsoleToMSBuild="True" Command="&quot;$(SolutionDir)tools\nuget.exe&quot; pack &quot;$(MSBuildThisFileFullPath)&quot; -Symbols -IncludeReferencedProjects -OutputDirectory $(_PackagesOutDir) -Properties Configuration=$(Configuration)">
<Output TaskParameter="ConsoleOutput" ItemName="_out" />
namespace Common
{
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
[DebuggerDisplay(
"Display name = {Name}, alpha-2 = {TwoLetterCode}, alpha-3 = {ThreeLetterCode}, numeric = {NumericCode}")]
public sealed class Country
@sliekens
sliekens / cmdts.cs
Last active September 6, 2015 18:40
Add timestamps to console output
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
namespace Sys
{
class Program
{