Title: Separate out Parser as independent nupkg · Issue #7408 · PowerShell/PowerShell · GitHub
Open Graph Title: Separate out Parser as independent nupkg · Issue #7408 · PowerShell/PowerShell
X Title: Separate out Parser as independent nupkg · Issue #7408 · PowerShell/PowerShell
Description: Problem statement: I would like to use a self-contained version of the Parser in an application that uses the full .Net Framework (4.7.2), however, due to the System.Management.Automation NuGet package being compiled and published agains...
Open Graph Description: Problem statement: I would like to use a self-contained version of the Parser in an application that uses the full .Net Framework (4.7.2), however, due to the System.Management.Automation NuGet pac...
X Description: Problem statement: I would like to use a self-contained version of the Parser in an application that uses the full .Net Framework (4.7.2), however, due to the System.Management.Automation NuGet pac...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/7408
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Separate out Parser as independent nupkg","articleBody":"Problem statement:\r\n- I would like to use a self-contained version of the Parser in an application that uses the full .Net Framework (4.7.2), however, due to the `System.Management.Automation` NuGet package being compiled and published against `netcoreapp2.1`, I cannot use it in full .Net, even when trying to use it in a .Net Standard project and publishing a self-contained version of it. I would like to have a compiled version of it to be able to run it in full .Net, even limited functionality (i.e. only having the Parser working but not being able to host a runtime) would be OK for my scenario.\r\n\r\nWould it be feasible (with reasonable effort) and would a PR be accepted to allow compilation and publication against `netstandard2.0`? Or is there a better way of using and shipping a self-contained version of the Parser in full .net, i.e. to not having to depend on the installed version of PowerShell? @SteveL-MSFT \r\n\r\nAs far as I can see the dependent project ` Microsoft.PowerShell.CoreCLR.Eventing` would need to be changed to target `netstandard2.0` as well. A quick experiment shows that most compilation errors can be resolved by adding the `System.Reflection.Emit`, `System.Reflection.Emit.Lightweight`, `System.Memory`, `System.Collections.Immutable` and `System.Runtime.Loader` NuGet packages to SMA, the remaining compilation errors that would need to be resolved are only about the `EnumerationOptions` type not being available in .Net Standard and seemed to be not too difficult to handle via conditional compilation to use an overload of `Directory.GetDirectories` without `EnumerationOptions` the (and by looking at the history, those new API calls were only recently added by @daxian-dbw as an optimisation)\r\n```\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\Modules\\ModuleUtils.cs(17,43): error CS0234: The type or namespace name 'EnumerationOptions' does not exist in the namespace 'System.IO' (are you missing an assembly reference?) [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\Modules\\ModuleUtils.cs(24,43): error CS0234: The type or namespace name 'EnumerationOptions' does not exist in the namespace 'System.IO' (are you missing an assembly reference?) [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\n```\r\n\r\nAfter resolving them, I suddenly got a lot more compilation errors, some I can resolve, but some about dynamics are a bit tricky and don't have a blame history other than the initial commit (not even in the source depot branch) to figure out how code was converted from full .net to netcore as a hint on how to make it netstandard compliant.\r\n```\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\ExperimentalFeature\\GetExperimentalFeatureCommand.cs(103,50): error CS1061: 'Dictionar\r\nAdd' and no extension method 'TryAdd' accepting a first argument of type 'Dictionary\u003cstring, ExperimentalFeature>' could be found (are you m\r\n\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\Modules\\ModuleSpecification.cs(314,20): error CS0103: The name 'HashCode' does not exi\r\nion\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\Modules\\ModuleCmdletBase.cs(2407,37): error CS1503: Argument 1: cannot convert from 'c\r\nm.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\Modules\\ImportModuleCommand.cs(643,53): error CS1503: Argument 1: cannot convert from\r\ntem.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\namespaces\\EnvironmentProvider.cs(201,36): error CS1061: 'Dictionary\u003cstring, DictionaryEntry>\r\nTryAdd' accepting a first argument of type 'Dictionary\u003cstring, DictionaryEntry>' could be found (are you missing a using directive or an ass\r\nem.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(431,42): error CS0656: Missing compiler requ\r\n [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\parser\\PSType.cs(1237,56): error CS1061: 'TypeBuilder' does not contain a definition f\r\n argument of type 'TypeBuilder' could be found (are you missing a using directive or an assembly reference?) [D:\\PowerShell\\src\\System.Manag\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\parser\\PSType.cs(1240,75): error CS1061: 'TypeBuilder' does not contain a definition f\r\n argument of type 'TypeBuilder' could be found (are you missing a using directive or an assembly reference?) [D:\\PowerShell\\src\\System.Manag\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\DscResourceSearcher.cs(136,25): error CS0656: Missing compiler required member 'Micros\r\n\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(2871,46): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(2927,42): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3018,42): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3150,37): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3227,38): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3275,42): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3326,46): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3405,38): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3463,46): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(3526,38): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(4107,40): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\CommandCompletion\\CompletionCompleters.cs(4623,32): error CS0656: Missing compiler req\r\n' [D:\\PowerShell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\PSVersionInfo.cs(647,34): error CS1503: Argument 1: cannot convert from 'char' to 'str\r\n.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\PSVersionInfo.cs(647,59): error CS1503: Argument 1: cannot convert from 'char' to 'str\r\n.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\PSVersionInfo.cs(647,84): error CS1503: Argument 1: cannot convert from 'char' to 'str\r\n.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\runtime\\Operations\\MiscOps.cs(2707,29): error CS0656: Missing compiler required member\r\nhell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\nD:\\PowerShell\\src\\System.Management.Automation\\engine\\runtime\\Operations\\MiscOps.cs(3017,32): error CS0656: Missing compiler required member\r\nhell\\src\\System.Management.Automation\\System.Management.Automation.csproj]\r\n```\r\n\r\nIs it easier to try to make it compile it directly `net472`?","author":{"url":"https://github.com/bergmeister","@type":"Person","name":"bergmeister"},"datePublished":"2018-07-30T17:29:35Z","url":"https://github.com/PowerShell/PowerShell/issues/7408"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:53665bd3-92a1-6a47-ef03-114e17829b38 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BB0:14E4D4:C78B2:116C6C:6AFD4B17 |
| html-safe-nonce | 21e24d1b766729041f292aa76b3daff41413c9fde663e2a0e41a22305d217c3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkIwOjE0RTRENDpDNzhCMjoxMTZDNkM6NkFGRDRCMTciLCJ2aXNpdG9yX2lkIjoiMzYyOTA3NjMzNzAyMjI5MDcxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a8d55a66d0fe47783be59b4748cabc87b0377643c42a515268bfd4aa431f8586 |
| hovercard-subject-tag | issue:345856570 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/7408/issue_layout |
| twitter:image | https://opengraph.githubassets.com/69289f1322a29cd42a2ac1ca9232858cae53bc0f65d9c59c1bc6c7569f29ab26/PowerShell/PowerShell/issues/7408 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/69289f1322a29cd42a2ac1ca9232858cae53bc0f65d9c59c1bc6c7569f29ab26/PowerShell/PowerShell/issues/7408 |
| og:image:alt | Problem statement: I would like to use a self-contained version of the Parser in an application that uses the full .Net Framework (4.7.2), however, due to the System.Management.Automation NuGet pac... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bergmeister |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width