Hello @Sanjay Kumar Jha,
Welcome to Microsoft Q&A forum.
In short, you can try to add following property in your .csproj file.
<PropertyGroup>
<RestorePackagesPath>D:\YourSolutionFolder</RestorePackagesPath>
</PropertyGroup>
Explanation: I can see that your project targets .NET 7.0. Actually, while using NuGet packages, projects based on .NET is different from projects based on .NET Framework. .NET based projects use PackageReference by default, but .NET Framework based projects use packages.config by default. See this document: Project type support
By default, PackageReference is used for .NET Core projects, .NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update) and later, with the exception of C++ UWP projects. .NET Framework projects support PackageReference, but currently default to packages.config.
You are using .NET 7.0 project, so by default it uses PackageReference, and as this document: nuget.config reference - repositoryPath says:
repositoryPath(packages.config only)
it is expected that it doesn’t work in your .NET 7.0 project.
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.