Skip to content

Instantly share code, notes, and snippets.

@santisq
Last active March 27, 2024 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santisq/e8ac828246cad0027c042641f78484c8 to your computer and use it in GitHub Desktop.
Save santisq/e8ac828246cad0027c042641f78484c8 to your computer and use it in GitHub Desktop.
$framework = 'netstandard2.0'
$folder = 'EventHubs'
$packages = 'Azure.Messaging.EventHubs', 'Azure.Messaging.EventHubs.Processor'
dotnet new classlib -f $framework -o "$folder.package" &&
Push-Location "$folder.package" &&
$packages | ForEach-Object { dotnet add package $_ } &&
dotnet publish --configuration Release -o lib &&
Add-Type -Path .\lib\*.dll &&
Pop-Location
$iwr = Invoke-WebRequest https://www.nuget.org/api/v2/package/IPNetwork2/
$zip = [System.IO.Compression.ZipArchive]::new($iwr.RawContentStream)
$entry = $zip.GetEntry('lib/netstandard2.0/System.Net.IPNetwork.dll')
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry.Name, $true)
$zip.Dispose()
$iwr.RawContentStream.Dispose()
Add-Type -Path $entry.Name
[System.Net.IPNetwork]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment