question

MehdiKhaleghianMOQdigital-7008 avatar image
0 Votes"
MehdiKhaleghianMOQdigital-7008 asked MehdiKhaleghian-8189 commented

Package manager cannot find package in offline resources

Hi,
I faced an issue with my visual studio installation and cannot build an out of process .net 5 azure function everytime I close visual studio due to package errors.
I am on visual studio professional 16.11.3
The error I get is below also all my package manager settings looks right to me so I don't get why everytime I have to clean all the packages and then when I build it works again

 \AppData\Local\Temp\52wmk12l.lev\WorkerExtensions.csproj : error NU1102: Unable to find package Microsoft.NETCore.Targets with version (>= 3.0.0)
 6>\AppData\Local\Temp\52wmk12l.lev\WorkerExtensions.csproj : error NU1102:   - Found 4 version(s) in Microsoft Visual Studio Offline Packages [ Nearest version: 1.1.0 ]
 6>\AppData\Local\Temp\52wmk12l.lev\WorkerExtensions.csproj : error NU1101: Unable to find package Microsoft.NET.Sdk.Functions. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
 6>\AppData\Local\Temp\52wmk12l.lev\WorkerExtensions.csproj : error NU1101: Unable to find package Microsoft.Azure.WebJobs.Extensions.ServiceBus. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages


133620-capture.png



133697-capture2.png


azure-functionsdotnet-package-management
capture.png (239.7 KiB)
capture2.png (276.7 KiB)
· 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.

Adding right tags/teams to assist

1 Vote 1 ·

Hi,

I am also facing the same error.

Any update will be helpful.


1 Vote 1 ·

1 Answer

AnuragSingh-MSFT avatar image
0 Votes"
AnuragSingh-MSFT answered MehdiKhaleghian-8189 commented

Hi @MehdiKhaleghianMOQdigital-7008,

Apologies for the delayed response. Can you please follow the steps below and see if it resolves this issue?
1. Open Visual Studio, go to "Debug" --> "Options.."
2. Search for "Nuget Package Manager" --> General
3. Click on "Clear All Nuget Cache(s)" and wait for it to clear. (If it throws error, please note the error, and close all running instance of Visual Studio/applications that might be using the package manager). This would ensure that the local cache is cleared properly. You may get more details of caches being cleared by looking into "Output" window after performing this step.
4. After the step above completes, go to "Debug" --> "Options.." again.
5. Under "Nuget Package Manager" --> Package Sources. Make a copy of the sources available there (Name and URL) in notepad. (This should help get rid of any non-printable characters which might be present in the copied string)
6. Delete all sources and click "OK". (This is to ensure that removal gets persisted, in case there was an error saving the sources originally due to non-visible characters etc.)
7. After the step above completes, go to "Debug" --> "Options.." again.
8. Under "Nuget Package Manager" --> "Package Sources", add the sources with details from notepad copied in step 5 above.
9. Click on "OK"

Check if you can build the project successfully.
In addition to the steps mentioned above, please ensure that "ASP.NET and web development" and "Azure Development" workloads are installed for this instance of Visual Studio. You can verify it by
1. "Start" --> "Visual Studio Installed"
2. Locate your version of VS in here (16.11.3) --> click on "Modify". If the above 2 workloads are not present, please select them and install.

In case you still run in to similar issues, you may try running dotnet restore with detailed verbosity (`-v d` parameter) to examine the error details. More details available here. Please let me know if you have any questions.

Please 'Accept as answer' if it helped so that it can help others in the community looking for help on similar topics.


· 1
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.

Hi,
Thanks for taking the time to provide me with these steps,
I finally resort to reset my PC over the weekend and my issue was resolved so I am not sure if this answer works
Thank you,

0 Votes 0 ·