Repository navigation
Incorrect module path when using .NET interactive #463
Description
Activity
Seems like for some reason the host version in .NET interactive is 0.0.1
function FunctionName { [cmdletbinding()] param () Write-Host $PSCmdlet.Host.Version } FunctionName 0.0.1- addedIssue-BugSomething isn't workingSomething isn't working
on Aug 12, 2021 Henry Buckle (@hbuckle) thanks for reaching out!
Could you share your PS Modules path output with us by running:
$env:PSModulePathWe haven't yet done testing in the .NET interactive notebook and will test this scenario.
This is PSModulePath from the .NET interactive kernel
C:\Users\henry.buckle\.nuget\packages\microsoft.dotnet-interactive\1.0.240403\tools\net5.0\any\Modules C:\Users\henry.buckle\Documents\PowerShell\Modules C:\Program Files\PowerShell\Modules c:\users\henry.buckle\.nuget\packages\microsoft.dotnet-interactive\1.0.240403\tools\net5.0\any\runtimes\win\lib\net5.0\Modules C:\Program Files\WindowsPowerShell\Modules C:\WINDOWS\system32\WindowsPowerShell\v1.0\ModulesReacted by Anam NaviedI'm not sure when exactly this may have been resolved, but it looks like it is no longer an issue as of 3.0.14-beta14. I'm going to close this issue as resolved, but if you're still having this issue or see this issue pop up again in the future please let us know either here or in a new issue. Thanks!
alerickson - I just tried this again and get the same issue with 3.0.17
Save the following as a
.dibfile and open in VSCode with thems-dotnettools.dotnet-interactive-vscodeextension#!pwsh $env:PSModulePath -split ';' Get-Module PowerShellGet Get-PSResource -Scope CurrentUser -Name 'Az' -VerboseWhen you run the cell you get the following
C:\Users\henry.buckle\.nuget\packages\microsoft.dotnet-interactive\1.0.350406\tools\net6.0\any\Modules C:\Users\henry.buckle\Documents\PowerShell\Modules C:\Program Files\PowerShell\Modules c:\users\henry.buckle\.nuget\packages\microsoft.dotnet-interactive\1.0.350406\tools\net6.0\any\runtimes\win\lib\net6.0\Modules C:\Program Files\WindowsPowerShell\Modules C:\windows\system32\WindowsPowerShell\v1.0\Modules VERBOSE: Retrieving directories in the path 'C:\Users\henry.buckle\Documents\WindowsPowerShell\Modules' VERBOSE: Retrieving directories in the path 'C:\Users\henry.buckle\Documents\WindowsPowerShell\Scripts' VERBOSE: All paths to search: 'C:\Users\henry.buckle\Documents\WindowsPowerShell\Modules\PackageManagement' VERBOSE: All paths to search: 'C:\Users\henry.buckle\Documents\WindowsPowerShell\Modules\PowerShellGet' VERBOSE: Entering GetPSResourceI think the use of psCmdlet.Host.Version here is wrong - this is the version of the hosting application, not the PowerShell engine
alerickson, Anam Navied (@anamnavi) any update?
If it helps this is how PowerShellEditorServices does it
Henry Buckle (@hbuckle) thanks for providing such thorough info, we'll investigate into this.
alerickson alerickson - will it be fixed for GA? It looks like
psCmdlet.Host.Versionis still in useHave just posted something in #1459 which may solve this.


Prerequisites
Steps to reproduce
When running Install/Update-PSResource in a .NET interactive notebook the installation path is incorrectly set as
Documents\WindowsPowerShell, even though powershell core is being usedNotebook code (.dib file)
Output:
Expected behavior
Installation path should be `Documents\PowerShell`Actual behavior
Installation path is `Documents\WindowsPowerShell`Error details
No response
Environment data
Visuals
No response