Open DoubleCouponDay opened 5 years ago
Possible duplicate: https://github.com/Azure/azure-functions-core-tools/issues/16
@fabiocav I think this issue belongs here as I don't think the core-tools depends on System.ComponentModel.DataAnnotations
itself, but I could be wrong.
@DoubleCouponDay do you have a repro we can look at? That would help ensure we can look at the exact issue you're running into.
@fabiocav
Install visual studio 2017 with the azure workload (through installer).
Open vs and create a new azure function project. Select "V1 .net framework" as the target runtime.
Import System.ComponentModel.DataAnnotations
from the standard library.
Add this class to your solution.
Unload the .csproj
file and change: <AzureFunctionsVersion>v1</AzureFunctionsVersion>
to <AzureFunctionsVersion>v2</AzureFunctionsVersion>
. Reload .csproj
file.
Run the solution in debug mode and wait 1 minute.
It looks like this is a misconfiguration in the csproj and this trail of steps is not expected behaviour for users. I think it would help this edge case if the runtime printed an error to console if the "TargetFramework" element in the .csproj
does not align with the "AzureFunctionsVersion" element.
Just to clarify, it works when you change "AzureFunctionsVersion" element's value to V1
.
Ah, those steps were helpful in better understanding the flow! Thank you.
Do you have a similar issue if you create a V2 project? You're not changing the target framework when you update the version (You're keeping a full framework function project targeting 2.0), correct?
similar issue with v2 project template
System.ComponentModel.DataAnnotations
in .netcore is only available after preview 3. I'd imagine it would work.
changing the target framework when you update the version
I am not changing the target version. When you do this (net471
-> netcoreapp2.1
), you need to run nuget restore
in the root folder. This is because ./obj/project.settings.json
prevents compilation until it has a build configuration that matches.
I am not changing the target version. When you do this (net471 -> netcoreapp2.1), you need to run nuget restore in the root folder. This is because ./obj/project.settings.json prevents compilation until it has a build configuration that matches.
What types are you attempting to use and having problems with? Annotations should be available in .NET Core https://apisof.net/catalog/System.ComponentModel.DataAnnotations
Here is the type. Notice it is not available in net core 2.2 and below.
thank you for providing this information.
I am attempting to start a visual studio debug session, of a V2 Functions Project, that uses
System.ComponentModel.DataAnnotations Version=4.0.0.0
. When I start the session, I get an exception. The log stream reads:It was discovered that I am dependent on assembly file version: 4.7.2558.0 while the function core tools is dependent on assembly file version: 4.6.27207.3. I discovered this fact by looking further at the log stream from the debug session:
So whats happening is the debug session cannot load two versions of the assembly. The app domain of the debugger should be isolated from the app domain of the user code yet it does not appear the case.
I tried removing all my references to the standard library in favour of references to azurefunctionstools/releases, but this did not fix the issue.
environment
visual studio 15.9.7 Azure function core tools 2.18.5