Skip to content

Instantly share code, notes, and snippets.

View sliekens's full-sized avatar

Steven sliekens

View GitHub Profile
using System;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.Optimization;
[DebuggerStepThrough]
public static class BundleCollectionExtensions
{
public static void VerifyStyleBundles(this BundleCollection instance)
@sliekens
sliekens / FileDownloadBlock.cs
Created June 26, 2016 09:53
FileDownloadBlock
public class FileDownloadBlock : IPropagatorBlock<Uri, Stream>
{
private readonly IPropagatorBlock<Uri, Stream> impl = new TransformBlock<Uri, Stream>(new Func<Uri, Stream>(Implementation));
private static Stream Implementation(Uri uri)
{
throw new NotImplementedException();
}
public DataflowMessageStatus OfferMessage(
@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)" />