public static void ThrowsIfVersionMismatch(string projectPath) { // "<AzureFunctionsVersion>v2</AzureFunctionsVersion>" exists in v2 csproj var properties = VsHelper.GetPropertyValues(projectPath, "AzureFunctionsVersion", VsHelper.Csproj.newFormat); var projectMajorVersion = String.Equals(properties.FirstOrDefault(), "v2", StringComparison.OrdinalIgnoreCase) ? FuncVersion.V2 : FuncVersion.V1; var runtimeMajorVersion = GetFunctionRuntimeMajorVersion(); if (runtimeMajorVersion == projectMajorVersion) { // check succeeded return; } throw new InvalidOperationException($@"Your function app is targeting {projectMajorVersion}, but Azure host has function version {runtimeMajorVersion}, please change the version using the portal or update your 'FUNCTIONS_EXTENSION_VERSION' appsetting and retry"); }
public static void ThrowsIfVersionMismatch(string projectPath) { // "<AzureFunctionsVersion>v2</AzureFunctionsVersion>" exists in v2 csproj ThrowsIfVersionMismatch(VsHelper.GetPropertyValues(projectPath, "AzureFunctionsVersion", VsHelper.Csproj.newFormat)); }