Adding latest AzPSModulesPath to PSModulePath for private preview (#133)
This commit is contained in:
Родитель
9b8c27fd72
Коммит
2cf1ff922c
|
@ -7,7 +7,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using System.Management.Automation;
|
||||
using Microsoft.Azure.WebJobs.Script.Grpc.Messages;
|
||||
|
||||
namespace Microsoft.Azure.Functions.PowerShellWorker
|
||||
|
@ -18,6 +18,8 @@ namespace Microsoft.Azure.Functions.PowerShellWorker
|
|||
internal class FunctionLoader
|
||||
{
|
||||
private readonly Dictionary<string, AzFunctionInfo> _loadedFunctions = new Dictionary<string, AzFunctionInfo>();
|
||||
private const string LatestAzModulePath = @"D:\Program Files (x86)\ManagedDependencies\PowerShell\AzPSModules\1.0.0";
|
||||
private const string AzureWebsiteInstanceId = "WEBSITE_INSTANCE_ID";
|
||||
|
||||
internal static string FunctionAppRootPath { get; private set; }
|
||||
internal static string FunctionAppProfilePath { get; private set; }
|
||||
|
@ -57,6 +59,11 @@ namespace Microsoft.Azure.Functions.PowerShellWorker
|
|||
var appLevelModulesPath = Path.Join(FunctionAppRootPath, "Modules");
|
||||
var workerLevelModulesPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "Modules");
|
||||
FunctionModulePath = $"{appLevelModulesPath}{Path.PathSeparator}{workerLevelModulesPath}";
|
||||
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(AzureWebsiteInstanceId))
|
||||
&& Platform.IsWindows)
|
||||
{
|
||||
FunctionModulePath = $"{FunctionModulePath}{Path.PathSeparator}{LatestAzModulePath}";
|
||||
}
|
||||
|
||||
// Resolve the FunctionApp profile path
|
||||
var options = new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive };
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Test
|
|||
}
|
||||
};
|
||||
|
||||
FunctionLoadRequest = new FunctionLoadRequest {FunctionId = "FunctionId", Metadata = RpcFunctionMetadata};
|
||||
FunctionLoadRequest = new FunctionLoadRequest { FunctionId = "FunctionId", Metadata = RpcFunctionMetadata };
|
||||
FunctionLoader.SetupWellKnownPaths(FunctionLoadRequest);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче