René's URL Explorer Experiment


Title: Provide a way to host PowerShell in a CoreCLR application · Issue #2291 · PowerShell/PowerShell · GitHub

Open Graph Title: Provide a way to host PowerShell in a CoreCLR application · Issue #2291 · PowerShell/PowerShell

X Title: Provide a way to host PowerShell in a CoreCLR application · Issue #2291 · PowerShell/PowerShell

Description: This is follow-up from #2284 Steps to reproduce Create a simple coreclr app that hosts powershell thru Microsoft.PowerShell.SDK Note: the current function of Microsoft.PowerShell.SDK is to provide an ability to compile binary modules tha...

Open Graph Description: This is follow-up from #2284 Steps to reproduce Create a simple coreclr app that hosts powershell thru Microsoft.PowerShell.SDK Note: the current function of Microsoft.PowerShell.SDK is to provide ...

X Description: This is follow-up from #2284 Steps to reproduce Create a simple coreclr app that hosts powershell thru Microsoft.PowerShell.SDK Note: the current function of Microsoft.PowerShell.SDK is to provide ...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2291

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide a way to host PowerShell in a CoreCLR application","articleBody":"\u003c!--\n\nIf it is a bug report:\n- make sure you are able to repro it on the latest released version. \nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\n- Search the existing issues.\n- Refer to the [FAQ](../docs/FAQ.md).\n- Refer to the [known issues](../docs/KNOWNISSUES.md).\n- Fill out the following repro template\n\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\n-->\n\nThis is follow-up from #2284\n## Steps to reproduce\n\nCreate a simple coreclr app that hosts powershell thru `Microsoft.PowerShell.SDK`\n\n**Note**: the current function of `Microsoft.PowerShell.SDK` is to provide an ability to compile binary modules that then could be imported and used in PowerShell on any platform. This issue asks a question: should we allow the same nuget package to enable **hosting** scenario?\n\nProgram.cs\n\n``` csharp\nusing System;\nusing System.Management.Automation;\n\nclass Program\n{\n    static void Main(string[] args)\n    {\n        PowerShellAssemblyLoadContextInitializer.SetPowerShellAssemblyLoadContext(AppContext.BaseDirectory);\n\n        using (var ps = PowerShell.Create())\n        {\n        ps.AddScript(\"Get-Process | Out-String\");\n        var result = ps.Invoke()[0];\n            Console.WriteLine(result.ToString());\n        }\n    }\n}\n```\n\nproject.json\n\n``` json\n{\n  \"version\": \"1.0.0-*\",\n  \"buildOptions\": {\n    \"debugType\": \"portable\",\n    \"emitEntryPoint\": true\n  },\n  \"dependencies\": {},\n  \"frameworks\": {\n    \"netcoreapp1.0\": {\n      \"dependencies\": {\n        \"Microsoft.NETCore.App\": {\n          \"type\": \"platform\",\n          \"version\": \"1.0.1\"\n        },\n        \"Microsoft.PowerShell.SDK\" : \"1.0.0-alpha10\"\n      },\n      \"imports\": \"dnxcore50\"\n    }\n  }\n}\n```\n\nnuget.config\n\n``` xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003cconfiguration>\n  \u003cconfig>\n    \u003c!-- install packages to a custom path -->\n    \u003cadd key=\"repositoryPath\" value=\"Packages\"/>\n  \u003c/config>\n  \u003cpackageSources>\n    \u003cclear />\n    \u003cadd key=\"nuget.org\" value=\"https://api.nuget.org/v3/index.json\" />\n    \u003cadd key=\"powershell-core\" value=\"https://powershell.myget.org/F/powershell-core/api/v3/index.json\" />\n  \u003c/packageSources>\n\u003c/configuration>\n```\n\ndotnet restore works fine, dotnet run doesn't\n## Expected behavior\n\nYou should be able to run and execute\n## Actual behavior\n\nOn Unix (note that 6.0.0-alpha10 package doesn't have libs compile under `Unix` configuration, so that's expected)\n\n```\nUnhandled Exception: System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.RunspaceFactory' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'api-ms-win-eventing-provider-l1-1-0.dll': The specified module could not be found.\n (Exception from HRESULT: 0x8007007E)\n   at System.Management.Automation.Tracing.EtwActivity.UnsafeNativeMethods.EventActivityIdControl(ActivityControlCode controlCode, Guid& activityId)\n   at System.Management.Automation.Tracing.EtwActivity.GetActivityId()\n   at System.Management.Automation.Runspaces.RunspaceFactory..cctor()\n   --- End of inner exception stack trace ---\n   at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()\n   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)\n   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.Invoke()\n   at Program.Main(String[] args)\n\n```\n\nOn Windows\n\n```\nUnhandled Exception: System.Management.Automation.Runspaces.PSSnapInException: Cannot load Windows PowerShell snap-in Microsoft.PowerShell.Diagnostics because of the following error: Could not load file or assembly 'Microsoft.PowerShell.Commands'. The system cannot find the file specified.\n   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadMshSnapinAssembly(PSSnapInInfo mshsnapinInfo)\n   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIn(PSSnapInInfo mshsnapinInfo)\n   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIns(Collection`1 mshsnapinInfos, PSConsoleLoadException& warning)\n   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadConsole(PSConsoleLoadException& warning)\n   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.CreateDefaultConfiguration()\n   at System.Management.Automation.Runspaces.RunspaceConfiguration.Create()\n   at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host)\n   at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()\n   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)\n   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)\n   at System.Management.Automation.PowerShell.Invoke()\n   at Program.Main(String[] args)\n```\n## Environment data\n\n\u003c!-- provide the output of $PSVersionTable -->\n\n``` powershell\n> $PSVersionTable\nName                           Value                                                                                                        \n----                           -----                                                                                                        \nPSVersion                      6.0.0-alpha                                                                                                  \nPSEdition                      Core                                                                                                         \nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                      \nBuildVersion                   3.0.0.0                                                                                                      \nGitCommitId                    v6.0.0-alpha.10                                                                                              \nCLRVersion                                                                                                                                  \nWSManStackVersion              3.0                                                                                                          \nPSRemotingProtocolVersion      2.3                                                                                                          \nSerializationVersion           1.1.0.1                                                                                                      \n\n```\n","author":{"url":"https://github.com/vors","@type":"Person","name":"vors"},"datePublished":"2016-09-17T16:41:29Z","url":"https://github.com/PowerShell/PowerShell/issues/2291"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:76b45dd5-1edb-d7a0-e2a5-6817137bf870
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC364:350A6F:1F91CE:2B4766:6AFD91BC
html-safe-nonceb2ea6295e9724db17410e04726e84aa69b69f4bdfcd67cb4932e011b89c9bb9d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzY0OjM1MEE2RjoxRjkxQ0U6MkI0NzY2OjZBRkQ5MUJDIiwidmlzaXRvcl9pZCI6IjMwMzcyMjE3NzMzODk5NTk2MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2c3d91f7c3e7fac48f2cb3f843ebd786b65b8b30a7a45254591211a45a49ed73
hovercard-subject-tagissue:177589681
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/PowerShell/PowerShell/2291/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f103b7e716cd6656af93dc1dd07b93965748c5786bfffbc6e092bb0876abf808/PowerShell/PowerShell/issues/2291
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f103b7e716cd6656af93dc1dd07b93965748c5786bfffbc6e092bb0876abf808/PowerShell/PowerShell/issues/2291
og:image:altThis is follow-up from #2284 Steps to reproduce Create a simple coreclr app that hosts powershell thru Microsoft.PowerShell.SDK Note: the current function of Microsoft.PowerShell.SDK is to provide ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevors
hostnamegithub.com
expected-hostnamegithub.com
Nonebc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
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
release927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/2291#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F2291
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F2291
Sign uphttps://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=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/2291
Reloadhttps://github.com/PowerShell/PowerShell/issues/2291
Reloadhttps://github.com/PowerShell/PowerShell/issues/2291
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests366 (366)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/2291
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/2291
Provide a way to host PowerShell in a CoreCLR applicationhttps://github.com/PowerShell/PowerShell/issues/2291#top
https://github.com/daxian-dbw
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
WG-Maintainers-Buildspecific to affecting the buildhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Maintainers-Build%22
6.0.0-beta1https://github.com/PowerShell/PowerShell/milestone/21
https://github.com/vors
sergei (vors)https://github.com/vors
on Sep 17, 2016https://github.com/PowerShell/PowerShell/issues/2291#issue-177589681
#2284https://github.com/PowerShell/PowerShell/issues/2284
sergei (vors)https://github.com/vors
WG-Maintainers-Buildspecific to affecting the buildhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Maintainers-Build%22
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
on Sep 17, 2016https://github.com/PowerShell/PowerShell/issues/2291#event-793041779
https://github.com/daviwil
David Wilson (daviwil)https://github.com/daviwil
on Sep 17, 2016https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-247789611
Dongbo Wang (@daxian-dbw)https://github.com/daxian-dbw
https://github.com/vors
sergei (vors)https://github.com/vors
on Sep 17, 2016https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-247793273
https://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cshttps://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cs
https://github.com/daxian-dbw
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
on Sep 19, 2016https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-248062577
https://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cs#L27https://github.com/PowerShell/PowerShell/blob/master/src/powershell/Program.cs#L27
https://github.com/erwinwildenburg
Erwin Wildenburg (erwinwildenburg)https://github.com/erwinwildenburg
on Sep 28, 2016https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-250267238
https://cloud.githubusercontent.com/assets/3199611/18928152/30b5ebe2-85bf-11e6-959b-c09ccaaf7ffc.PNG
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Nov 4, 2016https://github.com/PowerShell/PowerShell/issues/2291#event-848454220
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Dec 19, 2016https://github.com/PowerShell/PowerShell/issues/2291#event-899014532
https://github.com/iztokp
Iztok Prelog (iztokp)https://github.com/iztokp
on Jan 19, 2017https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-273789659
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
on Mar 15, 2017https://github.com/PowerShell/PowerShell/issues/2291#event-1001443114
Joey Aiello (joeyaiello)https://github.com/joeyaiello
on Mar 20, 2017https://github.com/PowerShell/PowerShell/issues/2291#event-1007695739
Joey Aiello (joeyaiello)https://github.com/joeyaiello
on Mar 20, 2017https://github.com/PowerShell/PowerShell/issues/2291#event-1007695973
Mike Richmond (mirichmo)https://github.com/mirichmo
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3409https://github.com/PowerShell/PowerShell/pull/3409
on Mar 25, 2017https://github.com/PowerShell/PowerShell/issues/2291#event-1015179456
https://github.com/daxian-dbw
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
on Mar 25, 2017https://github.com/PowerShell/PowerShell/issues/2291#issuecomment-289183436
https://github.com/PowerShell/PowerShell/tree/master/docs/host-powershellhttps://github.com/PowerShell/PowerShell/tree/master/docs/host-powershell
Iztok Prelog (@iztokp)https://github.com/iztokp
discussed herehttps://github.com/PowerShell/PowerShell/pull/3409#issuecomment-288934991
#3417https://github.com/PowerShell/PowerShell/issues/3417
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/2291
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/2291
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
WG-Maintainers-Buildspecific to affecting the buildhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Maintainers-Build%22
6.0.0-beta1https://github.com/PowerShell/PowerShell/milestone/21
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.