How to fix the error that occurs when executing the GenerateTemporaryTargetAssembly task

Danila 25 Reputation points
2023-09-22T15:39:23.6633333+00:00

When creating an sdk project with wpf elements, the error Could not copy the file ProjectName.csproj.nuget.dgspec.json occurs when building on the server. I see that the files csproj.nuget.g.props and nuget.g.targets are created and copied, but the file csproj.nuget.dgspec.json. msbuild is not being created. How can this problem be solved

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,616 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
726 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,268 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,097 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Basim Kadhim 26 Reputation points
    2023-12-11T17:50:53.8566667+00:00

    For anybody else running into this issue, it turned out in my case that ensuring I was using a newer version of Nuget (5.x) instead of the 4.9.6 default version that my pipeline had been using by introducing a Nuget tool installer step at the beginning of my pipeline solved the issue. It seems that there is an issue with the older nuget version.

    1 person found this answer helpful.