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.
Related
Is there a way I can connect my Visual studio to Azure Artifact source feed with PAT token? I need to add packages to my project
Solution:
Create a nuget.config file in the root of your project (where sln is). I used the Package Manager Console to run the command "dotnet new nugetconfig"
In the nuget.exe file, I replaced content with following
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="FeedName" value="artifact URL" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json"/>
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSourceCredentials>
<FeedName>
<add key="Username" value="User" />
<add key="ClearTextPassword" value="%PATTokenEnvrionmentVariable%" />
</FeedNamet>
</packageSourceCredentials>
</configuration>
Then I ran "dotnet restore" and restarted Visual studio
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.
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 ?
I am setting up my application for CI&D. I created a DEV-Deploy web.config transform which contains the connection strings for the dev testing environment.
Here are the contents of the Web.DEV-Deploy.config connection string section:
<connectionStrings xdt:Transform="RemoveAttributes(configSource)">
<add name="DbContext"
providerName="MySql.Data.MySqlClient"
connectionString="CXN_STRING"
xdt:Transform="Insert" xdt:Locator="Match(name)"/>
<add name="elmah"
connectionString="CXN_STRING"
xdt:Transform="Insert" xdt:Locator="Match(name)"/>
</connectionStrings>
It should look like:
<connectionStrings>
<add name="DbContext" providerName="MySql.Data.MySqlClient"
connectionString="CXN_STRING"/>
<add name="elmah" connectionString="CXN_STRING"/>
</connectionStrings>
I'm building using the command line and I have tried the following commands, neither of which work:
msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /P:TransformConfigFiles=true
msbuild web\web.csproj /T:Package /P:Configuration=DEV-Deploy /t:TransformWebConfig
The deploy task looks like this:
web.deploy.cmd /Y /M:https://MACHINEIP:8172/msdeploy.axd -allowUntrusted /U:USERNAME /P:PASSWORD /A:Basic
The web.config looks like this upon deployment:
<connectionStrings configSource="connectionStrings.config"></connectionStrings>
I have tested to the best of my ability on my local machine and have not been able to duplicate the issue. What do I need to do to get the transform working correctly on the build?
Our CI&D team put the build/deploy scripts into source control and after looking them over, everything above was correct, the problem was the path for the build command was wrong while the command itself was correct.
Once that was updated the web.config transformed correctly.