NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher.ImportModule C# (CSharp) Method

ImportModule() public method

public ImportModule ( string modulePath ) : void
modulePath string
return void
        public void ImportModule(string modulePath)
        {
            Invoke("Import-Module " + PathHelper.EscapePSPath(modulePath), null, false);
        }

Usage Example

Exemplo n.º 1
0
        private static void LoadModules(RunspaceDispatcher runspace)
        {
            // We store our PS module file at <extension root>\Modules\NuGet\NuGet.psd1
            string extensionRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string modulePath    = Path.Combine(extensionRoot, "Modules", "NuGet", "NuGet.psd1");

            runspace.ImportModule(modulePath);


            // provide backdoor to enable function test
            string functionalTestPath = Environment.GetEnvironmentVariable("NuGetFunctionalTestPath");

            if (functionalTestPath != null && File.Exists(functionalTestPath))
            {
                runspace.ImportModule(functionalTestPath);
            }
#if DEBUG
            else
            {
                if (File.Exists(DebugConstants.TestModulePath))
                {
                    runspace.ImportModule(DebugConstants.TestModulePath);
                }
            }
#endif
        }
All Usage Examples Of NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher::ImportModule