Nuget package manager console - Package does not contain a manifest - visual-studio

I suddenly get this error on every package I try to update/reinstall in my project.. How can I start to debug this problem? Does the package manager create a log file with more details than this? Where is the manifest that it does not find?
Same package in different project but same solution works fine.

I m having the same issue.I think it might be a nuget version issue.I tried to install the package at my visual studio 2013, with nuget version is 2.12.0.817 and i got the same error. Then i tried installing the same package at my visual studio 2015, running nuget version 3.4.4.1321 and the package got installed successfully. So if i were you i would check my nuget version.

I faced two different problems:
the tool used to compress the folder (like Compress-Archive)
adds the root folder name inside the compressed file
https://github.com/PowerShell/PowerShell/issues/14312
the tool used to compress the folder has a compression method incompatible
with the client trying to unzip the .nupkg file.
For example, in my case the System.IO.Compression.ZipFile class used to compress the content of the folder was incompatible with the client extraction capabilities.
However, when I manually compressed the same folder content
with Right-click\Send To\Compressed (Zipped) Folder, it was working fine.

Related

Cannot open microsoft.ai.machinelearning.h from NuGet package

I am working on a project in VS 2019 and am trying to use the latest winrt/c++ machine learning api. Therefore I conducted the following steps:
Install Microsoft.AI.MachineLearning 1.4.0 NuGet package for specific project
Build the project
Add #include "winrt/Microsoft.AI.MachineLearning.h"
Unfortunately, the header source file is not found. What am I doing wrong?
Cannot open microsoft.ai.machinelearning.h from NuGet package
When you install the nuget package Microsoft.AI.MachineLearning 1.4.0, you should use this
#include "abi/Microsoft.AI.MachineLearning.h"
Actually, Microsoft.AI.MachineLearning.h file exists under the abi folder from your nuget package.
================
Update 1
I have reproduced your issue in my side. And it seems that there is no such error in my side. I just create such project followed by the above document, then install that nuget package-->build the project and after that, I can call
`winrt/Microsoft.AI.MachineLearning.h.
And the winrt c++ project just puts such file into Generated Files folder during build process based on the function of the project.
So it is a quite strange behavior, and I suggest you could follow these steps to troubleshoot it:
Before all, you could check this document first.
1) First, close your Windows Console Application (C++/WinRT) project, delete .vs hidden folder, any output folders like Debug or Release under the solution folder and project folder.
2) Then restart your project and make sure that Microsoft.AI.MachineLearning 1.4.0 NuGet package is installed.
Then rebuild your project and make sure that build process is successful.
3) Then I can call #include "winrt/Microsoft.AI.MachineLearning.h".
If these steps do not help, I think VS or your current project itself has something wrong.
please try to disable any other third party extensions under Extensions-->Manage Extensions and then restart VS to test it.
Or just create a new WinRT C++ project to test whether the issue happens in the new project.

package file from packagerefernce

We are using appveyor as CI CD tool to build and deploy our website. Currently in my yaml file i have following code
- 7z a MyTest.zip .\MyProj\MyProj.Test\bin\* .\MyProj\packages\NUnit.ConsoleRunner.3.9.0\tools\*
This used to work fine. We changed project structure in visual studio to use new 2017 SDK .net core style. Now packages folder is not available and it now uses packagereference.
So now it complains on this line in yaml saying specified path not found
.\MyProj\packages\NUnit.ConsoleRunner.3.9.0\tools\*
So now how can i package this file?
Packages installed via PackageReference will now be found at %userprofile%\.nuget\packages instead of within the project directory, so change your 7z call accordingly.

Signalr for DotNetCore 2 packages missing all JavaScript

I'm trying to get Signalr from Nuget and have installed every package I can find, but can't seem to find the client JavaScript files that should be included. I've run the command from the package manager (in Visual Studio 2017)
npm install #aspnet/signalr
But alas, there is no /lib/signalr/signalr.js file anywhere. The Client stuff should be there. Where can I download this?
Found it! What the docs do not tell you is that the scripts are dumped into the following folder in the solution folder
node_modules\#aspnet\signalr\dist\browser
and there it was signalr.js (and the minimized version as well)
You create a folder called signalr under wwwroot/lib and place it there.

How to change target directories structure of nuget package

While installing Nuget package like bootstap using visual studio 2017, for example, nuget manager installing the css files of bootstrap package in "~/Content/" directory while i prefer it to be located in "~/Content/css".
i know that i can move the files manually and to change the reference manually but then, i will need to do it again every time i am updating the package using visual studio nuget package manager.
i am wondering, if there is an option to tell every package where to install the relevant files so it will be remembered for later updates.
i am wondering, if there is an option to tell every package where to install the relevant files so it will be remembered for later updates.
I am afraid there is no such option to tell every package where to install the relevant files. According to the conventions for .nuspec file:
The convention for content is:
Think of the content folder as the root of the target application that ultimately consumes the package. To have the package add an image
in the application's /images folder, place it in the package's
content/images folder.
Just like Matt comment, "The location of the files is determined by the NuGet package itself", so there is no such option to tell every package where to install the relevant files.

Installing Packages through Nuget - "Central Directory corrupt"

I'm trying to add a package to my project using NuGet (in VS2015). When I click the "Install" button I see
Downloading missing packages...
at the top of the screen with a progress bar.
After a moment the message is replaced with -
An error occurred while trying to restore packages: Central Directory corrupt.
with a "Restore" button at the end which does the same process.
Anyone have any idea how to fix this?
Edit 07/2017
A far easier method of solving this issue is be to just get Visual Studio to re-download the package -
In Visual Studio open Tools -> Options.
Select NuGet Package Manager.
Ensure both Allow NuGet to download missing packages and Automatically check for missing packages during build in Visual Studio are both ticked.
Click OK.
In a file explorer window navigate into the projects' "packages" folder.
Three options -
Figure out which package is at fault as described in the original answer and delete it's folder.
Move all the packages to a temporary location if you're unsure whether they're all still available in NuGet (you'll need to copy the missing ones back afterwards)
Delete all the package folders if you are sure all your packages are still available in NuGet.
Back in Visual Studio build your solution.
Visual Studio should download all your packages.
Original Answer
Ok, the problem here was that the .nupkg file for one package (found in project root/packges/package folder) had been corrupted at some point and had a size of zero.
I figured out which package was corrupt after attempting to manually install a random package using the package manager console -
Install-Package *package name*
which told me that there was a problem with a currently installed package -
Install-Package : An error occurred while retrieving package metadata for 'package name'....
From there I was able to fix it by doing the following -
Navigate to the to the NuGet site
Search for the project using the search facility at the top of the page
Download the .nupkg file using the "Download" link on the left hand side (checking the version number).
Copy the downloaded file over the old one in the "packages" folder.
Remove all nuget packages under \packages\ ( i had multiple corrupted packages)
Go to your solution in Visual Studio and press "Restore Nuget Packages"
Rebuild your solution
Should be fixed :)
1.First of all read the error.
2.Find the Directory listed on error console.
1.File Explorer ==>>
For Example, My Path is.
C:\Code\Ex_Nikesh\20\packages
In Packages Find Microsoft.SqlServer.Types.xx.xxx.xx.xx(xx indicates version number)
3.Inside the folder find Microsoft.SqlServer.Types.xx.xxx.xx.xx.nu(Nuget Package File [In My case file size is 0 KB])
Delete that File.
4.Now Download the File and Paste inside Microsoft.SqlServer.Types.xx.xxx.xx.xx Folder
Click Here for Download Nuget File
My problem was a corrupted zip file in the following folder:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages
I cleared all these packages (offline repository)

Resources