Issue when using latest Microsoft.NET.Sdk.Functions (1.0.19)
See original GitHub issueDescription
Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator is a new package referenced by Microsoft.NET.Sdk.Functions and looks like it is responsible for generating an extensions.json file needed by the runtime.
When restoring packages with the latest paket and azure functions build, there are warnings MSB4011 at build time. When the build finishes the extensions.json generated is in the wrong location and empty.
Looking in the props/target files you do see a reference to both.
Full warning MSB4011 text:
C:\Users\JonathanOhlrich\.nuget\packages\microsoft.net.sdk.functions\1.0.19\build\netstandard1.0\Microsoft.NET.Sdk.Functions.props(38,3): warning MSB4011: "C:\Users\JonathanOhlrich\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.props" cannot be imported again. It was already imported at "C:\dev\authorization-service\src\Functions\obj\Functions.fsproj.nuget.g.props (17,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\dev\authorization-service\src\Functions\Functions.fsproj]
C:\Users\JonathanOhlrich\.nuget\packages\microsoft.net.sdk.functions\1.0.19\build\netstandard1.0\Microsoft.NET.Sdk.Functions.targets(45,3): warning MSB4011: "C:\Users\JonathanOhlrich\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets" cannot be imported again. It was already imported at "C:\dev\authorization-service\src\Functions\obj\Functions.fsproj.nuget.g.targets (9,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\dev\authorization-service\src\Functions\Functions.fsproj]
Repro steps
Paket version 5.176.9
Reference Microsoft.NET.Sdk.Functions 1.0.19 and then build
Expected behavior
Since Microsoft.NET.Sdk.Functions references Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator I suppose only Microsoft.NET.Sdk.Functions’s props/targets should be used? I’m not positive how exactly both are being referenced
Actual behavior
Both exist causing warnings and incorrect behavior
Known workarounds
If you restore and manually remove the Imports lines referencing the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator’s target and props in the obj folder, then build --no-restore will succeed without warning and generate the extensions.json in the function app’s bin folder
I tried to explicitly exclude the targets via Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator import_targets: false at both the paket.reference and paket.dependencies, but it would still appear.
Issue Analytics
- State:
- Created 5 years ago
- Comments:32 (25 by maintainers)
Top GitHub Comments
I analyzed the diagnostics log output and there are some differences which seems relevant to my bug.
Order of msbuild task execution:
Paths used in _GenerateFunctionsExtensionsMetadataPostBuild task:
2 Warnings in Paket version:
When I clean everything and build it works, rebuild initializes the error
See the following diagnostics log for differences: paket-initial-build.log paket-rebuild.log
Based on this I have a few assumptions:
@soninaren or @fabiocav could you support me from the azure-functions-vs-build-sdk side on this issue?
To complete the analysis here is the nuget log: nuget-msbuild.log
I’d like to keep this open until it’s fixed in azure functions and when we removed the workaround again