NuGet.exe : File contains corrupted data - nuget

When trying to push a nuget package I get:
NuGet.exe : File contains corrupted data. At line:1 char:6
+ nuget <<<< push .\src\Ext.Direct.Mvc\Ext.Direct.Mvc.nuspec
+ CategoryInfo : NotSpecified: (File contains corrupted data.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
I have the latest update of nuget. I followed the guide to publish a project to nuget. But at the
NuGet Push YourPackage.nupkg
I get the error. Is this maybe because of the dots in the folder/file name?

I used an already existing name for the package. Apparently, this will give this cryptic error message when trying to push from the console.

This is a little old but it helped me to debug the issue by adding
-Verbosity detailed
at the end of the command

Related

Install-Package : '7.0.4-IR19' is not a valid version string. Error

I want to add UmbracoCMS nuget with Package Manager Console(Install-Package UmbracoCms). But i can't ...
Attempting to resolve dependency 'Lucene.Net (≥ 2.9.4.1 && < 3.0.0)'.
Attempting to resolve dependency 'SharpZipLib (≥ 0.86.0)'.
Attempting to resolve dependency 'MySql.Data (≥ 6.9.8 && < 7.0.0)'.
Install-Package : '7.0.4-IR19' is not a valid version string.
Parameter name: version
At line:1 char:16
+ Install-Package <<<< UmbracoCms
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I'm not exactly sure what is causing your problem, but I might have an alternate way of setting things up that could help you. When we nuget our umbraco sites, we only nuget the UmbracoCms.Core package. This gives us all the dlls and references we need. It also makes it a lot easier for us to upgrade umbraco. The UmbracoCms.Core nuget package is something that you would already get automatically as a dependency by nugetting the whole UmbracoCms package.
We then take a zip of the version of umbraco we want and manually merge that into the project using a tool like BeyondCompare. We like to handle the rest of the files outside of nuget because sometimes those other files require special care when merging during an upgrade.

NuGet install-package failing

I'm attempting to install xunit version 2.1.0.. However I'm getting the following exception:
Install-Package : Exception 'System.AggregateException' thrown when trying to add source 'https://api.nuget.org/v3/index.json'. Please verify all your o
nline package sources are available.
At line:1 char:16
+ Install-Package <<<< xunit -Version 2.1.0
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Any ideas on whats going wrong? Sadly google is not giving me anything helpful..
It is an old question, but it just happened to me, and the solution may help others: In my case it was due to a package source that was not available anymore and I needed to remove it from the NuGet Package manager configuration:
Tools -> NuGet Package Manager -> Package Manager Settings -> go to Package Sources and remove the source that is generating the problem.
And be aware of the fact that this server is not responding! If it is one server of your own, it would be good for you to check what is happening with it. ;)

Why is there an Error in ef Add-Migration

I have several class files. Now I am adding a new model class and tried to type add-migration InitialCreate but am getting the following error:
PM> add-migration InitialCreate
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Users\user\Documents\Visual Studio 2013\Pro
jects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operati
on is not supported. (Exception from HRESULT: 0x80131515)"
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 c
har:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 c
har:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///C:\Users\user\Documents\Visual Studi
o 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Opera
tion is not supported. (Exception from HRESULT: 0x80131515)"
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 c
har:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
PM>
Using the Package Manager, you need to re-install Entity Framework:
Uninstall-Package EntityFramework -Force
Then install it for each project:
Install-Package EntityFramework
Then do not forget to restart the studio.
https://stackoverflow.com/a/14994432/1845408
Used the command EntityFramework6\add-migration {migration name} instead. Microsoft changed the name of the command.
Just restart the visual studio and clean the solution and rebuild it again.
Make sure that VS in admin mode
In my case, it was a different entity-framework version between main project and the project containing DbContext.
I just updated version of package in both projects to v6.4.4
I had a slightly different case today, I'm wirting the details here in case that might help somebody. The error was referencing one of my assemblies instead, on which the assembly containing the EF DbContext was depending.
I solved it setting the referenced assembly to "Copy Local" "true" so it'd make a local copy when building for migrations and therefore be able to find it.
you need to re-install Entity Framework:
I went to "Manage Nuget Packages for Solution..." and updated all my packages. This worked for me.
Then I got another error Cannot bind argument to parameter 'Path' because it is null.
Setting another project as startup project other then my web app, before running any EF command in Package Manager Console, worked for me.
Whats missing are the dlls from (Solution Folder)/packages/EntityFramework.6.1.3/tools/.
Things I would try:
Nuget will keep a copy of the .nupkg you might find the missing files there ((Solution Folder)/packages/EntityFramework.X.Y.Z/) (Open the nupkg as zip)
If not you may have luck redownloading the package manually here https://www.nuget.org/packages/EntityFramework (Make sure you download the right packages. In your case it would be 6.1.3)
If that doesnt work you can retry one of the above solutions of completely removing and reinstalling EF but make sure you install the same version for each project.
Also there seem to be versions that dont include those files. For example as of writing this answer 6.3.0 actually doesnt include the dlls needed while 6.1.3 does. I also had success copying the dlls from an older version like 6.1.3 into the newer like 6.3.1 (Might give a warning but generally works as expected).

Nuget Issue - 404 for all packages

I have been having some troubles with the nuget package manager. Firstly, I was suddenly unable to search nuget. If I tried to install something through the packet manager console, I would get the following error
PM> Install-Package Microsoft.Bcl.Async
Install-Package : The ServicePointManager does not support proxies with the https scheme.
At line:1 char:16
+ Install-Package <<<< Microsoft.Bcl.Async
+ CategoryInfo : NotSpecified: (:) [Install-Package], NotSupportedException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
To solve this, I had to add a package source. Both of these seemed to work
http://www.nuget.org/api/v2/
http://packages.nuget.org/v1/FeedService.svc
This worked at the time. I searched and downloaded a package succesfully. The next morning however, I am now getting a different error. If I try and download anything from the nuget UI, I get a 404 message after I select the package that I want.
If I try and download something from the package manager console, I get the following error
The source at All [(Aggregate source)] is unreachable. Falling back to NuGet Local Cache at C:\Users\MYUSERNAMEHERE\AppData\Local\NuGet\Cache
Install-Package : Unable to find package 'Microsoft.Bcl.Async'.
At line:1 char:16
+ Install-Package <<<< Microsoft.Bcl.Async
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I asked a friend to try and download the package that I wanted, and he was able to without issue. Which leads me to believe this is a problem on my end. Any ideas?
I was using fiddler to inspect soap messages from a WCF service that I wrote, and I followed this tutorial to set it up
http://blogs.telerik.com/fiddler/posts/13-01-08/capturing-traffic-from-.net-services-with-fiddler
In this tutorial, it instructs you to add the following in to the machine.config file
<!-- The following section is to force use of Fiddler for all applications, including those running in service accounts -->
<system.net>
<defaultProxy
enabled = "true"
useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
</defaultProxy>
</system.net>
When I removed this property, my Nuget issues went away

NuGet Pack .nuspec file returns "The replacement token 'version' has no value."

This is the error I got while trying to pack a project in Visual Studio 2013:
PM> NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Service.nuspec -Prop Configuration=Release
Attempting to build package from 'ITVizion.RTVizion.Service.nuspec'.
NuGet : The replacement token 'version' has no value.
At line:1 char:1
+ NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Serv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The replacement...' has no value.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
What's wrong with this?
I found the problem:
Make sure you fill your project Assembly Information page.
You can access it right clicking your project in Visual Studio Solution Explorer. Select Application tab => Assembly Information... button.
In case anyone else has a similar error message, and finds that the error message does not go away even if the information is indeed specified in the Assembly Information, I figured out a fix. I don't see this documented in anyone else's answers, and note that this in fact contradicts what the docs say.
Once you've created SomeProject.nuspec with the various $id$, $author$, etc replacement tokens plus any any custom replacement values, the docs instruct you to then place SomeProject.nuspec** into the same directory as SomeProject.csproj, and run
nuget.exe pack SomeProject.csproj -Build
This did not work for me - I got errors about replacement tokens with no value.
However, what did work for me is to call
nuget.exe pack -Build
in the same directory as the nuspec and csproj files, without specifying which csproj or nuspec file to use. This successfully created the nupkg file with the replacement tokens appropriately substituted based on what I specified in the nuspec!
Hopefully this information will be useful to someone else out there!