Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaykul/netcoremoduleproof
A simple cross-platform .NETStandard PowerShell module
https://github.com/jaykul/netcoremoduleproof
Last synced: 25 days ago
JSON representation
A simple cross-platform .NETStandard PowerShell module
- Host: GitHub
- URL: https://github.com/jaykul/netcoremoduleproof
- Owner: Jaykul
- Created: 2017-02-03T06:39:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-03T15:33:33.000Z (almost 8 years ago)
- Last Synced: 2024-10-28T10:20:32.436Z (2 months ago)
- Language: C#
- Size: 2.93 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# A "simplest possible" cross-platform binary PowerShell module
I needed to know the answer to the questions:
## Is it possible to make a cross-platform binary PowerShell module?
## Can a single assembly works in both Windows PowerShell and PowerShell Core?
The answer is: Yes.
This project is the proof of concept, and a simple template. It doesn't do anything useful, except compile, and ... you know ... work.
## Build Instructions
```posh
git clone https://github.com/jaykul/NetCoreModuleProof.git
cd NetCoreModuleProofdotnet restore
dotnet BuildImport-Module ./bin/debug/netstandard1.6/NetCoreModuleProof.dll
Get-Command NetCoreModuleProof
Get-Greeting
```That's really all there is to it. Feel free to copy and add your own useful commands!
## You probably know, intuitively, that this is too good to be true
Well, you're basically right.
This module does indeed work in a cross-platform way, with no problems. However, that's because it has virtually no dependencies -- it doesn't even use a hashtable parameter, or use `System.Math`. Unfortunately, as soon as you start adding dependencies, you will start running into problems, because many of your dependencies won't "just work" on both Full Framework and Core Framework -- you'll need to cross-compile.
The problem is, once you cross-compile, how can we load _the right_ dependent assemblies on PowerShell Core, running on .Net Core, and on Windows PowerShell, running on the full .Net Framework 4.x?
Right now, as far as I know, the answer is: you cannot, in PowerShell. I have [filed this issue](https://github.com/PowerShell/PowerShell/issues/3091) because I could not find an older one...