`dotnet new` throws 401 unauthorized without version on package name - .net-core

So I have a dotnet template that is published to nuget, but it is only getting installed when running the install command with the version like so: dotnet new --install Foundation.Api::0.3.0. When I run the install command without the version dotnet new --install Foundation.Api, it gives me a 401 unauthorized. Is there some kind of setting I need to add to my csproj? I'm 99% i've done this before without the version and it's ran just fine.
Here's the full error:
Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp1.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\Paul\.templateengine\dotnetcli\v5.0.100\scratch\restore.csproj]
Retrying 'FindPackagesByIdAsync' for source 'https://company.pkgs.visualstudio.com/_packaging/94b81536-897b-42e6-8b47-bca8f94285e6/nuget/v3/flat2/foundation.api/index.json'.
Response status code does not indicate success: 401 (Unauthorized).
Retrying 'FindPackagesByIdAsync' for source 'https://company.pkgs.visualstudio.com/_packaging/94b81536-897b-42e6-8b47-bca8f94285e6/nuget/v3/flat2/foundation.api/index.json'.
Response status code does not indicate success: 401 (Unauthorized).
C:\Program Files\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Failed to retrieve information about 'Foundation.Api' from remote source 'https://company.pkgs.visualstudio.com/_packaging/94b81536-897b-42e6-8b47-bca8f94285e6/nuget/v3/flat2/foundation.api/index.json'. [C:\Users\Paul\.templateengine\dotnetcli\v5.0.100\scratch\restore.csproj]
C:\Program Files\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Users\Paul\.templateengine\dotnetcli\v5.0.100\scratch\restore.csproj]

Related

failed to deploy artifacts to artifactory version 6.9.6 giving an error Unauthorized 401

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project time-demo-api: Failed to deploy artifacts: Could not transfer artifact com.mycompany:time-demo-api:pom:1.0.1-20210503.122407-1 from/to snapshots (http://localhost:8081/artifactory/oneweb-snapshot): Unauthorized (401
It seems that the issue is incorrect credentials being used here causing the 401 unauthorized issue. Check the settings.xml if the correct credentials are being passed.

Could not authorize while connecting to the SonarQube server. Check your credentials and try again

I am trying to run SonarQube for my Xamarin Forms project, I am on the path where my .SLN file is there and executing the following command
Command:
$ mono /Users/akandasamy/Development/HIDProjects/sonar-scanner-msbuild-4.0.2.892/MSBuild.SonarQube.Runner.exe begin /k:"HIDReaderManagerApp" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="My Login Token"
Error:
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at /Users/akandasamy/Development/HIDProjects/sonar-scanner-msbuild-4.0.2.892/SonarQube.Analysis.xml
Loading analysis properties from /Users/akandasamy/Development/HIDProjects/sonar-scanner-msbuild-4.0.2.892/SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
17:29:10.391 Updating build integration targets...
17:29:10.414 Fetching analysis configuration settings...
17:29:10.517 Failed to request and parse 'http://localhost:9000/api/settings/values?component=HIDReaderManagerApp': The remote server returned an error: (401) .
17:29:10.517 Could not authorize while connecting to the SonarQube server. Check your credentials and try again.
17:29:10.518 Pre-processing failed. Exit code: 1
The api/settings/values API requires Browse permission when the component argument is used. Please, see if the user you are authenticating with has the aforementioned permission.
More details about security and permissions here:
https://docs.sonarqube.org/latest/instance-administration/security

VSTS dotnet restore command fails to get nuget package

I have been successfully running a build definition against a dotnet core web application for months now but the build has started to fail. The error occurs when trying to run a dotnet restore command on my projects.
https://i.imgur.com/4EioYjr.png
I am getting the following error when the restore task runs:
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-
flatcontainer/netcore.mailkit/index.json'.
Response status code does not indicate success: 504 (Gateway Timeout).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-
flatcontainer/netcore.mailkit/index.json'.
Response status code does not indicate success: 504 (Gateway Timeout).
I have manually run the dotnet restore command on my local machine and do not get the error.
Has anyone experienced something like this before in VSTS?
Thanks
This looks like it was a Microsoft issue.
http://blogs.msdn.microsoft.com/vsoservice/?p=15195
https://developercommunity.visualstudio.com/content/problem/129183/getting-504-gateway-timeout-on-hosted-vs2017-agent.html

System.TypeLoadException: Could not resolve type with token 0100000f

I get this error running a sample asp.net 5 application on ubuntu 14.04LTS.
after a successful dnu restore command, running dnx kestrel command returns the following error: System.TypeLoadException: Could not resolve type with token 0100000f.
I tried different versions of mono still the same error. I noticed also a difference between kestrel versions in my project.lock.json file(could it be it).
on the browser it returned an internal server error!
I can post the file if needed.
appreciate it!

swagger-document-override/md-override-loader - FAILED

I am able to generate code using Autorest with my api when I host it on a server 2012R2 running IIS
However when I try to run it with the localhost url I get a could not read message.
I can read swagger.json in the browser
I am using the command
autorest --input-file=https://localhost:44348/api-docs/v1/swagger.json
--output-folder=generated --csharp --namespace=DD.MyApp.Connector
The output is
AutoRest code generation utility [version: 2.0.4283; node: v10.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\kirst\.autorest\#microsoft.azure_autorest-core#2.0.4289\node_modules\#microsoft.azure\autorest-core\dist' (2.0.4289)
Loading AutoRest extension '#microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
Loading AutoRest extension '#microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: swagger-document-override/md-override-loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
FATAL: swagger-document/loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Process() cancelled due to exception : Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
After studying the issue on github I tried starting the api using dotnet run
but it did not help.
I tried running autorest in a dos command shell with admin priviledge
As per the github issue I can save the swagger.json to a file and generate the code by referencing the file.
That isn't a great solution.
Are you attempting to use https with localhost ? If you haven't put a certificate on there, you shouldn't be using https.
Try it with http://localhost...

Resources