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

Venkata Sridhar Perepu 45 Reputation points Microsoft External Staff
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://learn.microsoft.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.
5,909 questions
Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.