Azure feed: nuget package is not found - azure

I have 2 solutions (2 .NET Core projects), the first one represents just the models and some simple services for public use, like email service, etc.
It's uploaded to Azure as nuget package and there is a feed which is used by the other projects.
So the link to it is something like https://pkgs.dev.azure.com/something/_packaging/MyFeed1/nuget/v3/index.json
The second one is the major project which consumes the project1 via this nuget package.
So for this purpose, I set up in VS the package source to the link above and then installed the nuget package :
Install-Package MyService -version 1.0.0-CI-XXXXXX-XXXXX
And initially it worked fine. But then I had to update Project1 (nuget package) and although after this, I consequently updated all the references for Project2 (Install-Package MyService -version 1.0.0-CI-YYYYYY-YYYYY - the package version was automatically changed) Project2 is not really working:
I can perfectly compile it locally and locally it works, but when I deploy it to Azure it does not pass the Build and I get the error message saying that it can't find MyService (from nuget package)
I double checked all the references and pipeline - it's fine. The references are updated and the pipeline just uses the feed name, not a particular version of nuget.
Please advise.

This could be the result of caching, which can be fixed by clearing the Nuget caches.
Go to Tools -> Options -> Nuget -> General and click the "Clear All Nuget Cache(s)" button to clear the Nuget caches.

Related

How can I fix deployment problem? upgraded entity framework core from 3.1.4 to 3.1.5. Result mvc core web app runs in VS, but fails in Azure

How can I fix deployment problem? upgraded entity framework core from 3.1.4 to 3.1.5. Result mvc core web app runs in VS, but fails in Azure.
Dot Net core 3.1 with EF 3.1.4 in Azure ran OK.
I updated the Nuget EF packages to current stable 3.1.5, and the result runs locally, but fails when deployed to Azure with message:
"could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=3.1.5.0"
I used the Azure AppService Console and can see the EF versions have the same date as my local files "5/1/2020".
The FileExplorer details screen shows the version as 3.1.5, while the error message says it can not load 3.1.5.0. I searched, but did not find any other people with this problem.
I think is missing the reference there. If you can, check in the folder "packages" if there is a EF 3.1.5 there. Also, check if there is some places which is showing just 3.1.5.0 and try to change to 3.1.5 as is showing in the nuget library.
Finally solved the problem. It involved information from this Microsoft article:
https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.1#clear-package-caches
Needed to uninstall some nuget packages, use command line nuget commands to clear nuget cache, and then re-install latest nuget packages. Redeployed to Azure and the site works again.

Can I consume a Nuget package within a Node project?

I am working with Visual Studio 2017. I started from; Basic Node.js Express 4 Application.
I have a private Nuget in VSTS which has a .Net tool I would now like to use in the Node.js project (to perform some domain specific build-like tasks).
Is it possible to add a Nuget reference into a Node.js project (just to download the tool)?
I've seen that VSTS provides npm, but this would seem to be incompatible with my existing Nuget packages.
Is it possible to add a Nuget reference into a Node.js project (just to download the tool)?
I am afraid you can not do that at this moment.
Because Nuget does not currently support the node.js project even if you just download the tool. When you use nuget on the node.js project, we always get the error 'Project "Default" is not found.'. npm is the right solution for package management for node.js project.
See similar issues on GitHub for some more details:
Cannot install packages in Node.js project - Project "Default" is not found
Nuget package manager cannot 'see' Node.JS projects
Hope this helps.

Azure Mobile Services - System.PlatformNotSupportedException

i'm working on a xamarin forms app with azure however when I load my initial page it crashes on the line:
public static MobileServiceClient MobileService =
new MobileServiceClient(
"https://myapp.azurewebsites.net");
with exception:
System.PlatformNotSupportedException "The empty PCL implementation for
Microsoft Azure Mobile Services was loaded. Ensure you have added
nuget package to each of your platform projects."
How do I fix this?
It might mean that the NuGet packages did not install correctly in one of your platforms. I would suggest doing a force-reinstall of all NuGet packages using the Package Manager Console (Tools/NuGet Package Manager/Package Manager Console).
Update-Package -reinstall
Do this for all projects in your solution. Once done, close and reopen Visual Studio, open your solution and click Build in the top menu and do Clean Solution.
Now look into each of your platform projects in turn to see if you have a Microsoft.Azure.Mobile.Client reference there:
If it is not there, install the Microsoft.Azure.Mobile.Client package again in that given project.
Then you should proceed as described in any tutorial on Azure Mobile Services. Even if you use the Shared Project strategy in you Xamarin.Forms app, it should work as expected once the platform project has Microsoft.Azure.Mobile.Client installed.
If it does not help, as the last resort I would suggest trying to update all NuGet packages to their last version (right-click solution, Manage NuGet Packages for Solution...)
Make sure that you add the initialization code in the respective AppDelegate/MainActivity
CurrentPlatform.Init();
And that in the iOS, Android and PCL projects there is the reference to the Microsoft.Azure.Mobile.Client package.
Example
It instantiates the MobileServiceClient in the TodoItemManager class.

Visual Studio 2012 Nuget Update Packages keep redownloading

Using: Visual Studio 2012 ultimate with Update 4
Problem: Every time I use update-package, it redownloads the same version.
Scenario:
1. I fire up VS2012, make new project Asp.NET MVC4 Web Application -> Internet Application.
2. I type 'update-package' in package manager console. Downloads every package update. I save the solution. Exit.
3. I create a new project Asp.NET MVC4 Web Application -> Internet Application.
4. Since packages are not updated, I type 'update-package' again.
But when I do, it will DOWNLOAD again the SAME version that I already downloaded during my first project.
My problem is, I am not always connected to the internet so do I have to find internet connection everytime I 'update-package' to update the template.
Is there a way I can save the package updates locally so when I do 'update-package' I dont have to be connected to the internet to update all the packages?
You can create folder for nuget packages, for example D:\NugetLocalSource\, and add specify it as package source in nuget settings. Tools -> Nuget Package Manager -> Packages Manager Settings -> Package Sources -> Add.
When you updated packages first time they were downloaded to solution_folder\packages\. You can copy *.nupkg files from packages folder to you local source and then will you be able use them offline for other solutions.
Or you can pre-download packages from nuget.org another way.
One more place where you can find downloaded packages locally - it's nuget cache. It's placed in C:\Users\<user>\AppData\Local\NuGet\Cache. Here is nice article about how to use it

Efficiently Integrate Patch of NuGet Package

Our small, distributed team uses a NuGet package in a project. That package has a bug in the current release. Unfortunately the package does not publish debug symbols and source, so I grabbed & built the latest source, removed the project via NuGet and added a (temporary) reference to the project I just built locally.
Turns out, the issue is fixed in the latest code base.
This particular project only seems to release updates on NuGet every 6 months or so.
Until that next release, our team needs to use the code version where the bug is fixed.
One option certainly is to check the source code into our source code repository and keep the project reference (rather than a NuGet reference), essentially treating it as an internal utility project.
That feels "old school" though.
Is there a better way to manage this situation, using the NuGet infrastructure?
One option is to create your own NuGet package with the updated code. Then add a new Local Package source (just create a file share and place the .nupkg file there). Move the local package source up higher in priority than the official one so NuGet will use your package before looking online.
In fact I recommend copying all NuGet packages to a local repository, especially if you use package restore. This way you are not dependent on nuget.org to be up all the time (there have been several instances of downtime).
The one drawback is that when an updated package is finally published to nuget.org, Update-Package will not pick up the new one unless you specify the package source.
Anyway this will allow you to continue to use NuGet while waiting for your updated package.

Resources