Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
410 stars 173 forks source link

Dotnet build fails because in bin folder WorkerExtensions.csproj #2605

Closed drweb86 closed 1 week ago

drweb86 commented 1 month ago

Description

In debug folder of a project WorkerExtensions.csproj is placed. Its broken since 1.20 Please release new version without this.

Steps to reproduce

During dotnet restore - in debug folder of a project WorkerExtensions.csproj is placed. Its bug. During dotnet build --no-restore - it tries to restore in bin folder everything including WorkerExtensions.csproj (which references .Net 6 etc) and fails when private azure nuget fields are used.

Builds for Azure Pipelines, and Builds for Docker use separate dotnet restore and dotnet build. So both are broken now.

kshyju commented 1 month ago

@drweb86 Can you share which version of Microsoft.Azure.Functions.Worker.Sdk package you are using?

drweb86 commented 1 month ago

1.14.0

jviau commented 1 month ago

@drweb86 - this sounds like you have some msbuild customizations interfering with our SDK. Can you share your project contents?

With SDK 1.14.0 we place WorkerExtensions.csproj into the temp directory. Have you mapped the temp directory to your build output location?

drweb86 commented 1 month ago

With 1.14 it works. But with latest versions - it breaks compilation. If to use private nuget packages repository and doing builds in 2 stages dotnet restore - works dotnet build --no-restore - it fails because it detects in obj directory WorkerExtensions.csproj and .Net 6 and tries to restore them and fails to do so because of authentication to private repositories which are not part of the WorkerExtensions.csproj.

jviau commented 1 month ago

The latest version places the WorkerExtensions.csproj in the IntermediateOutputPath, which is obj by default. If you are seeing this file appear in bin, then you have reassigned that MSBuild property. It is not recommended to have intermediate and final output go to the same directory.

As for nuget restore, this is by design. WorkerExtensions.csproj inherits the nuget feeds your outer project uses. Try running dotnet build --interactive

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

If you are not the original author (drweb86) and believe this issue is not stale, please comment with /bot not-stale and I will not close it.

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.