Skip to content

Instantly share code, notes, and snippets.

View sayedihashimi's full-sized avatar

Sayed Ibrahim Hashimi sayedihashimi

View GitHub Profile
@sayedihashimi
sayedihashimi / sample.config
Created March 17, 2015 17:42
XDT Transform samples
<configuration>
<connectionStrings>
<clear/>
<add name="Default" connectionString="Data Source=localhost;Initial Catalog=Sample01;Integrated Security=True;" />
</connectionStrings>
<appSettings>
<add key="contactEmail" value="contact@demo.example.com"/>
<add key="siteUrl" value="http://demo.example.com"/>
</appSettings>
@sayedihashimi
sayedihashimi / nopreorpostevents.targets
Created April 16, 2015 09:47
This file will disable pre and post build events globally in MSBuild and Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
You can use this file to disable pre and post events globally across both MSBuild and Visual Studio.
To use this file, you have two options.
1. Save this file as C:\Program Files (x86)\MSBuild\v14.0\Custom.After.Microsoft.Common.targets
Or whatever the value of the MSBuild property $(CustomAfterMicrosoftCommonTargets).
2. Save this file to a random location, lets say C:\temp\msbuild\nopreorpostevents.targets,
then set the CustomAfterMicrosoftCommonTargets env var to point to that file. Then start Visual Studio.

MSBuild Feedback

This feedback is on the experience of using MSBuild, not just on msbuild.exe

Not in any order, I may sort them later.

Have people want to author scripts using MSBuild

Today creating and maintaining MSBuild scripts is challenging. Some of the challenges for the user include.

@sayedihashimi
sayedihashimi / measure-directory.ps1
Last active August 29, 2015 14:25
PowerShell Measure-Directory function
function Measure-Directory{
[cmdletbinding()]
param(
[Parameter(Position=0,ValueFromPipeline=$true)]
[System.IO.DirectoryInfo[]]$path,
[switch]$recurse
)
process{
foreach($srcpath in $path){
function Get-ScriptDirectory{
split-path (((Get-Variable MyInvocation -Scope 1).Value).MyCommand.Path)
}
$scriptDir = ((Get-ScriptDirectory) + "\")
Add-Type -Path (Join-Path $scriptDir 'bin\Geoffry.Watch.dll')
$watcherdef = New-Object -TypeName 'Geoffry.Watch.WatchDefinition'
$watcherdef.GlobbingPattern = '**/*.css'
$watcherdef.RootDirectory = (Join-Path $scriptDir 'src\css')
@sayedihashimi
sayedihashimi / add-path.ps1
Created September 26, 2015 03:40
PowerShell Add-Path function
# Based on:
# http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/23/use-powershell-to-modify-your-environmental-path.aspx
# Based on:
# http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/23/use-powershell-to-modify-your-environmental-path.aspx
function Add-Path{
[cmdletbinding()]
param(
[Parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)]
[string[]]$pathToAdd
)
@sayedihashimi
sayedihashimi / appsettings.production.json
Last active November 4, 2015 06:39
Sample config files
{
"Settings": {
"RootUrl": "http://contoso.com",
"AdminEmail": "admin@contoso.com",
"LoggingId": "a4acff0b-c3e3-4344-94eb-264b71840f3e"
},
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=tcp:contoso.database.windows.net,1433;Database=contoso_db;User ID=contosodbuser@contoso;Password=my-actual-prod-password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
},
@sayedihashimi
sayedihashimi / profile.pubxml
Created January 26, 2016 21:47
Shows how to override publishUrl with Configuration
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
@sayedihashimi
sayedihashimi / sample.ps1
Created February 10, 2016 07:25
pecan waffle ideas
# OPTION 1
$itemTemplate = new-itemtemplate 'aspnet5-empty' 'ASP.NET 5 empty project' -properties @{
DefaultProjectName = 'MyEmptyProject'
LicenseUrl = 'https://raw.githubusercontent.com/ligershark/pecan-waffle/master/LICENSE'
ProjectUrl = 'https://github.com/ligershark/pecan-waffle'
GitUrl = 'https://github.com/ligershark/pecan-waffle.git'
GitBranch = 'master'
BeforeInstall = { 'before install' | Write-Host -ForegroundColor Cyan}
AfterInstall = { 'after install' | Write-Host -ForegroundColor Cyan}
@sayedihashimi
sayedihashimi / test.ps1
Created February 17, 2016 22:27
ps sample
[cmdletbinding()]
param(
[Parameter(Position=0)]
$branch = 'master'
)
'Branch [{0}]' -f $branch | Write-Output