question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue when using latest Microsoft.NET.Sdk.Functions (1.0.19)

See original GitHub issue

Description

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:open
  • Created 5 years ago
  • Comments:32 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
ravicinicommented, Jan 29, 2019

I analyzed the diagnostics log output and there are some differences which seems relevant to my bug.

Order of msbuild task execution:

  • Nuget version: _GenerateFunctionsPostBuild -> _GenerateFunctionsExtensionsMetadataPostBuild
  • Paket version: _GenerateFunctionsExtensionsMetadataPostBuild -> _GenerateFunctionsPostBuild

Paths used in _GenerateFunctionsExtensionsMetadataPostBuild task:

  • Paket version:
1>Target "_GenerateFunctionsExtensionsMetadataPostBuild" in file "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets":
1>  Using "GenerateFunctionsExtensionsMetadata" task from assembly "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\..\tools\net46\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll".
1>  Task "GenerateFunctionsExtensionsMetadata"
1>    Task Parameter:SourcePath=C:\workspace\Paket.Functions\Paket.Functions\bin\Debug\netcoreapp2.2\
1>    Task Parameter:OutputPath=C:\workspace\Paket.Functions\Paket.Functions\bin\Debug\netcoreapp2.2\
1>  Done executing task "GenerateFunctionsExtensionsMetadata".
1>  Task "Move" skipped, due to false condition; ($(_IsFunctionsSdkBuild) == 'true' AND Exists('$(TargetDir)extensions.json')) was evaluated as ( == 'true' AND Exists('C:\workspace\Paket.Functions\Paket.Functions\bin\Debug\netcoreapp2.2\extensions.json')).
1>Done building target "_GenerateFunctionsExtensionsMetadataPostBuild" in project "Paket.Functions.csproj".
  • Nuget version:
1>Target "_GenerateFunctionsExtensionsMetadataPostBuild" in file "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets":
1>  Using "GenerateFunctionsExtensionsMetadata" task from assembly "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\..\tools\net46\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll".
1>  Task "GenerateFunctionsExtensionsMetadata"
1>    Task Parameter:SourcePath=C:\workspace\Nuget.Functions\Nuget.Functions\bin\Debug\netcoreapp2.2\bin
1>    Task Parameter:OutputPath=C:\workspace\Nuget.Functions\Nuget.Functions\bin\Debug\netcoreapp2.2\bin
1>  Done executing task "GenerateFunctionsExtensionsMetadata".
1>  Task "Move" skipped, due to false condition; ($(_IsFunctionsSdkBuild) == 'true' AND Exists('$(TargetDir)extensions.json')) was evaluated as (true == 'true' AND Exists('C:\workspace\Nuget.Functions\Nuget.Functions\bin\Debug\netcoreapp2.2\extensions.json')).
1>Done building target "_GenerateFunctionsExtensionsMetadataPostBuild" in project "Nuget.Functions.csproj".

2 Warnings in Paket version:

1>C:\Users\marco.ravicini\.nuget\packages\microsoft.net.sdk.functions\1.0.24\build\netstandard1.0\Microsoft.NET.Sdk.Functions.props(38,3): warning MSB4011: "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.props" cannot be imported again. It was already imported at "C:\workspace\Paket.Functions\Paket.Functions\obj\Paket.Functions.csproj.nuget.g.props (17,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\workspace\Paket.Functions\Paket.Functions\Paket.Functions.csproj]
1>C:\Users\marco.ravicini\.nuget\packages\microsoft.net.sdk.functions\1.0.24\build\netstandard1.0\Microsoft.NET.Sdk.Functions.targets(45,3): warning MSB4011: "C:\Users\marco.ravicini\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets" cannot be imported again. It was already imported at "C:\workspace\Paket.Functions\Paket.Functions\obj\Paket.Functions.csproj.nuget.g.targets (9,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\workspace\Paket.Functions\Paket.Functions\Paket.Functions.csproj]

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:

  • Order of execution matters
  • Warnings led to “different” order of execution
  • Paths used in execution rely on order of execution

@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

1reaction
forkicommented, Aug 30, 2018

I’d like to keep this open until it’s fixed in azure functions and when we removed the workaround again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure function build pipeline fails and getting error i.e. ...
Azure function build pipeline fails and getting error i.e. Microsoft.NET.Sdk.Functions.Build.targets(41,5): Error : You must install or update .
Read more >
Getting "Metadata generation failed" when building C# ...
To solve this issue, upgraded Microsoft.NET.Sdk.Functions to last version(3.0.1).And delete the netstandard1.0 folder:
Read more >
Azure Functions not running on the latest runtime version
I am running the latest stable version of VS for Mac (7.6.5), and when upgrading a Function App to run Microsoft.NET.Sdk.Functions to version...
Read more >
Microsoft.NET.Sdk.Functions 1.0.19
Build SDK for Azure Functions.
Read more >
Issue when using latest Microsoft.NET.Sdk.Functions (1.0.19)
Issue when using latest Microsoft.NET.Sdk.Functions (1.0.19) ... Coming soon: A brand new website interface for an even better experience!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found