Giter Club home page Giter Club logo

import-nugetpackage's Introduction

Import-NuGetPackage v1.0.1

PR Tests Import-NuGetPackage Help Menu Screenshot

Introduction

Import-NuGetPackage is a PowerShell v2.0+ compatible PowerShell command, and a nuget package installer for powershell scripts. That being said, I haven't tested the script much with Legacy powershell & .NET framework systems. Feel free to raise a bug if you find one.

It's recommended to use powershell core

Background


As I began to write more and more powershell scripts, I realized that consuming NuGet packages was becoming more and more of a hassle. Install-Package has issues of it's own. As of Jan 2024, it still doesn't support installing packages with cyclic dependencies, depends on nuget.exe instead of dotnet nuget and doesn't load the assemblies automatically.

The last point is particularly annoying, as if the package has multiple dependencies, you have to manually load them one by one, while figuring out what those dependencies are, their version, TFM and everything.

Purpose

The script's sole purpose to provide a seamless way to install any package, while also implicitly loading all the associated assemblies on installation. The ideal scenario, is for the script to work exactly the same as a combination of dotnet restore + dotnet build

Usage

There is only one function as the entrypoint, Import-NugetPackage. This can be also used as a "direct" function, similar to Import-Package by keeping this in a common place.

It accepts almost all the parameters supported by dotnet restore

Installation

The source code for Import-NugetPackage is hosted at Github, and you may download, fork and review it from this repository. Please report issues or feature requests through Github's bug tracker associated with this project.

Run the following commands to use it in your script / session / module.

Import-Module ./Import-NugetPackage.psm1
Import-NugetPackage

Note

If you are using windows, and not using powershell core, then you will see an error message regarding digital signature. You can bypass that by running the below command.

Set-executionpolicy -Scope Process remotesigned

or if you have written a script which consumes this as a module, then you can run the below command to do the same

powershell.exe -noprofile -executionpolicy bypass -file /your/script/location/which/consumes/Import-NugetPackage/Module.ps1

License

Import-NugetPackage is released under the MIT license

Release Notes

v1.0 - 2024-01-24 First release v1.0.1 - 2024-01-25 Fix relative path issues v1.0.2 - 2024-01-25 Fix for packages part of runtime

import-nugetpackage's People

Contributors

gliesefire avatar

Stargazers

Sundaresh Iyer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.