Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

SolutionScripts is a Nuget package that sources custom scripts and includes custom powershell modules

Installation instructions:

Install-Package SolutionScripts

Why?

When Visual Studio opens a solution, Nuget looks at each installed package for an init.ps1 script in the package's tools directory. If that script exists it will be executed. This is the way that package authors enhance the package manager console experience for consumers of their packages.

However, sometimes developers want to add functions or custom script that will execute in the package manager console independent of a particular package. In this case, a lone developer can customize the powershell profile that the package manager console uses.

This doesn't scale. When sharing custom scripts and global functions across an entire team for a particular project, it doesn't make sense to edit each developer's profile. The profile works across multiple solutions. That would also be weird, to edit a user's profile automaticaly. It also doesn't make sense to install a custom package just for each global function you wanted to register. You could do that, but you'd then have a billion highly targetted packages in your solution.

With SolutionScripts you can check in custom scripts in the SolutionScripts directory (which by convention sits at the same level as the packages directory). SolutionScripts will run them every time you load up the solution. If you want to refresh the scripts in the SolutionScripts directory without reloading the solution, just issue the Update-SolutionScripts command in the package manager console.

How?

SolutionScripts looks for (or creates) a directory called SolutionScripts at the same level as the packages directory.

It looks in that directory for ps1 files. If any exist, it dot sources them.

It also looks for psm1 files (modules). If any exist, init will import them.

What else?

That's it, as far as SolutionScripts goes.

Package Manager Console Tips

  • If you want to see all the global functions, issue dir function:

  • If you want to see all the imported modules, issue Get-Module

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.