question

RamaKrishnaboyina-9136 avatar image
0 Votes"
RamaKrishnaboyina-9136 asked RamaKrishnaboyina-9136 commented

Unable to restore Packages when i change target framework from 4.5 to 4.8 using NugetPackage Manager

I changed target framework from 4.5 to 4.8.
When I am trying to build, packages are not restore correctly.

It seems my NugetPackage manager has problem.

201046-11st.png


201171-1st.png

201047-3rd.png

I added packages sources in nuget package manger in Tools-> options.
But it is not saving. I have installed nuget package manger and installed again.
But it is not working.
Could you please advise what to do with this.


dotnet-package-management
11st.png (422.4 KiB)
1st.png (173.3 KiB)
3rd.png (188.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered RamaKrishnaboyina-9136 commented

Hi @RamaKrishnaboyina-9136 ,

Welcome to Microsoft Q&A forum.

Please navigate to %APPDATA%\NuGet( C:\Users\Admin\AppData\Roaming\NuGet ), then open NuGet.Config file, and check if the related package sources keys are added, for example:

   <packageSources>
     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
     <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
   </packageSources>

If there is no NuGet.Config file, please try to create a new NuGet.Config file. If there are no added package sources, please try to add several package sources that you want. You can refer to this doc: Nuget.config reference. After that restart VS and check Tools > NuGet Package Manager > Package Manager Settings > Package Sources.

Besides, which version of Visual Studio are you using? Please also try to create a new solution and test if this issue appears on the newly created solution.

Best Regards,
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.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for response.

I will do as per suggestion. I am using VS2017.

0 Votes 0 ·

Thank you. It works for me.
Repository path gave wrong in my project. Someone gave wrong.
I corrected it and followed as you suggested.
Its working now.

0 Votes 0 ·
RamaKrishnaboyina-9136 avatar image
0 Votes"
RamaKrishnaboyina-9136 answered RamaKrishnaboyina-9136 edited

Hi TianyuSun,

Thank you for your response.
I have verified my project. I am using visual studio 2017.
I have nagivated to path (C:\Users\Admin\AppData\Roaming\NuGet) and found the file nuget.config.
In this file I have only one entry.

<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>

I tried with new project. NuGet Package Manager > Package Manager Settings > Package Sources is populated. But my existing project it is populated.

Please advise

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.