I have a .Net 6 project, I am getting the below error.

Error: NuGet packages need to be restored before building. NuGet MSBuild targets are missing and are needed for building. The NuGet MSBuild targets are generated when the NuGet packages are restored.

csproj file:

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <OutputType>Exe</OutputType>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <DockerfileContext>..\..</DockerfileContext>
    <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

Visual studio version: 17.4.2

I have followed this question also (restoring the packages), But it didn't help.

But I am able to build from the terminal using dotnet build successfully.

Also, I have other projects targeting .net 6 and I can build successfully using visual studio.

0

There are 0 best solutions below