Title: Loading nuget with referenced modules - Weird behavior · Issue #9846 · PowerShell/PowerShell · GitHub
Open Graph Title: Loading nuget with referenced modules - Weird behavior · Issue #9846 · PowerShell/PowerShell
X Title: Loading nuget with referenced modules - Weird behavior · Issue #9846 · PowerShell/PowerShell
Description: Environment: Win 10, ps 5.1 and Powershell Core I'm adding DB2 database driver to my PS script. That driver is a .net core wrapper for non C# client. Nuget name is IBM.Data.DB2.Core. Dotnet driver is located in lib\netstandard2.0 folder ...
Open Graph Description: Environment: Win 10, ps 5.1 and Powershell Core I'm adding DB2 database driver to my PS script. That driver is a .net core wrapper for non C# client. Nuget name is IBM.Data.DB2.Core. Dotnet driver ...
X Description: Environment: Win 10, ps 5.1 and Powershell Core I'm adding DB2 database driver to my PS script. That driver is a .net core wrapper for non C# client. Nuget name is IBM.Data.DB2.Core. Dotnet dri...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/9846
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Loading nuget with referenced modules - Weird behavior ","articleBody":"\r\n# Environment: Win 10, ps 5.1 and Powershell Core\r\n\r\nI'm adding DB2 database driver to my PS script. That driver is a .net core wrapper for non C# client. Nuget name is IBM.Data.DB2.Core. Dotnet driver is located in lib\\netstandard2.0 folder as usually, but actual client is in build\\clidriver folder. If I would build dotnet console app, it would put that clidriver folder in the same directory with IBM.Data.DB2.Core.dll. This approach would work if I run script in powershell 5.1 console. However if I run it in Pwsh Core, or even in ISE, it can't figure out where clidriver folder is (and throw weird error). This can be fixed if I add this dll from the original location (lib/netstandard), somehow it knows nuget folder structure.\r\nWondering if there is a way to push pwsh core to look for clidriver folder in current directory (like PS5 or console app do)? Below is a script you can use for testing. No need to set up database, just see if you get error from DB client (on success) or some weird unrelated error\r\n\r\n# Steps to reproduce\r\n\r\n```powershell\r\n\r\n\r\n\u003c# Initial setup (Windows 10, ps 5.1)\r\n\r\nnuget install IBM.Data.DB2.Core\r\n\r\n# copying dependencies like console app would do\r\n\r\nCopy-Item .\\IBM.Data.DB2.Core.1.3.0.100\\build\\clidriver -Recurse -Destination \".\"\r\nCopy-Item .\\IBM.Data.DB2.Core.1.3.0.100\\lib\\netstandard2.0\\IBM.Data.DB2.Core.dll -Destination \".\"\r\n\r\n#>\r\n\r\n\r\n\r\n\r\n# If you copy clidriver and target dll to your project folder (like console app) it will only work in Powershell 5 console\r\n# It will fail in ISE, powershell core and VSCode\r\n Add-Type -path .\\IBM.Data.DB2.Core.dll # assuming clidriver folder is copied here too.\r\n\r\n \r\n# But it will work everywhere if adding DLL from \\lib\\netstandard\r\n# Somehow it knows nuget structure and uses modules from \\buid\\clidriver\r\n# Add-Type -Path .\\IBM.Data.DB2.Core.1.3.0.100\\lib\\netstandard2.0\\IBM.Data.DB2.Core.dll\r\n\r\n# ------------------------ Test Script ----------------------------------------------------------- #\r\n\r\n$str = \"Database=sysadmin;User ID=informix;Password=in4mix;Server=localhost:9089;\"\r\n$cn = New-Object IBM.Data.DB2.Core.DB2Connection $str\r\n\r\n\r\n$cn.Open() # On success you should see ERROR [08001] [IBM] SQL1336N (that comes from db client)\r\n # On error you'll see \"Length cannot be less than zero\" (so it can't refer to clidriver folder)\r\n$cn.Close()\r\n```","author":{"url":"https://github.com/mikeTWC1984","@type":"Person","name":"mikeTWC1984"},"datePublished":"2019-06-06T20:26:57Z","url":"https://github.com/PowerShell/PowerShell/issues/9846"}
| 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:a9d0df14-7a99-6498-bca7-2646094f896e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8726:2432:80FEE:B3154:6AFD49BF |
| html-safe-nonce | 84a85eed79507320cdc83045ac444206990f053f59cd8f27136aa6b58b4c0912 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzI2OjI0MzI6ODBGRUU6QjMxNTQ6NkFGRDQ5QkYiLCJ2aXNpdG9yX2lkIjoiNTQzNjM2NjM4NDM5OTIwNjg0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0c463ebb6fcfed5e798c33fa2d792aaa89a61371fc7400dbee05f060a500caff |
| hovercard-subject-tag | issue:453223220 |
| 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/9846/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ee455203a1252b98758793bcb5283c1328210473e73bf240ccf4933dc223f7d/PowerShell/PowerShell/issues/9846 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ee455203a1252b98758793bcb5283c1328210473e73bf240ccf4933dc223f7d/PowerShell/PowerShell/issues/9846 |
| og:image:alt | Environment: Win 10, ps 5.1 and Powershell Core I'm adding DB2 database driver to my PS script. That driver is a .net core wrapper for non C# client. Nuget name is IBM.Data.DB2.Core. Dotnet driver ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mikeTWC1984 |
| 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