Azure Function App - trying to publish to a v1 fun

2019-07-27 17:25发布

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条回答
霸刀☆藐视天下
2楼-- · 2019-07-27 17:52

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

查看更多
登录 后发表回答