Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Microsoft.Azure.Functions.Worker.Sdk 1.17.0 #2305

Closed
Anakinn opened this issue Feb 28, 2024 · 15 comments
Closed

Bug in Microsoft.Azure.Functions.Worker.Sdk 1.17.0 #2305

Anakinn opened this issue Feb 28, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@Anakinn
Copy link

Anakinn commented Feb 28, 2024

Description

Try to do the publish of function which is using Microsoft.Azure.Functions.Worker.Sdk 1.17.0 you will get an error: error MSB3030: Could not copy the file "**obj\Release\net8.0\extensions.json"

If you downgrade to previous version it will work.

Also if you do build and publish as separate steps you will not get this error, you will get it only if you are doing publish.

Please fix.

Thank you.

Steps to reproduce

Try to do the publish of function which is using Microsoft.Azure.Functions.Worker.Sdk 1.1.7.0 without running build before.

@Anakinn Anakinn added the bug Something isn't working label Feb 28, 2024
@Anakinn Anakinn changed the title Bug in Microsoft.Azure.Functions.Worker.Sdk 1.1.7.0 Bug in Microsoft.Azure.Functions.Worker.Sdk 1.17.0 Feb 28, 2024
@kshyju
Copy link
Member

kshyju commented Feb 28, 2024

@Anakinn Have you been consistently experiencing this issue? It might be helpful to try running 'dotnet clean' and deleting the obj and bin folders to see if that makes a difference.

I also wanted to share that when I tested the scenario using worker.sdk version 1.17.0 in a minimal function app, I couldn't reproduce the problem. If you have the time, could you please check it out yourself in my minimal repro app?

@Anakinn
Copy link
Author

Anakinn commented Feb 29, 2024

@kshyju Yes constantly reproducible in our build pipeline. obj and bin folders are not existing before the publish and we are doing clean, so every time all folders and everything is deleted and code is pulled, so we are doing clean every time. You need solution to reproduce this, I did not try csproj. As soon as we downgrade from 1.17.0 everything works fine.

One more information, if you repeat publish but you do not remove obj and bin folder it is working. extensions.json file is generated but it is like something is trying to use that file before it is generated in obj folder.

@jeromekol
Copy link

Might be the same as here: #2284
when we build a solution, that contains a function proj and test proj, with dotnet build --no-incremental it fails with the above error

@kshyju
Copy link
Member

kshyju commented Mar 1, 2024

@Anakinn Could you upgrade to Microsoft.Azure.Functions.Worker.Sdk 1.17.2 and see that resolves your issue?

@Anakinn
Copy link
Author

Anakinn commented Mar 4, 2024

@kshyju 1.17.2 is working as expected no error during publish.

@Anakinn
Copy link
Author

Anakinn commented Mar 4, 2024

Fixed with 1.17.2

@MarkusKeusch-BUz
Copy link

MarkusKeusch-BUz commented Jul 16, 2024

In my case, when I use the version Microsoft.Azure.Functions.Worker.Sdk, version 1.17.x, I get the error could not copy the file "[My project filepath]\obj\Debug\net8.0\extensions.json" because it was not found. Only the downgrade to 1.16.4 solves this problem. It is interesting to note that this file actually exists when I build it via VisualStudio. However, I get this error with the following instruction:

C:\Program Files\dotnet\dotnet.exe" build [MySolutionFile].sln --configuration Debug --no-incremental --verbosity minimal --ignore-failed-sources /property:AssemblyVersion=[MyAssemblyVersion] /property:FileVersion=[MyFileVersion] /property:InformationalVersion=[MyInformationalVersion] /property:GenerateDocumentationFile=True /property:AppendTargetFrameworkToOutputPath=True

See also #2305 (comment)

bmatthews-DFE added a commit to SkillsFundingAgency/dss-goals that referenced this issue Aug 8, 2024
@Akhileshkudla
Copy link

I am using V 1.17.4 and getting the same error \dotnet\sdk\8.0.303\Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file ...\obj\Release\net8.0\extensions.json" because it was not found.

@egraff
Copy link

egraff commented Oct 31, 2024

Getting this on 1.18.1 as well!

@heinrich-ulbricht
Copy link

heinrich-ulbricht commented Nov 14, 2024

Getting this as well with 1.18.1, downgrade to 1.17.2 and it works.

@Akhileshkudla
Copy link

Getting it on "Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" , dotnet\sdk\8.0.403

@kyle69
Copy link

kyle69 commented Nov 21, 2024

Is there a workaround, please?
This only happens with dotnet9. (sdk 9.0.100)

Restored /home/vsts/work/1/s/src/XXX/obj/Release/net9.0/WorkerExtensions/WorkerExtensions.csproj (in 406 ms). WorkerExtensions -> /home/vsts/work/1/s/src/XXX/obj/Release/net9.0/WorkerExtensions/buildout/Microsoft.Azure.Functions.Worker.Extensions.dll ##[error]/opt/hostedtoolcache/dotnet/sdk/9.0.100/Microsoft.Common.CurrentVersion.targets(5322,5): Error MSB3030: Could not copy the file "/home/vsts/work/1/s/src/XXX/obj/Release/net9.0/extensions.json" because it was not found.

@Anakinn
Copy link
Author

Anakinn commented Nov 21, 2024

@kyle69 try -m:1

@kyle69
Copy link

kyle69 commented Nov 21, 2024

@Anakinn What is -m:1? A version downgrade?

@sboulema
Copy link

sboulema commented Dec 16, 2024

Had this happen again today:

  • Microsoft.Azure.Functions.Worker.Sdk 2.0.0
  • VS Code 1.96.0

Tried the rather cryptic -m:1 suggestion and it did fix the problem!
So I now have this in my tasks.json:

{
  "label": "publish (functions)",
  "command": "dotnet",
  "args": [
    "publish",
    "--configuration",
    "Release",
    "/property:GenerateFullPaths=true",
    "/consoleloggerparameters:NoSummary",
    "-m:1"
  ],
  "type": "process",
  "dependsOn": "clean release (functions)",
  "problemMatcher": "$msCompile"
},

A bit of googling revealed this about the parameter:

Any parameters passed to dotnet publish are passed to MSBuild.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish#msbuild

Specifies the maximum number of concurrent processes to use when building. If you don't include this switch, the default value is 1. If you include this switch without specifying a value, MSBuild uses up to the number of processors in the computer.
https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2022#switches

But since the default value is 1, specifying it explicitly should not change any behaviour...

Long story short workaround seems to work, but it all feels very finnicky and buggy.

EDIT 1:
Further "confirmed" by this issue, which was not closed: #2601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants