小编vid*_*dhi的帖子

在 PS 脚本中的“Import-Module“AzureAD”行中出现错误“无法加载文件或程序集“System.Windows.Forms”

我正在尝试部署一个简单的 powershell 函数应用程序,其中包含以下命令:

Import-Module D:\home\site\wwwroot\HttpTrigger1\AzureAD\AzureAD.psd1

Connect-AzureAD -TenantId $tenantId -Credential $Credential
Run Code Online (Sandbox Code Playgroud)

AzureAD 模块文件已使用 KUDU 从本地存储库“C:\Program Files\WindowsPowerShell\Modules\AzureAD”复制到“D:\home\site\wwwroot\HttpTrigger1\AzureAD”。

在 Import-Module 行出错,这里是 ERROR 堆栈跟踪:

ERROR: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.Exception             :Type       : System.IO.FileNotFoundExceptionMessage    : Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.FileName   : System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089TargetSite :Name          : GetExportedTypesDeclaringType : System.Reflection.RuntimeAssembly, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798eMemberType    : MethodModule        : System.Private.CoreLib.dllStackTrace :at System.Reflection.RuntimeAssembly.GetExportedTypes()at System.Reflection.Assembly.get_ExportedTypes()at …
Run Code Online (Sandbox Code Playgroud)

powershell azure-powershell azure-functions azure-function-app

2
推荐指数
1
解决办法
2225
查看次数