问题
I've created and successfully tested a Function App. It requires the .net Framework because of a legacy library, and is set to use run-time version ~1. Publishing directly from Visual Studio 2017 using the publishing profile works normally. However, attempting to publish with the Azure CLI is giving me grief.
Following the MS article here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli
- azure-cli v2.0.64
- azure-functions-core-tools@2.7.1158 (npm)
- .NET Framework 4.8 DevPack
>func azure functionapp publish <myApp>
You're trying to publish to a v1 function app from v2 tooling.
You can pass --force to force update the app to v2, or downgrade to v1 tooling for publishing
How can I downgrade my tools?
回答1:
From github seems to be that you need to install lower version like
To install v1 with npm:
npm i -g azure-functions-core-tools@1
The other way would be simply using msbuild
"msbuild.exe" "SOLUTIONNAME_OR_PROJECT" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="WebApp.zip" /p:DeployIisAppPath="Default Web Site" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0"
This will produce zip with you azure function
来源:https://stackoverflow.com/questions/56121174/azure-function-app-trying-to-publish-to-a-v1-function-app-from-v2-tooling