The error occurs only on one machine.
Attempts
Wrong paths
I thought the path of any source may be wrong, so I opened the NuGet.Config to check and the 3 paths are correct and there!
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
<add key="Nightly ASP.NET Web Stack" value="http://www.myget.org/F/aspnetwebstacknightly/" />
<add key="Bind Solution" value="W:\Cloud\Dropbox\Bind Defaults\Nuget Repository" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
</activePackageSource>
</configuration>
Nuget.exe not exist
Checked on .nuget folder and .exe is in the directory!
Checked in Path of windows and there is!
I tried to run the command manually and it run successfully!
nuget install packages.config -source "" -NonInteractive -RequireConsent -solutionDir "W:\C
lients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\ "
Full error:
Error 1 The system cannot find the path specified. CreditoImobiliarioBB.Domain
Error 2 The command ""W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB.nuget\NuGet.exe" install "W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\CreditoImobiliarioBB.Model\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "W:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\ " " exited with code -1. CreditoImobiliarioBB.Domain
Considerations
Only projects that have local packages (Source is key="Bind Solution" value="W:\Cloud\Dropbox\Bind Defaults\Nuget Repository") is that they are in trouble. And recently the location of packages moved to another directory (in this case to W:\Cloud\Dropbox\Bind Defaults\Nuget Repository).
I had a similar problem recently, I fixed it by doing this:
Update Visual Studio to the latest version. (Extensions and Updates - Product Updates)
Update Nugget to the latest version. (Extensions and Updates - Visual Studio Gallery)
Clear the Package Cache. (Options - Package Manager)
Rebuild the solution.
Hope it helps.
I ran into a similar problem with NuGet.exe and WG.exe for WebGrease. I realized that with my Virus Protection turned on, it wasn't allowing the .exe files to come down properly. Once I disabled my Virus Protection, I was able to get everything I need (company is using McAfee).
Related
I am trying to use nuget local feed for publishing my packages. So, I tried to push my first component / package. I have the following nuget.config in my sdk project:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
<add key="local feed" value="x:\nuget\packages\" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
</configuration>
SDK Project's configuration is as follows:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Title>My custom component</Title>
<Version>0.0.1-alpha</Version>
<PackageId>$(RootNamespace)</PackageId>
</PropertyGroup>
I set the project to Release configuration, and execute Pack command. As a result, .nupkg file is created in bin/Release folder.
Inside the package manager console window, I execute the following command:
nuget add pathToNupkgFile -Source x:\nuget\packages
So far so good, package is located in folder x:\nuget\packages\companyname.components.blazor.mycomponent\0.0.1-alpha.
Now I created new solution where I want to consume package from local feed. I copied the same nuget.config file to folder where new solution was created. I open Manage Nuget Packages for Solution (short MNPfS), search for new package, and install it. All fine until this point.
Now, if I do the same procedure and create 0.0.2-alpha nupkg, after nuget add command, new version is present in x:\nuget...., but I am unable to browse local feed any more in MNPfS screen. As soon as I open MNPfS, I get following message in window where packages should be listed:
Error occured
And error list window displays following message:
Error [local feed] '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1.
Now, if I delete version 0.0.1-alpha from local feed repository, then I can browse again in MNPfS and new package is displayed, and can be installed. So, the problem occurs only when two versions of same package are present.
Anyone knows why is this happening, and how can I have multiple versions of same package in local feed?
Looks like the problem was related to nuget add command -Source parameter. When source points to partition with FUSE file system, then it does not create proper nuspec file, although no error is provided in Package Manager console.
nuspec file results in content with multiple NULL values. If I specify -Source to current partition where project is, then nuspec file is properly created, and then I can just copy the content to FUSE file system, and all works OK.
How to Install the Azure Artifacts Packages in VS Code, I tried to check the Connect to feed option and found there are multiple Nuget options like Dotnet, Nuget.exe, and Visual Studio, etc.
But when I am trying for VS Code then it's not working.
What I did so far in the VS Code?
1 Approach) I install the NuGet package manager and when I am trying to do search my package then it's not showing in the list. but using this command "Get-PackageSource" I am able to see the package in the console.
2 Approach) I created one nuget.config file and mentioned below the package details
'<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="test#Release" value="https://xxxxxxx.pkgs.visualstudio.com/_packaging/test/nuget/v3/index.json" />
</packageSources>
</configuration>'
after that running NuGet restore command and below giving the output but I didn't see any dependencies in the project and the same thing working fine using Visual Studio 2017
NuGet Config files used:
C:\Users\sudhir\source\repos\testPrivateNugetFeed\NuGet.Config
C:\Users\sudhir\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config
Feeds used:
`https://XXXXX.pkgs.visualstudio.com/_packaging/test/nuget/v3/index.json'
All projects are up-to-date for restore.
I have also followed this thread
Add custom package source to Visual Studio Code
Please give me some solution.
How to Install Azure Artifacts Packages dependencies in Vs Code?
I could reproduce this issue on my side, it seems to be a limitation of the NuGet package manager extension or Visual Studio Code.
No matter how I set up my Nuget.config file, I could not see the custom nuget package from the Azure devops feed in the NuGet package manager extension. I also test any other extension like NuGet Gallery, but not success.
To resolve this issue, I add following nuget.config file in my project, which next to my .sln file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AzureDevOpsFeed" value="https://pkgs.dev.azure.com/<MyORGName>/_packaging/<MyFeedName>/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<config>
</config>
<packageSourceCredentials>
<AzureDevOpsFeed>
<add key="Username" value="LeoTest" />
<add key="ClearTextPassword" value="My PAT Here" />
</AzureDevOpsFeed>
</packageSourceCredentials>
</configuration>
And add following in my packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LibA" version="1.0.0" targetFramework="net461" />
</packages>
The LibA is a custom package in my Azure decops feed:
Then I use nuget.exe to restore the package for my project:
If nuget restore not work for you, please share the log for that command.
Package Manager in VS2019 is totally broken for me.
When I attempt to view packages for my solution the UI just says "Error occurred" with the details below, '' is not a valid version string
My build environment is heavily customized with custom targets, and packages are loaded via an out-of-VS process called "corext." So my question is what file is being parsed when attempting to load the package manager? I have a nuget.config at the root of my enlistment as well as under AppData\Roaming\NuGet which I've deleted with no results. I've tried clearing out all the nuget caches. I've tried all of the suggestions in this post without luck. If I could get any more logs at all I might be able to unblock myself. I get exactly the same results in VS 2017. Any ideas?
After countless hours of pain it was suggested to me to look for a <PackageReference> node with an unresolvable version number. To do this I went to any project in my tree and ran: msbuild /pp:pp.log foo.csproj. This generates a preprocessing log. In that log file I did a "find all instances" of "PackageReference". The first hit was a PackageReference in Directory.Build.props without a version number. The fix was to add (any) version number. I'll surely need to put in the right version number but the solution will look like this:
First, please check your nuget.config file at the root of my enlistment. Usually, when you have a new nuget.config file over the root directory path of your project.
The current project and all projects in the subdirectory will use this nuget.config rather than the global nuget.config file(AppData\Roaming\NuGet). It will add the new pakageSource and will overwrite the same name of the packagesource from the global nuget.config file.
See this document about this info.
1) Please enter the nuget.config at the root of your enlistment.
Check if you have such node like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
..............
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="test123" value="C:\xxxx\" />
<add key="github source" value="https://xxxxxxxxxxxxxxxxxxxx"/>
</packageSources>
<disabledPackageSources>
<add key="test123" value="true" />
</disabledPackageSources>
</configuration>
If so, you should check every packagesource path and make sure there is no such a space on every packagesource in case of spelling mistakes.
Or you could use disabledPackageSources node to disable any packagesources except nuget.org.
Like this:
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="test123" value="C:\xxxx\" />
<add key="github source" value="https://xxxxxxxxxxxxxxxxxxxx"/>
.........
.........
</packageSources>
<disabledPackageSources>
<add key="test123" value="true" />
<add key="github source" value="true" />
..........
</disabledPackageSources>
Then, close VS and restart your project to test again.
Or you could just delete such nuget.config to check whether there is a error node in it. Also, make a backup.
2) Second, you could run this below under Tools-->NuGet Package Manager-->Package Manager Console.
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
3) please try to a new project to check whether the issue persists in the new project. This can determine if there is a problem with nuget.config in that project.
Besides, you could try to share the nuget.config file with us.
In addition, if these do not help, please try the following steps:
a) disable any third party extensions under Extensions-->Manage Extensions
b) If these do not help, try to repair VS or update VS if there is a new update.
Using AzureDevOps I should be able to restore packages from the feeds hosted within AzureDevOps.
The Nuget.config seems correct, the build has access to the feed, locally it runs fine with explicitly using the same config file.
I've seen VSTS Build vNext NuGet custom package source but would very much like to stay out of adding apikey's there. The official documentation states it should be possible: https://www.visualstudio.com/docs/package/get-started/build/team-build
NuGet.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Net2Library" value="https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/yyy/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
Feed settings
Restore settings (it uses the correct config, visible from listing the feed in the logs)
Relevant logs:
2016-07-30T12:33:37.8085538Z Restoring NuGet package XYZ.2016.7.29.14.
2016-07-30T12:33:42.6885539Z Unable to find version '2016.7.29.14' of package 'XYZ'.
2016-07-30T12:33:42.6915543Z Feeds used:
2016-07-30T12:33:42.6925542Z C:\Users\buildguest\AppData\Local\NuGet\Cache
2016-07-30T12:33:42.6925542Z C:\Users\buildguest\.nuget\packages\
2016-07-30T12:33:42.6925542Z https://api.nuget.org/v3/index.json
2016-07-30T12:33:42.6935552Z https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/yyy/nuget/v3/index.json
2016-07-30T12:33:42.7235541Z ##[debug]rc:1
2016-07-30T12:33:42.7245545Z ##[debug]success:false
2016-07-30T12:33:42.7325527Z ##[error]Error: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.1\agent\Worker\Tools\nuget.exe failed with return code: 1
2016-07-30T12:33:42.7335525Z ##[error]Packages failed to install
2016-07-30T12:33:42.7335525Z ##[debug]task result: Failed
2016-07-30T12:33:42.7345538Z ##[error]Return code: 1
This is caused by VSTS issue which has been fixed by now, please try the build again.
Issue: Failures while restoring nuget packages in Visual Studio Team Services – 8/1 – Resolved
Other possible issue: Packaging issues with Visual Studio Team Services – 7/30 – Resolved
.
I'm having the exact same issue. I've been experiencing the error most of the times when the build starts from a push from the local repo (either from VS 2015 or git bash). The workaround for me has been to queue a build directly on VSTS build definition, through "Queue Build.It's annoying but it's the only way I found to overcome the issue. I do think this is a bug and hope MS fix it. Hope my workaround helps.
I am using myget for my Nuget packages. Because i am using a private feed with credentials, i followed this blog: http://www.xavierdecoster.com/deploying-to-azure-web-sites-using-nuget-package-restore-from-a-secured-feed
My local (project) nuget.config (located in the .nuget folder in the solution) looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSource>
<clear />
<add key="EcareMyGet" value="https://www.myget.org/F/rai69/"></add>
</packageSource>
<activePackageSource>
<add key="EcareMyGet" value="https://www.myget.org/F/rai69/"></add>
</activePackageSource>
<packageSourceCredentials>
<EcareMyGet>
<add key="Username" value="www.myget.org/raimond" />
<add key="ClearTextPassword" value="wachtwoord" />
</EcareMyGet>
</packageSourceCredentials>
</configuration>
In my nuget.targets i've changed the restore command according to the blog:
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -NonInteractive $(RequireConsentSwitch) -solutionDir "$(SolutionDir)\" -Verbosity detailed </RestoreCommand>
Despite this, the buildserver is still using nuget.org as source:
NuGet.exe sources
Registered Sources:
1. https://nuget.org/api/v2/ [Enabled]
https://nuget.org/api/v2/
Who knows a solution?
Answer: replace <packageSource> by <packageSources> in the nuget.config file
Below is the conversation that lead to the answer...
Just to be sure, did you also read the part where you disable the -RequireConsent switch?
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">
false
</RequireRestoreConsent>
Also, make sure you didn't configure it in the MSBuild PackageSources element, which by default looks as shown below (no package source configured):
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages.
By default, registered sources under %APPDATA%\NuGet\NuGet.Config
will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be
excluded if package sources are specified and it does not appear
in the list -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
If you did and that's not the issue, can you please share a little more detail about the output logs so I can determine when the issue is caused and by what command?
You write that you use "My local (project) nuget.config", which makes me believe that you have the nuget.config file located in your project folder.
You can read about the NuGet Config File here. There you'll see that "NuGet first loads NuGet.config from the default location, then loads any file named NuGet.config starting from the root of the current drive and ending in the current directory.".
What this means, it that NuGet will look for the configuration in the folder hierarchy all the way from the root and to the location of nuget.exe, which usually is under the .nuget folder in the solution root. This means that it will never look inside the project folders in your solution. So you can try to move your nuget.config to the solution folder, and see it it gets read properly then.