Getting source code in Main

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
akincer
Posts: 43
Last visit: Thu Mar 14, 2024 7:53 am

Re: Getting source code in Main

Post by akincer »

Alexander Riedel wrote: Tue Dec 14, 2021 10:36 am I am not sure why you do classes this way, that's for you to decide. But I do have to point out that the prescribed way to share code amongst otherwise unrelated items is to make them into a module.
I have reasons for doing what I'm doing. As you might expect there are quite a bit of requirements, limitations and other considerations you don't know which makes this entire exercise look odd to you. I won't say the way I'm doing it is the best way. But I did find a solution for the problem I was trying to solve.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Getting source code in Main

Post by Alexander Riedel »

I was not trying to imply you do anything wrong :D I just know folks are going to find this post down the road and wonder. So the module thing had to be said. That's all, no offense.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
akincer
Posts: 43
Last visit: Thu Mar 14, 2024 7:53 am

Re: Getting source code in Main

Post by akincer »

Alexander Riedel wrote: Tue Dec 14, 2021 10:47 am I was not trying to imply you do anything wrong :D I just know folks are going to find this post down the road and wonder. So the module thing had to be said. That's all, no offense.
No offense taken. It could be the case that one reason I'm trying to solve it this way is because I don't know everything there is to know about Powershell. But in case anyone is wondering why you'd do it this way my primary reasons are:

1. Need everything self contained in the resulting executable from Powershell Studio (a Windows service)
2. Have object classes that I want to use in Main and child processes/jobs

If using modules can satisfy both of these points then I'll look at them if there's a good link handy to do some reading.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked