Skip to content

Instantly share code, notes, and snippets.

@mklement0
mklement0 / Add-NuGetType.ps1
Last active January 10, 2024 18:59
PowerShell function for experimenting with loading .NET assemblies from NuGet packages that are downloaded and cached on demand
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/7436c9e4b2f73d7256498f959f0d5a7c/raw/Add-NuGetType.ps1 | iex
@SeeminglyScience
SeeminglyScience / ForceClassExportExample.ps1
Created April 17, 2017 02:07
Proof of concept for forcing external type definitions to export in a module.
using namespace System.Management.Automation.Language
using namespace System.Collections.Generic
using namespace System.Reflection
# The current contents of the psm1 file would go here, including dot sourcing the class definition
# files normally and exporting module members.
# The rest can most likely be loaded into a function but I haven't tested it yet. It could also
# use some cleaning up.
$usingStatements = [List[UsingStatementAst]]::new()