Pushing CEFSharp packages to local nuget gives "406 (Not Acceptable)" error - nuget

I've implemented CEFSharp and need to push the required nuget packages to a local nuget server.
Other packages work fine (both created locally, or from third parties), but all of the CEFSharp packages error with 406 (Not Acceptable)
C:\nuget\cef>nuget push CefSharp.Wpf.96.0.180.nupkg
Pushing CefSharp.Wpf.96.0.180.nupkg to 'http://nugetServer/Nuget/nuget/'...
PUT http://nugetServerNuget/nuget/
NotAcceptable http://nugetServerNuget/nuget/ 90ms
Response status code does not indicate success: 406 (Not Acceptable).
This happens for each of the nuget packages I try.
We're using v96.0.18, but I've tried the latest version for testing purposes.
Package
Version
Result?
cef.redist.x64
96.0.18
Fail
cef.redist.x64
97.1.1
Success
cef.redist.x86
96.0.18
Fail
cef.redist.x86
97.1.1
Success
CefSharp.Common
96.0.18
Fail
CefSharp.Common
97.1.11
Fail
CefSharp.Wpf
96.0.18
Fail
CefSharp.Wpf
97.1.11
Fail
No messages appear in any logs in IIS. Restarting IIS and rebooting servers hasn't worked.
We're using the latest NuGet.Server.3.4.1 and Nuget CLI v6.0.0.

The CefSharp packages include the source code within the src folder.
i received 406 because my nuget package had a src dir.
the nuget server handles packages with src dirs as symbol packages, so in the web.config you have to set "ignoreSymbolsPackages" to false.
According to https://github.com/NuGet/NuGetGallery/issues/5084#issuecomment-486541884 the packages will be treated as symbol packages and setting ignoreSymbolsPackages to false is required.
<add key="ignoreSymbolsPackages" value="false"/>

Related

Bamboo plugin for fetching NuGet packages from Artifactory is throwing a "String index out of bounds" error and causing build to fail

I have a visual studio project which uses several libraries I fetched from NuGet.
I recently created a remote repository in Artifactory that fetches and caches the NuGet packages.
The goal is to remove the "packages" directory from my project's source control and restore the libraries through the artifactory repository every time the project is built.
I am successfully able to do this and build the project in bamboo using a script task and the following command: nuget restore solutionName.sln -Source http://artifactoryRepoAddress
Despite the script working, I would like to use the plugin for bamboo from Artifactory (docs here) since this will collect build information and push it to Artifactory automatically. I am unable to get this to work. The build fails every time with the following error:
java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:185)
at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.executeRestore(ArtifactoryDotNetTaskBase.java:113)
at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.runTask(ArtifactoryDotNetTaskBase.java:74)
at org.jfrog.bamboo.task.ArtifactoryTaskType.execute(ArtifactoryTaskType.java:46)
at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$2(TaskExecutorImpl.java:321)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:321)
at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118)
at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:205)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:177)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:169)
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:162)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:122)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.base/java.lang.String.substring(Unknown Source)
at org.jfrog.build.extractor.nuget.extractor.NugetRun.addSourceToConfigFile(NugetRun.java:222)
at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareConfig(NugetRun.java:211)
at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareAndRunCmd(NugetRun.java:193)
at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:175)
... 19 more
I am wondering if anyone has seen this before or knows how I might fix it. I am thinking that the most likely issue has something to do with the "arguments" section. Here is an image of the input fields. For this example, I am just using placeholder text for the project name and source address: image
There is so little documentation on this plugin that is has been difficult to even get this far.

Nuget Package Manager: "...is not a valid JSON object"

I setup a Nexus repo recently. I see the expected result if I type the URL into a browser:
I've successfully added this nuget server as a source to my VS2022 package manager on one machine. On my other machine, however (also with VS2022 installed), I get an error when trying to browse this repo in the package manager:
Error [sourcename] Unable to load the service index for source [url].
The content at '[url]' is not a valid JSON object.
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
It looks like the package manager is expecting JSON, but the nuget server is sending XML. How can I fix this?
On Windows in configuration AppData/Roaming/Nuget/Nuget.config remove protocol version or change to 2 for your feed. Probably you have protocolVersion="3".

Artifactory's nuget repo with a path: it works for push but not for install

My %userprofile%\appdata\Roaming\nuget\NuGet.Config contains:
<configuration>
<packageSources>
<add key="rt1" value="https://my-server.com/artifactory/api/nuget/nuget-local" />
<add key="rt2" value="https://my-server.com/artifactory/api/nuget/nuget-local/rt2" />
</packageSources>
Now push works for both, but install works only with rt1.
nuget push My.Package.1.0.0.nupkg -source rt1 # works
nuget push My.Package.1.0.0.nupkg -source rt2 # works
nuget install My.Package # DOES NOT WORK IF I HAVE rt2 as source
OK https://my-server.com/artifactory/api/nuget/nuget-local/FindPackagesById()?id='My.Package'&semVerLevel=2.0.0 154ms
An error occurred while retrieving package metadata for 'My.Package' from source 'rt2'.
Failed to fetch results from V2 feed at 'https://my-server.com/artifactory/api/nuget/nuget-local/rt2/FindPackagesById()?id='My.Package'&semVerLevel=2.0.0' with following message : Response status code does not indicate success: 405 (Method Not Allowed).
Response status code does not indicate success: 405 (Method Not Allowed).
Is this expected behavior? It looks like nuget expects FindPackagesById() to be available on repo url for install operation, and it is failing on rt2.
Is there any way to use the path as a source, without creating virtual repo with Includes/Excludes config? Would jfrog nuget cli give me different behavior?
I found it was also asked in jfrog: https://www.jfrog.com/jira/browse/RTFACT-23310, but it was marked as Not a Bug without any explanation.
Someone filed an issue with Artifactory/JFrog and they closed it as "Not a Bug": https://www.jfrog.com/jira/browse/RTFACT-23310
So apparently using package paths is not supported when pulling from Artifactory as a nuget source (even though it is supported when pushing).

How to specify a package source for nuget

We are currently using SyncFusion for our solution at work for one of our solutions. In local every package are restoring but in VSTS it seem that it's having some difficulties to mix both syncfusion packages with official nuget packages.
I posted the entire log of the nuget restore on a gist here : https://gist.github.com/erickgirard/844f57d0f98f0cbea13d6ad4ddbde7e0
What I believe is that for every package in packages.config it's trying all sources (is there a possibility to specify a source for one package?)
Not quite sure of what are the solution here beside commiting the syncfusion dlls in the source control.
Here is the nuget.config file of the solution:
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="sync fusion nuget feed" value="http://nuget.syncfusion.com/aspnetmvc" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
</packageRestore>
</configuration>
Here is an excerpt of the logs:
[...]
2017-10-16T16:10:33.6063822Z Acquiring lock for the installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:33.6123760Z Acquired lock for the installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:33.6123760Z Installing Swashbuckle.Core 5.5.3.
2017-10-16T16:10:33.6173723Z NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='System.IdentityModel.Tokens.Jwt',Version='5.1.4') 97ms
2017-10-16T16:10:33.6173723Z GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='System.IdentityModel.Tokens.Jwt'
2017-10-16T16:10:33.6453473Z NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='Microsoft.Net.Compilers',Version='2.2.0') 562ms
2017-10-16T16:10:33.6453473Z GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Microsoft.Net.Compilers'
2017-10-16T16:10:33.6913056Z OK https://api.nuget.org/v3-flatcontainer/system.identitymodel.tokens.jwt/5.1.4/system.identitymodel.tokens.jwt.5.1.4.nupkg 143ms
2017-10-16T16:10:33.6913056Z Acquiring lock for the installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:33.6923050Z Acquired lock for the installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:33.6923050Z Installing System.IdentityModel.Tokens.Jwt 5.1.4.
2017-10-16T16:10:33.6923050Z NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='Unity.AspNet.WebApi',Version='4.0.1') 103ms
2017-10-16T16:10:33.6923050Z GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Unity.AspNet.WebApi'
2017-10-16T16:10:33.6943020Z OK http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Microsoft.Net.Compilers' 49ms
2017-10-16T16:10:33.7092888Z OK http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Unity.AspNet.WebApi' 44ms
2017-10-16T16:10:33.7312690Z OK https://api.nuget.org/v3-flatcontainer/unity.aspnet.webapi/4.0.1/unity.aspnet.webapi.4.0.1.nupkg 170ms
[...]
2017-10-16T16:10:41.1345069Z Completed installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:41.1395038Z Adding package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.1425014Z Added package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.1455002Z Added package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
2017-10-16T16:10:41.3558804Z Completed installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:41.3578871Z Completed installation of Microsoft.TeamFoundationServer.Client 15.115.0-preview
2017-10-16T16:10:41.3578871Z Adding package 'Microsoft.TeamFoundationServer.Client.15.115.0-preview' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.3588793Z Adding package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
[...]
2017-10-16T16:10:56.8833741Z Running restore with 2 concurrent jobs.
2017-10-16T16:10:56.8853733Z Reading project file d:\a\3\s\Projets\DobermanHub.GFI.Functions\DobermanHub.GFI.Functions.csproj.
2017-10-16T16:10:56.9003673Z Restoring packages for d:\a\3\s\Projets\DobermanHub.GFI.Functions\DobermanHub.GFI.Functions.csproj...
2017-10-16T16:10:56.9153620Z Restoring packages for .NETFramework,Version=v4.6.1...
2017-10-16T16:10:57.0043336Z GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.0203252Z GET https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/index.json
2017-10-16T16:10:57.0992975Z OK https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/index.json 85ms
2017-10-16T16:10:57.1122942Z InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 111ms
2017-10-16T16:10:57.1162923Z Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''.
2017-10-16T16:10:57.1162923Z Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:57.1162923Z GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.1332855Z GET https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/1.0.2/microsoft.net.sdk.functions.1.0.2.nupkg
2017-10-16T16:10:57.1442827Z OK https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/1.0.2/microsoft.net.sdk.functions.1.0.2.nupkg 10ms
2017-10-16T16:10:57.1762708Z InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 59ms
2017-10-16T16:10:57.1762708Z Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''.
2017-10-16T16:10:57.1762708Z Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:57.1762708Z GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.3411621Z InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 165ms
2017-10-16T16:10:59.6996347Z System.AggregateException: One or more errors occurred. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'Microsoft.NET.Sdk.Functions' from remote source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:59.6996347Z at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
2017-10-16T16:10:59.6996347Z at NuGet.Protocol.HttpSource.<>c__DisplayClass12_0`1.<<GetAsync>b__0>d.MoveNext()
2017-10-16T16:10:59.6996347Z --- End of stack trace from previous location where exception was thrown ---
2017-10-16T16:10:59.7006128Z at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-10-16T16:10:59.7006128Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-10-16T16:10:59.7006128Z at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__2`1.MoveNext()
In our NuGet Server, we are maintaining multiple Feeds based on platforms and in NuGet site we are displaying friendly feed URLs. If you copy and paste those friendly URLs in any browser, it will redirect to actual Feed Link.
Friendly Feed URL:
http://nuget.syncfusion.com/aspnetmvc/
Actual Feed URL:
http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/
Your given below URL is incorrect hence it’s return 500 error while resorting the ASPNET MVC package.
http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id=%27Microsoft.NET.Sdk.Functions%27
In your case, you must use actual feed URL instead of friendly URL.
http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id=%27Microsoft.NET.Sdk.Functions%27
Please follow the steps given in the below link.
https://www.syncfusion.com/kb/7609/how-to-install-syncfusion-nuget-packages-in-visual-studio-2017
Thanks,
Mathan Kumar

Publishing to Symbol Source from Team City

For awhile in my Team City build, I am unable to publish my source NuGet packages to symbolsource.org as it responds with 500 Internal Server Error.
[16:02:36][push] Pushing NCode.Composition.DisposableParts 1.0.1 to the symbol server (http://nuget.gw.symbolsource.org/Public/NuGet)...
[16:04:18][push] Failed to process request. 'Internal Server Error'.
[16:04:18][push] The remote server returned an error: (500) Internal Server Error..
[16:04:18][push] Process exited with code 1
I am able to publish my normal packages to NuGet.org just fine. I believe that I have properly configured everything as documented by symbol source.
https://www.symbolsource.org/MyGet/Wiki/Publishing
http://www.symbolsource.org/Public/Metadata/NuGet
https://www.symbolsource.org/Public/Account/Register
Here is my Build Step configuration for NuGet Publish:
Runner Type: NuGet Publish
NuGet.exe: Default 2.8.6
Packages: *.nupkg
API Key: (my personal API key from NuGet.org)
Package Source: (blank)
In my build output directory and artifacts recognized by TeamCity, I do have both of my packages in there:
NCode.Composition.DisposableParts.1.0.1.nupkg
NCode.Composition.DisposableParts.1.0.1.symbols.nupkg
Any assistance would be appreciated!
I think that the problem is with two packages with the same name. Did you try a workaround with another build configuration and snapshot dependency?
I'm using another build configuration with snapshot dependency to build which produces *.nupkg and *.symbol.nupkg. Artifact dependency is set to:
-:*.nupkg => <replace with location>
+:*.symbol.nupkg
The build configuration only publishes *.symbol.nupkg to symbolsource.org.