I am developing Azure Function in visual studio, it running well locally. When I try to publish to AZ, it gives me failed error: Please change project B target platform to x64 via build configuration manager.
But I already did so, otherwise it can not running, even locally. However, I did not change the target platform to x64 in the dialog after I right click the project B's properties.
Problem is after I make the change there, it did not working even locally. Project A with target platform AnyCPU which reference to peoject B gives me another error: Project A: Could not load file or assembly, Project B.
Any idea on how this whole thing should work both locally and on Azure. Am I in the wrong place at beginning?
They all in same solution, the executing project call Porject A, and project A call project B
Thanks!
I find that Platform target
in Property pages (aka right click on Project, Properties> Build
) controls the platform indeed. Leave it as Any CPU
and change Configuration manager
to x64, projects are built as x86, ie the preference of Any CPU
. I also find in a brand new project, modify Configuration manager
to x64, Platform target
is changed to x64 automatically and projects are built into x64 bits.
So I guess running well locally happened because your projects actually targeted at x86 before. After Platform target
changed, x64 doesn't work well due to the inconsistency of projects platform.
Based on this, I would suggest as @Jeremy said, make sure all project Platforms are set to Any CPU
, we could delete x64 platform settings directly for a clean configuration.
If you choose to set all project platform to x64, follow steps below.
VS consumes x86 runtime by default, to debug x64 functions we have to download x64 cli(containing runtime) and configure manually.
Visit cli release note to download latest x64 bits(1.x for v1 .NET Framework Functions, 2.x for v2 .NET Core Functions). For example, for v2 functions on OS Windows, we could choose Azure.Functions.Cli.min.win-x64.2.4.317
.
Right click on your project->Properties, do debug configuration below.
Launch: Executable Executable: [x64CliPath]\\func.exe Application Arguments: host start
Before publish, don't forget to modify Platform to 64-bit on Application settings in Azure portal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.