Azure Function App - trying to publish to a v1 function app from v2 tooling

纵然是瞬间 提交于 2019-12-11 06:47:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!