Package manager cannot find package in offline resources

Mehdi Khaleghian | MOQdigital 11 Reputation points
2021-09-20T02:00:36.76+00:00

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 Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,239 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AnuragSingh-MSFT 19,691 Reputation points
    2021-09-27T10:34:27.51+00:00

    Hi @Mehdi Khaleghian | MOQdigital ,

    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.


  2. Mr Nams 1 Reputation point
    2022-02-16T04:14:53.307+00:00

    For me it was issue with local directory, I removes space from local directory and replace it with '-' and it worked me in VS2022