Skip to content

Instantly share code, notes, and snippets.

View jlattimer's full-sized avatar

Jason Lattimer jlattimer

View GitHub Profile
@jlattimer
jlattimer / FixEasyReproPackageReferences.ps1
Created April 14, 2019 16:19
Ensures an EasyRepro project's Selenium references match what is supported #blog
Write-Host "Checking EasyRepro package references"
$ProjectPath = ((Get-Item $PSScriptRoot).Parent).FullName
$Parameters = @{
ProjectPath = $ProjectPath
References = @(
[PSCustomObject]@{ Assembly = "Selenium.Support"; Version = '3.11.2' }, # Selenium
[PSCustomObject]@{ Assembly = "Selenium.WebDriver"; Version = '3.11.2' }, # Selenium
[PSCustomObject]@{ Assembly = "Selenium.Chrome.WebDriver"; Version = '2.38' }, # Chrome
[PSCustomObject]@{ Assembly = "Selenium.WebDriver.GeckoDriver.Win64"; Version = '0.16.1' }, # Firefox
@jlattimer
jlattimer / SDKPluginRegistrationTool.nuspec
Created February 22, 2019 04:59
.nuspec file for the Chocolatey package from the D365 Plug-in Registration Tool #blog
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.JL</id>
<title>Microsoft Dynamics 365 Plugin Registration Tool</title>
<version>9.0.2.11</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<summary>Plugin Registration Tool required to manage Plugin assemblies,Workflow assemblies,Virtual Entitles, and Service endpoints for Microsoft Dynamics 365.</summary>
@jlattimer
jlattimer / SDKPluginRegistrationTool.ps1
Created February 22, 2019 04:56
Creates a Chocolatey package from the D365 Plug-in Registration Tool #blog
### Prerequisities ###
# 1. Chocolatey is already installed, if not uncomment the next line
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# 2. NuGet.org is configured as a package provider, if not uncomment the next 2 lines
# Install-PackageProvider Nuget -Force -verbose
# Register-PackageSource -Name nuget.org -Location https://www.nuget.org/api/v2 -ProviderName NuGet
# 3. If committing files in Azure DevOps, under Project Setting -> Repositories -> Project Repo - Project Collection Build Service
# needs to have Contribute permission set to Allow
# 4. Azure DevOps build needs to enable: Allow scripts to access the OAuth token
@jlattimer
jlattimer / GetMetadataFromNuGetPackage.ps1
Created February 22, 2019 04:25
Retrieves a package from a NuGet provider and lists different metadata #blog
#Install-PackageProvider Nuget -Force -verbose
#Register-PackageSource -Name nuget.org -Location https://www.nuget.org/api/v2 -ProviderName NuGet
#Register-PackageSource -Name chocolatey.org -Location https://chocolatey.org/api/v2 -ProviderName NuGet
$PackageName = "Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf"
$packages = Find-Package -Name $PackageName -ProviderName NuGet -Source "nuget.org"
Write-Host "Version :"$packages[0].Version
foreach($key in $packages[0].Links) {
@jlattimer
jlattimer / GetLatestSolutionPatchInfo.ps1
Last active February 1, 2019 16:36
Given a solution uniquename this sets build variables for the uniquename & version of the latest patch of a solution or the base solution's uniquename & version if no patches exist #blog
# Install Microsoft.Xrm.Data.Powershell if not found
if (!(Get-Module "Microsoft.Xrm.Data.Powershell")) {
Install-Module -Name Microsoft.Xrm.Data.Powershell -AcceptLicense -AllowClobber -Force -Scope AllUsers
}
$SearchSoltionName = "SolutionName"
$ReturnSolutionName = $SearchSoltionName
$ReturnSolutionVersion = "_1_0_0_0"
$User = "$(D365Username)"
@jlattimer
jlattimer / start.ps1
Last active January 22, 2019 17:04
Windows server Docker container suitable for D365 CE builds & tests from Azure DevOps (start.ps1) v1.0 #blog
# https://sigaostudios.com/azure-devops-build-and-release-agents-with-docker/
# D365 CE Build/Test Server v1.1
$ErrorActionPreference = "Stop"
$env:VSTS_ACCOUNT = "Azure DevOps instance name"
$env:VSTS_TOKEN = "Azure DevOps Personal Access Token"
$env:VSTS_POOL = ""
If ($env:VSTS_ACCOUNT -eq $null) {
@jlattimer
jlattimer / start.cmd
Created January 15, 2019 04:13
Windows server Docker container suitable for D365 CE builds & tests from Azure DevOps (start.cmd) v1.0 #blog
PowerShell.exe -ExecutionPolicy ByPass .\start.ps1
@jlattimer
jlattimer / Dockerfile
Last active September 10, 2020 02:19
Windows server Docker container suitable for D365 CE builds & tests from Azure DevOps (Dockerfile) v1.0 #blog
# escape=`
# D365 CE Build/Test Server v1.1
# Run with 2 processors and 2 GB of memory otherwise EasyRepro tests might not run
# Azure Container Instances currently only support the LTSC Windows versions
FROM microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
@jlattimer
jlattimer / BuildTimeToAppInsights.ps1
Created January 5, 2019 23:21
Send Azure DevOps build time to Application Insights as a custom metric #blog
$startBuild = Get-Date -Date "$Env:System_PipelineStartTime"
Write-Host "Start time: $startBuild"
$endBuild = Get-Date
Write-Host "End time: $endBuild"
$ts = New-TimeSpan -Start $startBuild -End $endBuild
$tm = [math]::Round($ts.TotalMinutes, 2)
Write-Host "Build time (min): $tm"
# $(AppInsightsKey) should be your Application Insights Instrumentation Key
if (-Not ('$(AppInsightsKey)' -match("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$")))
@jlattimer
jlattimer / GetDuration.csx
Created March 12, 2018 03:26
Application Insights / Flow duration calculator #blog
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("Starting Function");
string start = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "start", true) == 0)
.Value;