[英].NET Core Azure function -> error: could not load file or assembly System.Windows.Forms
I have project running on .NET Core 3.1.我有在 .NET Core 3.1 上运行的项目。 I've created an Azure Function that references a 3rd party library (a SyncFusion library, if it makes any difference).
我创建了一个 Azure Function ,它引用了一个第三方库(一个 SyncFusion 库,如果它有任何区别的话)。 When I try to use a specific function from that library I get the following error:
当我尝试使用该库中的特定 function 时,出现以下错误:
Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
无法加载文件或程序集“System.Windows.Forms,版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”。 Reference assemblies should not be loaded for execution.
不应加载引用程序集以供执行。 They can only be loaded in the Reflection-only loader context.
它们只能在 Reflection-only loader 上下文中加载。
Any idea how to fix this?知道如何解决这个问题吗?
Thank you for your attention!感谢您的关注!
--Try this in your csproj. --在你的csproj中试试这个。 It should keep the console window open of a winforms app.
它应该使控制台 window 保持打开 Winforms 应用程序。
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
--If you get a error that a dll is not connected then reference the Packages in your.csproj. --如果您收到 dll 未连接的错误,请参考 your.csproj 中的包。 Dlls you have to reference like this:
你必须像这样引用的DLL:
<ItemGroup>
<Reference Include="YourAssembly">
<HintPath>Path/To/YourAssembly.dll</HintPath>
</Reference>
</ItemGroup>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.