Skip to content

Microsoft.Azure.Functions.Worker.Sdk 2.0.3 causes MSBuild to fail to load Functions project #3066

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

Closed
julealgon opened this issue May 21, 2025 · 9 comments · Fixed by #3070
Closed
Assignees
Labels
potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug

Comments

@julealgon
Copy link

Description

When we migrated to Microsoft.Azure.Functions.Worker.Sdk version 2.0.3 earlier today, I started noticing that my project appeared completely broken: when navigating to Program.cs, it would show red squiggles all over the place, nothing was resolved properly. Yet, the project would actually build just fine, which is extremely unusual.

I then noticed an error in the Errors window, coming from the .targets that is part of the Microsoft.Azure.Functions.Worker.Sdk package:

The expression "[System.IO.Path]::GetDirectoryName('')" cannot be evaluated. The path is not of a legal form.

When clicking on the error, I'm directed to this line:

<_FunctionsExtensionsOutputPath>$([System.IO.Path]::GetDirectoryName($(_WorkerExtensionsAssembly)))</_FunctionsExtensionsOutputPath>

I initially tried clearing caches, deleting bin/obj folders, closing Visual Studio and deleting the .vs folder, the usual. However, the same issue would always happen when I opened and built the solution.

Downgrading to version 2.0.2 avoids this error completely and the project looks clean again, so I'm suspecting it is a bug in the library side.

Steps to reproduce

Install version 2.0.3 of Microsoft.Azure.Functions.Worker.Sdk and build a Functions v4 project.

@julealgon julealgon added the potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug label May 21, 2025
@dmytro-gokun
Copy link

Same

@henriquemoises2
Copy link

Same thing happening here after an upgrade to version 2.0.3.

@D168997
Copy link

D168997 commented May 22, 2025

Same thing happening here. I can also confirm that downgrading back to 2.0.2 avoids the error as described.

@cimka
Copy link

cimka commented May 22, 2025

Same thing for me.

@kutscherMKW
Copy link

same

@kinetiq
Copy link

kinetiq commented May 22, 2025

same

@jviau
Copy link
Contributor

jviau commented May 27, 2025

The fix is available in 2.0.4

@rfphill
Copy link

rfphill commented Jun 3, 2025

Unfortunately for me, it dredges up another error "The project file "obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj" was not found.", which is why I downgraded in the first place.

Nightmare.

@jviau
Copy link
Contributor

jviau commented Jun 5, 2025

@rfphill I have opened another PR for that issue. You can currently work around it by first building the project on the command line. #3081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants