Hello, I was wondering if there's a way to configure Powershell Studio 2016 so that it imports my custom functions each time I create a new Project like a Form project or multi-form project. I didn't see any sort of setup options around that but was just curious . What I've been doing is just importing them manually.
Product, version and build: Powershell 2016
32 or 64 bit version of product: 64
Operating system: Windows 8.1 / Windows 10
32 or 64 bit OS: 64
PowerShell Version: 5 (sometimes 4)
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
Functions Setup
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Functions Setup
You can accomplish this by creating your own project template.
Here are some steps to get you started (assuming the functions are in a single file):
1. Copy an existing template folder from:
C:\ProgramData\SAPIEN\PowerShell Studio 2016\Templates\Projects
2. Then paste the template folder into the User Template folder:
C:\Users\(username)\AppData\Roaming\SAPIEN\PowerShell Studio 2016\Templates\Projects
Important: Rename the template folder to prevent name confusion.
3. Paste the script file containing the function into the new template folder.
4. Edit template.xml and add the following to the files element:
5. Edit the psproj file and add the following to the Files element:
For example:
6. Then open PowerShell Studio and select the new project template from the project list.
Here are some steps to get you started (assuming the functions are in a single file):
1. Copy an existing template folder from:
C:\ProgramData\SAPIEN\PowerShell Studio 2016\Templates\Projects
2. Then paste the template folder into the User Template folder:
C:\Users\(username)\AppData\Roaming\SAPIEN\PowerShell Studio 2016\Templates\Projects
Important: Rename the template folder to prevent name confusion.
3. Paste the script file containing the function into the new template folder.
4. Edit template.xml and add the following to the files element:
- <File>MyFunctionFileName.ps1</File>
- <File Build="0" CommandExtension="True">Globals.ps1</File>
- <Project>
- <Version>1.1</Version>
- <FileID>%ProjectIdentifier%</FileID>
- <Files>
- <File ReferenceName="" Build="0">Startup.pss</File>
- <File ReferenceName="Call-Global_ps1" Build="0" CommandExtension="True">Globals.ps1</File>
- <File Build="0" CommandExtension="True">MyFunctionFileName.ps1</File>
- </Files>
- </Project>
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.