Open Camios opened 6 months ago
If I comment-out the AzureFunctionsVersion or change it to "v3" , then I get a different error "Invalid combination of TargetFramework and AzureFunctionsVersion is set."
from C:\Users\(user)\.nuget\packages\microsoft.azure.functions.worker.sdk\1.17.2\build\Microsoft.Azure.Functions.Worker.Sdk.targets
64
If I revert all the changes in the solution made by the upgrade assistant (and fixes to made to try to get it compile), then it rebuilds successfully
Turns out the problem might have been that <ImplicitUsings>
should technically be enable
but the Microsoft.Azure.Functions.Worker.Sdk
is expecting enabled
.
Which isn't the correct value for normal projects, but if it isn't set to enabled
for Function Apps, then it breaks things.
Seems like a bug
You should not be having a package reference to Microsoft.NET.Sdk.Functions
package in an isolated function. That package is for in-proc model apps.
I suggest you to create a brand new .NET Isolated 8 function app using tooling (such as Visual studio) and use that for reference.
You should not be having a package reference to Microsoft.NET.Sdk.Functions package in an isolated function. That package is for in-proc model apps.
I suggest you to create a brand new .NET Isolated 8 function app using tooling (such as Visual studio) and use that for reference.
This category I picked when creating the issue was to raise problems with the .NET Upgrade Assistant. In this case there's possibly two problems.
Firstly, there's the addition of ImplicitUsing
incorrectly having a value of enabled
when it should be enable
(ref but perhaps that is a bug in the Function Apps SDK where it incorrectly expects enabled
and the Upgrade Assistant is having to play along?
Secondly, leaving behind incorrect namespace(s) - Microsoft.NET.Sdk.Functions
It seems the combination of these two things caused the error. Both of these are caused by the .NET Upgrade Assistant for Azure Function App projects. Please fix this part of the upgrade assistant.
Speaking of ImplicitUsing, is there a list of global namespaces for the Azure Functions SDK?
@aishwaryabh FYI
The V4 should be with a capital letter, otherwise it will throw the error :)
The V4 should be with a capital letter, otherwise it will throw the error :)
@MathiasSmedemark
The check ignores case !$(AzureFunctionsVersion.StartsWith('v4',StringComparison.OrdinalIgnoreCase))
I suggest you to create a brand new .NET Isolated 8 function app using tooling (such as Visual studio) and use that for reference.
I don't think people need to go as far as to make a new function app, even for reference. That's a huge waste of time. All that was needed was to remove Microsoft.NET.Sdk.Functions
and ensure the appropriate references in the Microsoft.Azure.Functions.Worker
namespace are present.
This ticket isn't just about what was wrong and to get a workaround. What was more important to me is that the Microsoft project upgrader extension was the thing that got it wrong and it needs to be fixed.
Makes sense we will address this issue with upgrade assistant soon
Although there is an ignore case argument on the FunctionVersion, my error changed when I altered it.
It will no doubt not be a one size fits all example, but uninstalling .Net.Sdk.Functions
package and capitalizing the V4
are what did it for me, and should be covered with the upgrade assistant.
Although there is an ignore case argument on the FunctionVersion, my error changed when I altered it.
It will no doubt not be a one size fits all example, but uninstalling
.Net.Sdk.Functions
package and capitalizing theV4
are what did it for me, and should be covered with the upgrade assistant.
Oddly, I had the same issue. I changed 'v4' to 'V4', which resulted in a clear error being produced, mentioning that 'Microsoft.NET.Sdk.Functions' should be removed. I did this, it built fine, and curiously, I can revert my version back to 'v4' and it still compiles. Odd.
What version of .NET does your existing project use?
.NET 6
What version of .NET are you attempting to target?
.NET 8
Description
I'm trying to upgrade my second Function App project from .net 6 (in-process) to .net 8 (isolated). The first one succeeded, but the second no matter what I've tried has an error
"AzureFunctionsVersion is set to an incompatible version"
.The error is coming from
C:\Users\<user>\.nuget\packages\microsoft.azure.functions.worker.sdk\1.17.2\build\Microsoft.Azure.Functions.Worker.Sdk.targets
This section:
As an experiment I put
<Error Condition="true" Text="$(AzureFunctionsVersion)"/>
at the top of the section and my first, working project is spitting out "v4", but the second, failing project is spitting out "v0"!The failing project csproj's contents are attached but it has always had a value of
v4
- it wasn't changed by the upgrade assistant.I tried copying the contents of csproj from of the working project and it still fails.
I tried unloading the first project; I tried cleaning the solution; deleting the .vs file for the sln; and deleting the bin and obj folders but that didn't help.
I did see some strange warnings:
Project configuration and dependencies
Link to a repository that reproduces the issue
No response