Building Cross Platform PowerShell Modules

Slides:



Advertisements
Similar presentations
Will
Advertisements

© Leaf Solutions, LLC. All Rights Reserved What’s New in Everett Microsoft.Net V1.1.
.NET Session Prepared By : Manu Sharma IBE Team. Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET.
64bit Development Overview March 28 Microsoft. Objectives Learn about the current 64-bit platforms from a hardware, software and tools perspective Review.
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
CONFIGMGR 2012 R2 OSD TIPS AND TRICKS Presenter - Fred
Build /17/2017 © 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION.
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
.NET On A Shoe String By: Patrick Brannen Lead Developer iDevCo, Inc.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
September 2008 IT Software Development Guide.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Session 1 - Introduction and Data Access Layer
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
NA-MIC National Alliance for Medical Image Computing Slicer Building and Deployment Steve Pieper, PhD.
64-bit JIT + SIMD Garbage Collector Runtime components Compilers.NET Compiler Platform (Roslyn) Languages innovation.NET Framework 4.6.NET Core.
Module 4: Deployment and Versioning. Overview Introduction to Application Deployment Application Deployment Scenarios Related Topics and Tools.
ASP.NET 5 Unleashed Javier Lozano
Inspirirani ljudima. Ugasite mobitele. Hvala.. Paolo Pialorsi Senior Consultant PiaSys ( Publishing apps for SharePoint 2013 on Microsoft.
Introduction to SQL Server Automation with Powershell by Chris Sommer.
Introduction Service Management Automation
What is it all about? .NET MeetUp in Prague, CZ (2017/7/19)
Computer System Structures
DevOps with ASP.NET Core and Entity Framework Core
Modernizing your. NET applications with. NET Standard,
Introduction to .NET framework
Getting & Running EdgeX Docker Containers
Introducing the Windows Mobile development
Stress Free Deployments with Octopus Deploy
Getting started with .NET Core
Working with SQL Server for Linux Cross-Platform
PowerShell Introduction Copyright © 2016 – Curt Hill.
The Universal Windows Platform
Introduction to .NET Core
Building a Continuous Delivery Pipeline for ASP.NET Core Apps
CE-105 Spring 2007 Engr. Faisal ur Rehman
Nano Server in the cloud - some real use cases to take away
ASP.NET in Linux and Windows containers
Designing Cross Platform Applications on .NET Core
Andrew Pruski SQL Server & Containers
DNN Connect 2017 Microsoft Keynote
2.1. Compilers and Interpreters
Microsoft Virtual Academy
1.1. .NET architectural components and .NET Core
Using PowerShell with Python & SQL Server
.NET Standard Jon Galloway | Executive Director, .NET |
MVC in ASP.NET Core: The new kid on the block
What is it all about? .NET MeetUp in Amsterdam, NL (2017/7/11)
Microsoft Ignite NZ October 2016 SKYCITY, Auckland
Windows Internals Brown-Bag Seminar Chapter 1 – Concepts and Tools
09 | Script and manifest modules
Extending and enhancing PowerShell features with fantastic results
ASP.NET 5 on .NET Core Damian Edwards Principal Program Manager.
Learn. Imagine. Build. .NET Conf
In this session… Introduce what we’re talking about
PowerShell Best Practices for SQL DBA’s
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
Grow Your Script From Simple to Module
MIROSLAV POPOVIĆ Docker i ASP.NET Core
Open Automation Software
Docker Some slides from Martin Meyer Vagrant Box:
TechEd /23/2019 9:23 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Martin MSBuild Martin
5/25/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Azure App Service Web App for Containers
Running C# in the browser
Building, Debugging & Deploying Containerized
ASP.NET Core 2.0 The Future of Web Apps Shahed Chowdhuri
Presentation transcript:

Building Cross Platform PowerShell Modules Adam Driscoll Software Architect @ STEALTHbits Owner @ Ironman Software @adamdriscoll

Agenda Overview of PowerShell Core Differences in Windows PowerShell and PowerShell Core Tools and methods for working on different platforms Testing modules using Docker instances Binary modules

A new era of PowerShell January 19, 2018 – Release of PowerShell Core Two flavors of our favorite little scripting language Windows PowerShell PowerShell Core Dozens of new platforms to support Windows and Windows IoT OS X Many Flavors of Linux New CPU Architectures (ARM)

A golden age of incompatibility Differences in the language Differences in core cmdlets Differences in core aliases (curl!) Many missing modules in PowerShell Core Different .NET runtimes Different Installation Directories Different PSModulePaths

Identifying Differences Handy Variables IsCoreCLR IsLinux IsMacOS IsWindows PSVersionTable

Making the switch in VS Code Update your settings! (Ctrl+,) "powershell.powerShellExePath": "c:/Program Files/PowerShell/6.0.1/pwsh.exe", "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6.0.1/pwsh.exe"

Tools to help WindowsPowerShellCompatibilityPack – Future home of all compatibility shims between Core and Windows PSCoreWindowsCompat – Imports namespaces for missing .NET types (Active Directory!) into PS Core WindowsPSModulePath – Sets the PSModulePath to include Windows PowerShell paths in PowerShell Core PowerShim – Execute Windows PowerShell cmdlets from PowerShell Core

Script Modules – Rules to Live By Avoid aliases (Not just core modules!!) Understand which core cmdlets exist on which platforms Understand which modules work on which platforms Write cross platform automated tests Choose your top platforms to support

Module Manifests CompatiblePSEdtions ProcessorArchitecture – Now includes Arm etc

Using Docker for Cross Platform Testing Microsoft has Docker Hub images for all your favorite flavors https://blogs.technet.microsoft.com/heyscriptingguy/2017/10/03/use-docker-to-automate-testing-of-powershell-core-scripts/ https://github.com/DTW-DanWard/PowerShell-Beautifier/tree/master/test/Automation Dan Ward

Demo to include: Using tags per OS to run tests Run tests in docker containers Create a module that only runs in PowerShell Core

Understanding .NET Core Windows PowerShell PowerShell Core .NET Framework .NET Core .NET Standard Library

Building for .NET Standard PowerShell Standard Library Reference assemblies for PowerShell SDK (System.Management.Automation) Targets .NET Standard so single binary can work on Windows PowerShell and PowerShell Core Can’t reference anything but .NET Standard

Native Binaries Dotnet publish will product deployment folders Native binaries found in Runtime directory Binaries will not automatically be loaded by PowerShell at runtime Libuv.dll is a cross-platform networking library used by ASP.NET Core

Understanding Runtime Identifiers (RIDs) RID values are used to identify target platforms where the application runs RIDs are opaque strings and should be treated as black boxes. Don't build RIDs programmatically. Use RIDs that are already defined for the platform. The RIDs need to be specific, so don't assume anything from the actual RID value.

Breaking the Rules

Caveats

Deployment Include PowerShell scripts Include Binaries Include netstandard.dll for machines without .NET Core Runtime installed Include any .NET Standard DLLs that you reference

Calls to action Use PowerShellStandard.Library when appropriate Cross-platform testing is key Dictate what you support in your manifest to avoid problems

Thank you! Follow me on Twitter: @adamdriscoll Fork me on GitHub: adamdriscoll Check out PowerShell Pro Tools and Universal Dashboard: ironmansoftware.com