When trying to generate a build, I am getting the following error:
1 error(s), 0 warning(s)
$/source control my solution....../Web.sln - 1 error(s), 0 warning(s), View Log File
D:\Builds\.....zWeb\.nuget\NuGet.targets (93): The underlying connection was closed: An unexpected error occurred on a send.
I am configuring the repository URLs both here:
And in the NuGet.config file:
I've tried the following:
tried multiple network connections (to rule out firewall issues)
restarted VS and reinstalled NuGet and all packages
cleaned, rebuilt
changed the downloadnuget setting
What am I doing wrong? How do I get this to build?
In case it is relevant, here's my nuget.targets file.
Hi try to place file nuget.config
in root of your solution like
x:\SolutionFolder\nuget.config
x:\SolutionFolder\Web.sln
then change nuget.config
to have
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="packages" />
</config>
<packageSources>
<add key="Your NuGet" value="\\YourServer\Nuget Gallery" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
the repositoryPath is relative to nuget.config file localization
create this network share and be sure that your use have access to it
<add key="Your NuGet" value="\\YourServer\Nuget Gallery" />
What tfs version and visual studio version you use localy and on the build server ?
Related
I've got a problem with building .NET 5 solutions using docker compose build or docker build.
Image which i'm using for building is:
mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim
The problem is that when I'm trying to build it on my machine (MacOS Monterey, intel) I've got following error with restoring nuget packages from the private feed:
#19 6.349 Failed to download package 'System.Runtime.CompilerServices.Unsafe.4.5.1' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/system.runtime.compilerservices.unsafe/4.5.1/system.runtime.compilerservices.unsafe.4.5.1.nupkg'.
#19 6.349 Connection refused (pyvvsblobprodsu6weus63.blob.core.windows.net:443)
#19 6.349 Connection refused
#19 6.357 Failed to download package 'Microsoft.Azure.Storage.Common.11.2.3' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/microsoft.azure.storage.common/11.2.3/microsoft.azure.storage.common.11.2.3.nupkg'.
#19 6.357 Connection refused (wg0vsblobprodsu6weus89.blob.core.windows.net:443)
#19 6.357 Connection refused
I'm copying nuget.config with credentials in dockerfile like
COPY nuget.config /
Here is my nuget.config copied to the container:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet V3" value="https://api.nuget.org/v3/index.json" />
<add key="DDDDD" value="https://XXXX.pkgs.visualstudio.com/_packaging/DDDDD/nuget/v3/index.json" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<config>
<add key="repositoryPath" value="packages" />
</config>
<packageSourceCredentials>
<DDDDD>
<add key="Username" value="SomeUsername" />
<add key="ClearTextPassword" value="SomePassword" />
</DDDDD>
</packageSourceCredentials>
</configuration>
Commands which i'm using to build containers:
docker compose up -d
docker build . -F API/Dockerfile
It's failing for both of them.
Can anybody tell me what's wrong? Maybe it's something with my machine setup?
Self answer for people having the same issue as I had:
The problem was the lack of this line in the nuget config:
in config section like:
<config>
<add key='maxHttpRequestsPerSource' value='10' />
<add key="repositoryPath" value="packages" />
</config>
After adding this key, everything is working as expected.
Keep in mind that your value for maxHttpRequestsPerSource may be different (less or more) so I advise doing a few experiments with other values.
Trying to fix a memory leak in xamarin.forms for uwp. I got the 4.8 source from the github, followed all the instructions on how to setup the build. When i build the xamarin.forms.sln i get the following error.
"Xamarin.Forms\Xamarin.Forms.sln" (Restore target) (1) ->
(Restore target) ->
Xamarin.Forms\Xamarin.Forms.Build.Tasks\Xamarin.Forms.Build.Tasks.csproj : error N
U1101: Unable to find package XliffTasks. No packages exist with this id in source(s): GrapeCity, Microsoft Visual Stud
io Offline Packages, nuget.org [Xamarin.Forms\Xamarin.Forms.sln]
any ideas where i am going wrong?
Thanks
You need to install xliff-tasks. Add https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json to your nuget.config. For example:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
I'm aware of the other posts about the same signature. I still can't resolve my issue after going thru them.
My team uses VSTS's build definition for continuous integration.
This build definition works fine until the lastes pull request.
I'm running into the error msg below during the Nuget Restore
2018-06-20T00:37:27.6438127Z System.AggregateException: One or more errors occurred. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/_packaging/CBT/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
I do have https://microsoft.pkgs.visualstudio.com/_packaging/CBT/nuget/v3/index.json in the nuget.config, and there is nothing changed in the nuget.config in the failing PR
I can nuget restore and build the entire solution successfully on my local machine using VS2017. The only related change in the PR is that instead of using package.config, it uses packagereference to get the nuget package. I tried to move back to using package.config, the build would still fail with the same error msg.
Thanks in advance.
You can update the VSTS feed with credentail (PAT or alternate credential) in the specified nuget.config file.
Such as:
nuget sources update -Name "vstsfeed" -Source https://microsoft.pkgs.visualstudio.com/_packaging/CBT/nuget/v3/index.json -Username "Alternate username" -Password "alternate password" -configfile /path/to/nuget.config
Then you can commit the changes for the nuget.config file and push to VSTS repo. And build again to check if it works.
You can use a command as shown in the accepted answer - also, you can add the feed in a nuget.config file placed in the root of your repo
Notice, this shows how to add credentials for a custom feed with spaces in the feed name: My Nuget Artifacts
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
<add key="My Nuget Artifacts" value="https://pkgs.dev.azure.com/ConsotoOrg/_packaging/Consoto/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<My_x0020_NuGet_x0020_Artifacts>
<add key="Username" value="justme" />
<add key="ClearTextPassword" value="xyzyoqyvslyfs1t1khru6wd33gebujhpr9moocbujfhv8ukxtxyz" />
</My_x0020_NuGet_x0020_Artifacts>
</packageSourceCredentials>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<!--
Used to specify trusted signers to allow during signature verification.
See: nuget.exe help trusted-signers
-->
<trustedSigners>
<author name="microsoft">
<certificate fingerprint="3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
</author>
<repository name="nuget.org" serviceIndex="https://api.nuget.org/v3/index.json">
<certificate fingerprint="0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
<owners>microsoft;aspnet;nuget</owners>
</repository>
</trustedSigners>
</configuration>
FWIW - In recent days, I've found I can clear up some NuGet restore errors by removing the trustedSigners section from the config
This is not what the problem was with the OP but I'm adding a note here since I found this question while searching for the same error message.
In our case we were building a .net 5 app for in Azure DevOps. We had to upgrade to a newer version of NuGet using the NuGet tool installer. Then the restore worked just fine using the .Net Core task with the restore command.
I have an issue in VS2015 where adding a NuGet source is not working.
The picture below shows the source. The URL and package name is correct and working (I can successfully push packages to the repo).
The problem is when I add it, check the checkbox, and select "Update" and "Save", it does not activate the source. When I go back into the dialog, the checkbox is unchecked. It remains unchecked no matter what I do.
I think this is a GUI issue, the problem seems to be it simply is not enabling it. Is there a config option in a project file I can manually this package source?
(Note that "NAME" and "http://myrepo.com" are not the real source name and url, but I have verified they are correct by pushing to it successfully.
Edit:
I checked the NuGet.config file and there is indeed an entry in the file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="NAME" value="http://myrepo.com" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
I had been running VS as administrator due to using a local IIS instance which requires administrator privileges, magicandre1981 pointed out that NuGet.config needs write permissions, so I gave full access to the folder to normal users (I believe the NuGet.config file was generated under the administrator context therefore lacking normal user permissions).
This by itself did not solve the issue, but doing a Nuget Package Restoreafterwards, caused the NuGet feed to display again.
I currently have the following nuget.config file. With automatic package restore it will create a package folder that is one level up from my solution folder. For example if my solution folder is on my desktop, the package folder will be generated within a /lib folder on my desktop. I would like for it to generate the /lib folder within my solution folder. How do I change the relative path to accomplish this?
<configuration>
<solution>
<add key="disableSourceControlIntegration"
value="true" />
</solution>
<config>
<add key="repositoryPath"
value="../lib" />
</config>
</configuration>
For example,
Bad: \desktop\lib\
Good: \desktop\mysolution\lib\
I tried this:
<config>
<add key="repositoryPath"
value="/lib" />
</config>
..and the package restore directory becomes c:\lib which is unexpected behavior.
In addition, please make sure your NuGet.Config file is added under your solution directory after you use "lib" path in that path.
I discovered that if I remove
<config>
<add key="repositoryPath"
value="../lib" />
</config>
...from nuget.config
Or
if I complete delete nuget.config (and use all defaults)
That the default behavior will be to create and add packages to this folder:
\desktop\mysolution\packages\
and while that is not named 'lib' it hardly matters - my key issue was to get the packages in to the solution folder.