import-module

Import-Module works only when piped from Get-Module

前提是你 提交于 2021-01-28 02:35:48
问题 I wrote a simple PowerShell module. I need to keep more versions of the module. All paths to versions are added to $env:PSModulePath . I'm facing strange problem when importing the module to my session. This fails: Import-Module Contoso.PowerShell -RequiredVersion "0.0.2" Import-Module : The specified module 'Contoso.PowerShell' with version '0.0.2' was not loaded because no valid module file was found in any module directory. At line:1 char:1 + Import-Module Contoso.PowerShell

Cannot import module in Android Studio 0.3.5

…衆ロ難τιáo~ 提交于 2019-12-23 01:38:09
问题 I recently updgraded by AS to 0.3.5 and I can't see import module option. When I open ProjectStructure - Modules - Click the + sign I cant see 'Import Module' option. And also I only see "Modules" in Project Settings. Is there any other way?? 回答1: This isn't implemented yet for Android Studio; it's being tracked in https://code.google.com/p/android/issues/detail?id=62122 . You'll need to move the directory containing the module you want to import under your project root, create a build.gradle

Pythonanywhere install and import new module

吃可爱长大的小学妹 提交于 2019-12-22 06:57:25
问题 I'm new to Pythonanywhere and want to install the 'soundcloud' Python module. I've opened up a Bash console and given the pip install --user soundcloud command. It appears to have installed, as I see it in the list of modules when I used pip freeze in the Bash console. However, when I open up a Python 2.7 console and try import soundcloud , I get an error message saying that the Soundcloud module does not exist. Any ideas on why this is happening? 回答1: You've installed soundcloud for 2.6, but

Powershell: How to get -whatif to propagate to cmdlets in another module

和自甴很熟 提交于 2019-12-21 12:16:28
问题 I've been trying write safe code that supports -whatif with the ShouldProcess method so my users have an idea of what a cmdlet is supposed to do before they run it for real. However I’ve run into a bit of a snag. If I call a script with -whatif as an argument, $pscmdlet.ShouldProcess will return false. All well and good. If I call a cmdlet defined in the same file (that has SupportsShouldProcess=$true) it will return false as well. However, if I am calling a cmdlet defined in another module I

PowerShell: Import-Module, but no “ExportedCommands” available

老子叫甜甜 提交于 2019-12-21 02:00:55
问题 When I use Import-Module -Name <path_to_local_dll> -Verbose the cmdlets contained in the DLL file are not exported. Thus, when I type Get-Module my imported module is listed, but without any ExportedCommands. Why? ModuleType Name ExportedCommands ---------- ---- ---------------- Binary MyModule On a second PC with the same software (PowerShell, .NET Framework, ...), the same imported DLL file works fine. There I get ExportedCommands. On what can this behaviour depend? Unfortunately, the

What's the difference between Add-PsSnapIn and Import-Module

天涯浪子 提交于 2019-12-18 10:48:40
问题 Powershell has two means for importing additional cmdlets into a session, Add-PsSnapIn and Import-Module. The docs are not at all clear regarding when one would chose one over the other. Does anybody know the difference between these? 回答1: Modules came about in PowerShell V2. V2 can still load Snapins though, if necessary. The big difference is that modules can be deployed using Xcopy. There is no need to register anything. To deploy a Snapin, an installer would have to hack the registry,

How to update an imported module in Android Studio?

心不动则不痛 提交于 2019-12-18 10:32:24
问题 While I develop an Android App, I have a library which I have created as separate Android Studio project and can use it by inserting it into new projects. I insert the library by choosing 'File|New|Import Module...' option. The thing is that after the import, Gradle creates a hard copy of my library. If I change the library code in main external project, the code inside the project which is using the library won't get updated. How can I have a library and share it among many project? I need

Editing an already imported module

柔情痞子 提交于 2019-12-14 00:28:58
问题 Before importing my powershell module (MyModule.psm1) , I have written one function in it: Function T1() { Write-Host "T1 is just called" -ForegroundColor red } In my MyModule.psd1 : @{ PowerShellVersion = '2.0' PowerShellHostName = '' PowerShellHostVersion = '2.0' RequiredModules = @() ScriptsToProcess = @() NestedModules = @() FunctionsToExport = '*' CmdletsToExport = '*' VariablesToExport = '*' ModuleList = @() FileList = @() } This is imported fine, when I copied both files in: C:\Users

Permanently add PowerShell module? (Import-Module)

梦想与她 提交于 2019-12-12 17:25:22
问题 I'm using a third-party module I found on GitHub and importing it with: powershell Import-Module .\foo.ps1 This imports successfully and the module works great. But when I open a new PowerShell terminal, it doesn't load the module, I have to run the Import-Module command everytime. Is it possible to have modules load permanently? I'm using Windows 10 with PowerShell v3. 回答1: You can add it to one of your profiles that powershell loads by default. Best bet is %UserProfile%\My Documents

How to add modules to Iron Python?

人盡茶涼 提交于 2019-12-12 10:07:40
问题 I have been trying to execute following Python code (graphcreater.py) using C# Visual Studio. I added IronPyton 2.7.7 and IronPython.StdLib 2.7.7 via NuGet package manager. Once I run the program it gives an exception saying that, No module named mpl_toolkits.mplot3d I need to figure out how to import mpl_toolkits module in Python code (graphcreater.py) correctly. NOTE: The graphcreater.py is running when executed using Python only. Python Code (graphcreater.py): from mpl_toolkits.mplot3d