VSTS Build and NuGet Publisher - 405 Method Not Allowed - nuget

I'm trying to configure VSTS build that will publish NuGet package to internal feed. Puckage is being created successfully but have issue with NuGet Publisher.
When NuGet publisher is trying to publish package then I got error:
Using credentials from config. UserName: VssSessionToken
Pushing PackageName_20170608-081053 to 'https://...visualstudio.com/_packaging/b5ae5df2-b73e-4af2-...-66df-4340-8e68-9d4be0071ba8/nuget/v2/'...
PUT https://...visualstudio.com/_packaging/b5ae5df2-b73e-4af2-...-66df-4340-8e68-9d4be0071ba8/nuget/v2/
System.InvalidOperationException: Failed to process request. 'Method Not Allowed'.
The remote server returned an error: (405) Method Not Allowed.. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
...
Error: d:\a\_tasks\NuGetPublisher_333b11bd-d341-\0.2.34\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe failed with return code: 1
Packages failed to publish
I've already checked permissions to feed and Project Collection Build Service is added as a contributor. I've also tried to play with NuGet versions but it didn't help.

The issue was that I was trying to publish to release view. Instead I have to push the package to a feed first.
Here are details:
https://github.com/Microsoft/vsts-tasks/issues/4493

Related

YAML file build issues github nuget repo 404

I have this YAML file that has something similar to this code inside it
- name: Build solution
run: msbuild /p:Configuration=Release /p:Platform="Any CPU" .\SomeLargeSolution.sln /t:build /bl:${Env:ARTIFACTS_LOCATION}/logs/build.binlog
When this step runs in the build process I get something like this error:
PublishNuGet:
nuget.exe push "NuGet\*.nupkg" -Source "GPR" -SkipDuplicate
WARNING: No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/SomeNugetGitRepo'. To save an API Key for a source use the 'setApiKey' command.
Pushing SomeNugetPackage.Integration.Model.4.2.4.346.nupkg to 'https://nuget.pkg.github.com/SomeNugetGitRepo'...
PUT https://nuget.pkg.github.com/SomeNugetGitRepo/
WARNING: Please use the --api-key option when publishing to GitHub Packages
NotFound https://nuget.pkg.github.com/SomeNugetGitRepo/ 229ms
Response status code does not indicate success: 404 (Not Found).
I'm wondering where these nuget settings are configured.. For instance how do I set the value of the source "GPR" maybe I want to change the source to https://nuget.pkg.github.com/SomeOTHERNugetGitRepo?

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".

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

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"/>

Azure Devops: Error: No package found with specified pattern: D:\a\1\s\**\*.zip

I'm trying to set up my first pipeline to deploy a web app to an Azure App service. I am able to manually publish the site via Visual Studio but now I am trying to get it build and deploy from an Azure Repo. The build part works fine and without errors. The problem comes in when I add in the deploy task. The deploy task doesn't seem to be able to find the file/s to deploy.
My Pipeline
My Publish config:
In my Pipeline the Publish section shows the following debug info:
##[debug]Exit code 0 received from tool 'C:\Program Files\dotnet\dotnet.exe'
##[debug]STDIO streams have closed for tool 'C:\Program Files\dotnet\dotnet.exe'
##[debug]modifyOutputPath=true
##[debug]Zip Source: D:\a\1\a\s
##[debug]Zip arguments: Source: D:\a\1\a\s , target: D:\a\1\a\s.zip
##[debug]Successfully created archive D:\a\1\a\s.zip
##[debug]rm -rf D:\a\1\a\s
##[debug]removing directory D:\a\1\a\s
The Publish Artifact config section:
The Publish Artifact section shows the following success message:
File upload succeed.
Upload 'D:\a\1\a' to file container: '#/10370704/drop'
Associated artifact 541 with build 667
The Web Deployment config looks like this:
Then the Azure Web App Deployment shows the following debug and error message:
##[debug]pattern: 'D:\a\1\s**.zip'
##[debug]expanding braces
##[debug]pattern: 'D:/a/1/s/**/.zip'
##[debug]applying include pattern against original list
##[debug]0 matches
##[debug]0 final results
##[debug]No matching files were found with search pattern: D:\a\1\s**.zip
##[debug]Deployment Failed with Error: Error: No package found with specified pattern:
D:\a\1\s**.zipCheck if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
##[debug]task result: Failed
##[error]Error: No package found with specified pattern: D:\a\1\s***.zip
You can try to use powershell task to list the files in the folder before publish the Azure Web App.
From your description, it seems the pattern should be $(Build.ArtifactStagingDirectory)/*.zip?

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.