How to fix this error: The package reference 'Microsoft.NETCore.Targets' should not specify a version.

Venkata Sridhar Perepu 10 Reputation points Microsoft Vendor
2024-04-23T21:41:22.9733333+00:00

I am reaching out to seek assistance with a challenge I've encountered during the migration of our projects to the .NET 8.0 isolated worker model and Azure Functions v4. Despite following the provided documentation closely, the build process is not completing successfully.

The specific error encountered is as follows:

ERROR Command WorkerExtensions.csproj : error: The package reference 'Microsoft.NETCore.Targets' should not specify a version. Please specify the version in 'Packages.props' or set VersionOverride to override the centrally defined version.

It's important to note that the 'WorkerExtensions.csproj' file, which is mentioned in the error, is a dynamically generated file and not manually created by me. I have attempted to resolve this by adding the 'Microsoft.NETCore.Targets' NuGet package in the 'Packages.props' file, but the issue persists.

Could you please provide guidance on a potential workaround or solution to address this build failure?

Link to the migration document: https://video2.skills-academy.com/en-us/azure/azure-functions/migrate-dotnet-to-isolated-model?tabs=net8

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,543 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,562 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,328 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,866 Reputation points Microsoft Employee
    2024-04-24T18:46:38.2533333+00:00

    Hi @Venkata Sridhar Perepu

    It was good to connect with you offline.

    The WorkerExtensions.csproj is part of the Microsoft.Azure.Functions.Worker nuget package. Your project utilizes some internal build tools that may be interfering with the build of your specific project. We'll raise with members of the product group to see if they have better insights on where WorkerExtensions.csproj is picking up the Microsoft.NETCore.Targets reference in the projs.