Comments (7)
Makes sense!
Regarding the first list item: AFAIK, the only way to "inherit" commands from another package (without relying on the file system, such as the package installation directory) is by exposing them in the NuGet PowerShell profile.
Having a dependency to PSBuild would not make its commands available to the scripts contained within the depending package (unless perhaps with the approach taken in the first list item below?).
Also:
- The PSBuild NuGet package should install the module in the NuGet PowerShell profile only once, no matter how many times I install the package (or invoke the command that registers the module). The init.ps1 in my fork currently auto-injects the PSBuild module in the NuGet profile, and only if not already present. After installation, the NuGet Powershell profile is reloaded (so the commands should be available now to the other packages being installed? to be verified). I considered
Install-Package PSBuild
as the explicit command. Also, init.ps1 is only called once: when loading the solution or when installing the package. - As a dev I don't want to auto-enlist PSBuild as a package dependency if I package my consuming project. Making it a developmentDependency requires NuGet 2.8 (currently in beta): this would avoid consuming projects to list PSBuild as a dependency when the project is packaged.
Some stuff that can be accomplished today independent from the above:
- Informing the user about PSBuild being loaded in the profile when initializing the pkg manager console
- Some commands fail in the pkg manager console (likely because I forget to pass in params, such as project-path). Perhaps those parameter can be made optional and be derived from the project parameter?
from psbuild.
RE: How to create a NuGet pkg which has PS command that other NuGet pkgs can leverage via a NuGet pkg dependency
I have put together a sample in a gist at https://gist.github.com/sayedihashimi/8511756. There are two NuGet packages in this gist, sayed-module
and consuming-module
. sayed-module
defines a new function New-Message
inside of a PS module that is installed via init.ps1. consuming-module
has a dependency on sayed-module
and calls New-Message
in it's install.ps1
.
_Here is how to try out the sample_
You can build both using the build.ps1. After building the pkgs will be copied to c:\temp\nuget\localrepo\ you can setup a nuget local repo to that folder. Then use install-package consuming-module
after that you should see that there is a message in the pkg manage console when consuming-module
calls New-Message. Also you can call New-Message
at this time as well.
More replies on your other comments coming later. Wanted to share this sample now though.
from psbuild.
Awesome! The gist verifies that dependent packages can inherit PowerShell functionality from another package, given the other package imports its module from within init.ps1
.
FYI, you might also be interested in the following repository: https://github.com/peters/myget
from psbuild.
@xavierdecoster Were you still interested in this?
from psbuild.
I can still see the value in this (using psbuild in a PowerShell console that has knowledge about the current solution context can be interesting, eg Invoke-MsBuild )
from psbuild.
Ok I'm still working on it as well. If you are interested in contributing that would be great.
from psbuild.
Interested in contributing, but running a little short on time lately :( A short-list of smaller tasks might be a great help though
from psbuild.
Related Issues (20)
- Add a module manifest
- Add Import-FileReplacer
- Provide custom directory for log files HOT 4
- Build same project in multiple locations log files are overridden
- GetPSBuild.ps1 fails if run under LocalSystem account HOT 11
- Invoke-MSBuild not splatting $ignoreExitCode switch HOT 2
- Verify projects for required properties HOT 8
- Don't add quotes to command unless needed
- Nuget.exe download fails in GetPSBuild.ps1 HOT 4
- Masking secrets (even if not used) interferes with the prompt
- Change default of masking secrets to false unless running on CI
- Support for PowerShell Core HOT 10
- Make everything self-contained HOT 1
- Use System.Security.Cryptography.Algorithms NuGet pkg for hash algo
- Add 15.0 to VisualStudioVersion HOT 1
- Is it possible to install it offline the package? if so , can you please instruct. HOT 7
- Does not use msbuild 15 automatically HOT 2
- Installation of psbuild failed "Could not find part of the path" HOT 2
- Add PSBuild to the PowerShell Gallery
- Upload to nuget fails due to old CLI tool HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psbuild.