Skip to content

Instantly share code, notes, and snippets.

@pldmgg
Last active August 18, 2017 17:20
Show Gist options
  • Save pldmgg/6bdc580120e305489b9014892adcef52 to your computer and use it in GitHub Desktop.
Save pldmgg/6bdc580120e305489b9014892adcef52 to your computer and use it in GitHub Desktop.
Inspect a downloaded .nupkg and find the "best" .dll version to use. Also output list of compatible platforms.
function Get-NuGetDLL {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[string]$PathToZip = $(Read-Host -Prompt "Please enter the full path to a .nupkg or .zip file")
)
<#
# Reference: https://docs.microsoft.com/en-us/dotnet/standard/net-standard
.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0
.NET Framework (with .NET Core 1.x SDK) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.2 4.7* ???
.NET Framework (with .NET Core 2.0 SDK) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 5.4
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.14
Xamarin.Mac 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.8
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.5
Universal Windows Platform 10.0 10.0 10.0 10.0 10.0 vNext vNext vNext
Windows 8.0 8.0 8.1
Windows Phone 8.1 8.1 8.1
Windows Phone Silverlight 8.0
*I added these entries based on this GitHub issue thread:
https://github.com/dotnet/docs/pull/2353
#>
if (!$(Test-Path $PathToZip)) {
Write-Error "The path $PathToZip was not found! Did you use a full path? Halting!"
$global:FunctionResult = "1"
return
}
if ($(Get-Item $PathToZip).Extension -eq ".nupkg") {
$PathToZipItem = Get-Item $PathToZip
$UpdatedPathToZip = "$($PathToZipItem.Directory)\$($PathToZipItem.Name -replace '\.nupkg','.zip')"
Copy-Item -Path $PathToZip -Destination $UpdatedPathToZip
$PathToZip = $UpdatedPathToZip
}
##### BEGIN Native Helper Functions #####
# If we're using Windows PowerShell...
if ($PSVersionTable.PSEdition -eq "Desktop") {
function Get-ZipChildItems {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false,Position=0)]
[string]$ZipFile = $(Read-Host -Prompt "Please enter the full path to the zip file")
)
$shellapp = new-object -com shell.application
$zipFileComObj = $shellapp.Namespace($ZipFile)
$i = $zipFileComObj.Items()
Get-ZipChildItems_Recurse $i
}
function Get-ZipChildItems_Recurse {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,Position=0)]
$items
)
foreach($si in $items) {
if($si.getfolder -ne $null) {
# Loop through subfolders
Get-ZipChildItems_Recurse $si.getfolder.items()
}
# Spit out the object
$si
}
}
$ZipSubItems = $(Get-ZipChildItems -ZipFile $PathToZip).Path
}
# If we're using PowerShell Core...
if ($PSVersionTable.PSEdition -eq "Core") {
function Get-AssemblyAvailability {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$AssemblyName
)
##### BEGIN Variable/Parameter Transforms and PreRun Prep #####
$AssemblyBaseClassCount = $($AssemblyName -split "\.").Count
[System.Collections.ArrayList]$AttemptedAssemblyPermutations = @()
##### END Variable/Parameter Transforms and PreRun Prep #####
##### BEGIN Main Body #####
try {
[System.Collections.ArrayList]$Failures = @()
try {
$AssemPartName = [System.Reflection.Assembly]::LoadWithPartialName($AssemblyName)
if (!$AssemPartName) {
throw
}
$WorkingAssemblyReference = $AssemPartName
}
catch {
$null = $Failures.Add("Failed LoadWithPartialName")
}
try {
$AssemTab = $(Invoke-Expression "[$AssemblyName]").Assembly
$WorkingAssemblyReference = $AssemTab
}
catch {
$null = $Failures.Add("Failed TabComplete Check")
}
try {
$GACDir = [System.AppDomain]::CurrentDomain.GetAssemblies()[0].Location | Split-Path -Parent
$GACChildItems = Get-ChildItem -Recurse $GACDir
Filter FindAssemFilter {
if ($_.Location -like "*$AssemblyName.dll") {
$_.Location
break
}
}
$AssemblyFileLocation = $GACChildItems.FullName | FindAssemFilter
if ($AssemblyFileLocation) {
$AssemLoadFile = [System.Reflection.Assembly]::LoadFile($AssemblyFileLocation)
if ($AssemLoadFile) {
$WorkingAssemblyReference = $AssemLoadFile
}
else {
throw
}
}
else {
throw
}
}
catch {
$null = $Failures.Add("Failed LoadFile Check")
}
if ($Failures.Count -gt 2) {
throw
}
}
catch {
$null = $AttemptedAssemblyPermutations.Add($AssemblyName)
if ($AssemblyBaseClassCount -ge 3) {
for ($i=0; $i -lt $($AssemblyBaseClassCount-2); $i++) {
$AssemblyName = $AssemblyName.Substring(0, $AssemblyName.LastIndexOf("."))
[System.Collections.ArrayList]$Failures = @()
try {
$Assem = [System.Reflection.Assembly]::LoadWithPartialName($AssemblyName)
if (!$Assem) {
throw
}
$WorkingAssemblyReference = $Assem
break
}
catch {
$null = $Failures.Add("Failed LoadWithPartialName")
}
try {
$Assem = $(Invoke-Expression "[$AssemblyName]").Assembly
$WorkingAssemblyReference = $Assem
break
}
catch {
$null = $Failures.Add("Failed TabComplete Check")
}
try {
$GACDir = [System.AppDomain]::CurrentDomain.GetAssemblies()[0].Location | Split-Path -Parent
$GACChildItems = Get-ChildItem -Recurse $GACDir
Filter FindAssemFilter {
if ($_.Location -like "*$AssemblyName.dll") {
$_.Location
break
}
}
$AssemblyFileLocation = $GACChildItems.FullName | FindAssemFilter
if ($AssemblyFileLocation) {
$AssemLoadFile = [System.Reflection.Assembly]::LoadFile($AssemblyFileLocation)
if ($AssemLoadFile) {
$WorkingAssemblyReference = $AssemLoadFile
}
else {
throw
}
}
else {
throw
}
}
catch {
$null = $Failures.Add("Failed LoadFile Check")
}
if ($Failures.Count -gt 2) {
$null = $AttemptedAssemblyPermutations.Add($AssemblyName)
}
}
}
}
if (!$WorkingAssemblyReference) {
Write-Error "The following attempts at loading the assembly $AssemblyName were made and ALL failed:`n$AttemptedAssemblyPermutations`nHalting!"
$global:FunctionResult = "1"
return
}
else {
$WorkingAssemblyReference
}
##### END Main Body #####
}
[System.Collections.ArrayList]$AssembliesToCheckFor = @("System.Console","System","System.IO",
"System.IO.Compression","System.IO.Compression.Filesystem","System.IO.Compression.ZipFile",
"System.Collections","System.Collections.Generic"
)
$FoundAssemblies = foreach ($assem in $AssembliesToCheckFor) {Get-AssemblyAvailability -AssemblyName $assem}
$ReferencedAssemblies = $FoundAssemblies.FullName
$Source = @"
using System;
using System.IO;
using System.IO.Compression;
using System.Collections;
using System.Collections.Generic;
namespace MyCore.Utils
{
public static class Zip
{
public static List<string> ListZipContents(string sourcepath)
{
string zipPath = @sourcepath;
List<string> OutputList = new List<string>();
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
if (archive.Entries != null)
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
OutputList.Add(entry.FullName);
}
}
else
{
OutputList.Add(zipPath + " did not contain anything!");
}
}
return OutputList;
}
public static void ExtractAll(string sourcepath, string destpath)
{
string zipPath = @sourcepath;
string extractPath = @destpath;
using (ZipArchive archive = ZipFile.Open(zipPath, ZipArchiveMode.Update))
{
archive.ExtractToDirectory(extractPath);
}
}
public static void ExtractSpecific(string sourcepath, string destpath, string specificitem)
{
string zipPath = @sourcepath;
string extractPath = @destpath;
string itemout = @specificitem.Replace(@"\","/");
//Console.WriteLine(itemout);
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
//Console.WriteLine(entry.FullName);
//bool satisfied = new bool();
//satisfied = entry.FullName.IndexOf(@itemout, 0, StringComparison.CurrentCultureIgnoreCase) != -1;
//Console.WriteLine(satisfied);
if (entry.FullName.IndexOf(@itemout, 0, StringComparison.CurrentCultureIgnoreCase) != -1)
{
string finaloutputpath = extractPath + "\\" + entry.Name;
entry.ExtractToFile(finaloutputpath, true);
}
}
}
}
}
}
"@
Add-Type -ReferencedAssemblies $ReferencedAssemblies -TypeDefinition $Source
$ZipSubItemsPrep = [MyCore.Utils.Zip]::ListZipContents($PathToZip)
$ZipSubItems = foreach ($subpath in $ZipSubItemsPrep) {
$updatedsubpath = $subpath -replace '/','\'
"$($(Get-Item -Path $PathToZip).FullName)\$updatedsubpath"
}
}
##### END Native Helper Functions #####
##### BEGIN Main Body #####
# If we're on Windows...
# NOTE: $PSVersionTable.Platform property is only available in PowerShell Core
if ($PSVersionTable.PSEdition -eq "Desktop" -or $PSVersionTable.Platform -eq "Win32NT") {
# Check if .Net Core SDK is installed
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
[version]$DotNetCoreRunTimeVersion = $(dotnet | Select-String -Pattern "Version" -CaseSensitive).Line[0].Trim() -replace 'Version','' -replace "[\s]","" -replace ':',''
[version]$DotNetCoreSDKVersion = dotnet --version
if ($DotNetCoreSDKVersion.Major -eq 2) {
$DotNetCore2ToolSetAvailable = $true
$DotNetCore1ToolSetAvailable = $true
}
if ($DotNetCoreSDKVersion.Major -eq 1) {
$DotNetCore2ToolSetAvailable = $false
$DotNetCore1ToolSetAvailable = $true
}
if ($DotNetCore2ToolSetAvailable) {
[System.Collections.ArrayList]$PotentialNuGetDLLSubDirs = @(
"lib\netcoreapp1.0"
"lib\netstandard1.5"
"lib\netcoreapp1.0"
"lib\net462"
"lib\netstandard1.4"
"lib\net461"
"lib\netstandard1.3"
"lib\net46"
"lib\netstandard1.2"
"lib\net451"
"lib\netstandard1.1"
"lib\net45"
"lib\netstandard1.0"
# These are at the end because even though THIS machine can run dlls from dirs that match the below,
# we want to make sure that whatever we're building/testing here can also work on machines
# that do NOT have .Net Core 2.x SDK installed. So only look in these subdirectories after
# exhausting the above
"lib\netstandard1.6"
"lib\netcoreapp1.1"
"lib\netcoreapp1.2"
"lib\netstandard2.0"
"lib\netcoreapp2.0"
)
}
if (!$DotNetCore2ToolSetAvailable) {
[System.Collections.ArrayList]$PotentialNuGetDLLSubDirs = @(
"lib\netcoreapp1.0"
"lib\netstandard1.5"
"lib\net462"
"lib\netstandard1.4"
"lib\net461"
"lib\netstandard1.3"
"lib\net46"
"lib\netstandard1.2"
"lib\net451"
"lib\netstandard1.1"
"lib\net45"
"lib\netstandard1.0"
)
# These are at the end because even though THIS machine can run dlls from dirs that match the below,
# we want to make sure that whatever we're building/testing here can also work on machines
# that do NOT have .Net Core 2.x SDK installed. So only look in these subdirectories after
# exhausting the above
if ($DotNetCoreRunTimeVersion.Minor -gt 1) {
$null = $PotentialNuGetDLLSubDirs.Add("lib\netcoreapp1.1")
$null = $PotentialNuGetDLLSubDirs.Add("lib\netcoreapp1.2")
}
if ($DotNetCoreRunTimeVersion.Minor -lt 2) {
$null = $PotentialNuGetDLLSubDirs.Add("lib\netcoreapp1.1")
}
}
}
else {
[System.Collections.ArrayList]$PotentialNuGetDLLSubDirs = @(
"lib\netstandard1.5"
"lib\net462"
"lib\netstandard1.4"
"lib\net461"
"lib\netstandard1.3"
"lib\net46"
"lib\netstandard1.2"
"lib\net451"
"lib\netstandard1.1"
"lib\net45"
"lib\netstandard1.0"
)
}
}
# If we're on Linux...
if ($PSVersionTable.Platform -eq "Unix") {
# PowerShell Core 6 beta versions less than 4 are built on .Net Core 1.1 (I think only earliest alphas are on 1.0).
# PowerShell Core 6 versions at beta.4 or later are (for the foreseeable future) going to be .Net Core 2.0
# I'm ASSUMING that a PowerShell installation on Linux necessarily installs the appropriate .Net Core SDK
$PSCoreBetaVersionCheck = $($($PSVersionTable.GitCommitId | Select-String -Pattern "beta\.[\d]").Matches.Value -split '\.')[-1]
if ($PSCoreBetaVersionCheck -ge 4 -or $PSCoreBetaVersionCheck -eq $null) {
$DotNetCore2ToolSetAvailable = $true
$DotNetCore1ToolSetAvailable = $true
}
if ($PSCoreBetaVersionCheck -lt 4) {
$DotNetCore2ToolSetAvailable = $false
$DotNetCore1ToolSetAvailable = $true
}
if ($DotNetCore2ToolSetAvailable) {
[System.Collections.ArrayList]$PotentialNuGetDLLSubDirs = @(
"lib\netcoreapp1.0"
"lib\netstandard1.5"
"lib\netcoreapp1.0"
"lib\netstandard1.4"
"lib\netstandard1.3"
"lib\netstandard1.2"
"lib\netstandard1.1"
"lib\netstandard1.0"
# These are at the end because even though THIS machine can run dlls from dirs that match the below,
# we want to make sure that whatever we're building/testing here can also work on machines
# that do NOT have .Net Core 2.x SDK installed. So only look in these subdirectories after
# exhausting the above
"lib\netstandard1.6"
"lib\netcoreapp1.1"
"lib\netcoreapp1.2"
"lib\netstandard2.0"
"lib\netcoreapp2.0"
)
}
if (!$DotNetCore2ToolSetAvailable) {
[System.Collections.ArrayList]$PotentialNuGetDLLSubDirs = @(
"lib\netcoreapp1.0"
"lib\netstandard1.5"
"lib\netstandard1.4"
"lib\netstandard1.3"
"lib\netstandard1.2"
"lib\netstandard1.1"
"lib\netstandard1.0"
# I'm pretty sure we're good up to .Net Core 1.2...but not 100% positive
"lib\netcoreapp1.1"
"lib\netcoreapp1.2"
)
}
}
# Try and find a dll by searching Zip File subdirs in order
$ZipDLLPath = foreach ($subdir in $PotentialNuGetDLLSubDirs) {
$subdirregex = $subdir -replace '\\','\\'
if ($ZipSubItems -match "$subdirregex\\.+?\.dll$") {
$FullZipPath = $ZipSubItems -match "$subdirregex\\.+?\.dll$"
$subdirWithDLL = $($FullZipPath -split "\.zip\\")[-1]
$subdirWithDLL
break
}
}
[System.Collections.ArrayList]$PlatformsThatWeCanRunOn = @()
switch ($($ZipDLLPath | Split-Path -Parent)) {
{$_ -match "lib\\netstandard2.0|lib\\netcoreapp2.0"} {
if ($DotNetCore2ToolSetAvailable) {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 2.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 5.4 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.14 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.8 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.5 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
else {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 2.0 and higher")
# The below about .Net Framework 4.7 is potentially incorrect...
$null = $PlatformsThatWeCanRunOn.Add("MAYBE .NET Framework 4.7 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 5.4 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.14 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.8 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.5 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
}
'lib\netstandard1.6' {
if ($DotNetCore2ToolSetAvailable) {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
else {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.7 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
}
'lib\netstandard1.5' {
if ($DotNetCore2ToolSetAvailable) {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
else {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.2 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
}
'lib\netstandard1.4' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
}
'lib\netstandard1.3' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
}
'lib\netstandard1.2' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.5.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows 8.1 and higher")
}
'lib\netstandard1.1' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.5 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows 8.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone 8.1 and higher")
}
'lib\netstandard1.0' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.5 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows 8.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone 8.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone Silverlight 8.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone 8.0 and higher")
}
{$_ -match "lib\\netcoreapp1.0|lib\\netcoreapp1.1|lib\\netcoreapp1.2"} {
if ($DotNetCore2ToolSetAvailable) {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher and MAYBE lower versions depending on .Net Standard version target")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher and MAYBE lower versions depending on .Net Standard version target")
}
else {
$null = $PlatformsThatWeCanRunOn.Add(".NET Core 1.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.7 and higher and MAYBE lower versions depending on .Net Standard version target")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher and MAYBE lower versions depending on .Net Standard version target")
}
}
'lib\net462' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.2 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform vNext and higher")
}
'lib\net461' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
}
'lib\net46' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
}
'lib\net451' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.5.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows 8.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone 8.1 and higher")
}
'lib\net45' {
$null = $PlatformsThatWeCanRunOn.Add(".NET Framework 4.5.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Mono 4.6 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.iOS 10.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Mac 3.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Xamarin.Android 7.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Universal Windows Platform 10 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows 8.0 and higher")
$null = $PlatformsThatWeCanRunOn.Add("Windows Phone 8.1 and higher")
$null = $PlatformsThatWeCanRunOn.Add("MAYBE Windows Phone Silverlight 8.0 depending on .Net Standard version target (must be .Net Standard 1.0)")
}
}
New-Variable -Name "Output" -Value $(
[pscustomobject][ordered]@{
DLLToExtract = $ZipDLLPath
CompatiblePlatforms = $PlatformsThatWeCanRunOn
}
)
$Output
##### END Main Body #####
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment