René's URL Explorer Experiment


Title: 🚀[Feature]: Isolate build, test and document process · Issue #148 · PSModule/Process-PSModule · GitHub

Open Graph Title: 🚀[Feature]: Isolate build, test and document process · Issue #148 · PSModule/Process-PSModule

X Title: 🚀[Feature]: Isolate build, test and document process · Issue #148 · PSModule/Process-PSModule

Description: Description Need to have an isolated build process so that no assemblies clobber others and no modules are loaded to confuse platyPS. You can create an isolated runspace from within PowerShell itself using the .NET API. This lets you bui...

Open Graph Description: Description Need to have an isolated build process so that no assemblies clobber others and no modules are loaded to confuse platyPS. You can create an isolated runspace from within PowerShell itse...

X Description: Description Need to have an isolated build process so that no assemblies clobber others and no modules are loaded to confuse platyPS. You can create an isolated runspace from within PowerShell itse...

Opengraph URL: https://github.com/PSModule/Process-PSModule/issues/148

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"🚀[Feature]: Isolate build, test and document process","articleBody":"### Description\n\nNeed to have an isolated build process so that no assemblies clobber others and no modules are loaded to confuse platyPS.\n\nYou can create an isolated runspace from within PowerShell itself using the .NET API. This lets you build your module in a separate session state—essentially an “isolated runtime” inside your current process—without the modules or assemblies imported in your parent session.\n\nHowever, note that runspace isolation isn’t as complete as a new process (for example, already-loaded assemblies may still be visible), but it does allow you to start with a fresh session state and avoid the auto-loaded modules and functions from your current session.\n\nBelow is an example of how you can create an isolated runspace with a clean initial session state, dot-source only your build script, run your build function, and then clean up the runspace:\n\n```powershell\n# Define the build logic as a ScriptBlock\n\n$buildScript = {\n    # Disable module autoloading\n    $PSModuleAutoloadingPreference = 'None'\n    $var = Get-Date -Format \"yyyy-MM-dd-HH-mm-ss\"\n    # Blank out PSModulePath to prevent any module auto-loading from default locations\n    New-Item -Path \"C:\\Repos\\$var\" -ItemType Directory\n}\n\n# Create a new initial session state (only core commands are loaded)\n$iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()\n\n# Create and open a new runspace with this session state\n$runspace = [runspacefactory]::CreateRunspace($iss)\n$runspace.Open()\n\n# Create a new PowerShell instance and assign it the isolated runspace\n$ps = [PowerShell]::Create()\n$ps.Runspace = $runspace\n\n# Add the build script from the ScriptBlock by converting it to a string\n$ps.AddScript($buildScript.ToString()) | Out-Null\n\n# Invoke the script in the isolated runspace\n$results = $ps.Invoke()\n$results\n# Check for any errors during execution\nif ($ps.HadErrors) {\n    Write-Error 'Errors occurred in the isolated build runspace:'\n    $ps.Streams.Error | ForEach-Object { Write-Error $_.ToString() }\n}\n\n# Clean up the runspace and PowerShell instance\n$ps.Dispose()\n$runspace.Close()\n$runspace.Dispose()\n```\n\n### Explanation\n\n- **InitialSessionState**: By using `[InitialSessionState]::CreateDefault()`, you start with a clean slate containing only the core commands and providers. Modules or functions imported in your parent session aren’t carried over.\n  \n- **Restricting PSModulePath**: In the script block (or by modifying the session state), you can clear or restrict `$env:PSModulePath` so that only modules you explicitly load (like your build script) are available.\n\n- **[PowerShell]::Create()**: This creates a new PowerShell instance that runs in the separate runspace. Commands added to this instance run in isolation from the current session.\n\n- **Dot-Sourcing Your Build Script**: The script block dot-sources `build-module.ps1` so that only the necessary build functions are loaded. Then, `Build-MyModule` is called to build and output your module artifact.\n\n- **Cleanup**: Disposing of the runspace and PowerShell instance cleans up any resources used during the isolated build process.\n\nThis approach keeps your build operations isolated within the same process, allowing you to avoid conflicts with preloaded modules and to build your module without interference. If you need complete isolation (for example, if there’s concern about already loaded assemblies), you might consider spawning a new process using `pwsh -NoProfile` as an alternative.","author":{"url":"https://github.com/MariusStorhaug","@type":"Person","name":"MariusStorhaug"},"datePublished":"2025-02-24T17:47:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/148/Process-PSModule/issues/148"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4ef45c14-b7f1-02e7-1f16-a8fffaf53519
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE20:2D7F61:29ECF4:3A3BAA:697B4101
html-safe-nonce5f867e2115b39d8ff66d621b2b4e00256b94f6b912a70f248dc5dca2d13f5dac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTIwOjJEN0Y2MToyOUVDRjQ6M0EzQkFBOjY5N0I0MTAxIiwidmlzaXRvcl9pZCI6IjIwMDUyMzk2MzI5MTU4MDg1MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6fc69c22ca08d12ea9a60631a9362c2a6da3fce446c063efc2a995c72de213c0
hovercard-subject-tagissue:2875733528
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PSModule/Process-PSModule/148/issue_layout
twitter:imagehttps://opengraph.githubassets.com/40fe6e0c51a616a07bd42cbee6715f1ba68455532eea7d21ff3b19b50b01bd33/PSModule/Process-PSModule/issues/148
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/40fe6e0c51a616a07bd42cbee6715f1ba68455532eea7d21ff3b19b50b01bd33/PSModule/Process-PSModule/issues/148
og:image:altDescription Need to have an isolated build process so that no assemblies clobber others and no modules are loaded to confuse platyPS. You can create an isolated runspace from within PowerShell itse...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameMariusStorhaug
hostnamegithub.com
expected-hostnamegithub.com
None6fe64d94889230be19a900846cfc91707e7dd4206878d6c208922b46a6b0735d
turbo-cache-controlno-preview
go-importgithub.com/PSModule/Process-PSModule git https://github.com/PSModule/Process-PSModule.git
octolytics-dimension-user_id142951047
octolytics-dimension-user_loginPSModule
octolytics-dimension-repository_id706356420
octolytics-dimension-repository_nwoPSModule/Process-PSModule
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id706356420
octolytics-dimension-repository_network_root_nwoPSModule/Process-PSModule
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release15736a47b83581130a149aa1b928696bea06adde
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PSModule/Process-PSModule/issues/148#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPSModule%2FProcess-PSModule%2Fissues%2F148
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPSModule%2FProcess-PSModule%2Fissues%2F148
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PSModule%2FProcess-PSModule
Reloadhttps://github.com/PSModule/Process-PSModule/issues/148
Reloadhttps://github.com/PSModule/Process-PSModule/issues/148
Reloadhttps://github.com/PSModule/Process-PSModule/issues/148
PSModule https://github.com/PSModule
Process-PSModulehttps://github.com/PSModule/Process-PSModule
Notifications https://github.com/login?return_to=%2FPSModule%2FProcess-PSModule
Fork 0 https://github.com/login?return_to=%2FPSModule%2FProcess-PSModule
Star 11 https://github.com/login?return_to=%2FPSModule%2FProcess-PSModule
Code https://github.com/PSModule/Process-PSModule
Issues 81 https://github.com/PSModule/Process-PSModule/issues
Pull requests 1 https://github.com/PSModule/Process-PSModule/pulls
Actions https://github.com/PSModule/Process-PSModule/actions
Projects 1 https://github.com/PSModule/Process-PSModule/projects
Models https://github.com/PSModule/Process-PSModule/models
Security 0 https://github.com/PSModule/Process-PSModule/security
Insights https://github.com/PSModule/Process-PSModule/pulse
Code https://github.com/PSModule/Process-PSModule
Issues https://github.com/PSModule/Process-PSModule/issues
Pull requests https://github.com/PSModule/Process-PSModule/pulls
Actions https://github.com/PSModule/Process-PSModule/actions
Projects https://github.com/PSModule/Process-PSModule/projects
Models https://github.com/PSModule/Process-PSModule/models
Security https://github.com/PSModule/Process-PSModule/security
Insights https://github.com/PSModule/Process-PSModule/pulse
New issuehttps://github.com/login?return_to=https://github.com/PSModule/Process-PSModule/issues/148
New issuehttps://github.com/login?return_to=https://github.com/PSModule/Process-PSModule/issues/148
#150https://github.com/PSModule/Process-PSModule/pull/150
🚀[Feature]: Isolate build, test and document processhttps://github.com/PSModule/Process-PSModule/issues/148#top
#150https://github.com/PSModule/Process-PSModule/pull/150
https://github.com/MariusStorhaug
https://github.com/MariusStorhaug
https://github.com/MariusStorhaug
MariusStorhaughttps://github.com/MariusStorhaug
on Feb 24, 2025https://github.com/PSModule/Process-PSModule/issues/148#issue-2875733528
MariusStorhaughttps://github.com/MariusStorhaug
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.