【发布时间】:2020-01-31 14:05:17
【问题描述】:
我使用的是 Windows,安装了 Docker(使用 lunix 容器),安装了 VS Code 和 devcontainer 扩展。我从私有 NugetFeed 加载了一个使用 Nugets 的项目,当我尝试恢复(交互式)NugetPackages 时,我从 NugetFeed 收到 401 错误。
/usr/share/dotnet/sdk/2.2.207/NuGet.targets(119,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/[SomeFeedUrl]/nuget/v3/index.json. [/workspaces/[SomeSolution].sln]
/usr/share/dotnet/sdk/2.2.207/NuGet.targets(119,5): error : Response status code does not indicate success: 401 (Unauthorized). [/workspaces/[SomeSolution].sln]
我在本地尝试了同样的事情(安装了凭据提供程序),一切正常。我还尝试将 Nugetpackages 路径安装到 devcontainer,在本地恢复,然后启动项目(因为这是我的修复方法,可以让恢复在我的 linux 机器上正常工作)。
这是我的 devcontainer.json 的样子:
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/azure-functions-dotnetcore-2.2
{
"name": "Azure Functions & C# (.NET Core 2.2)",
"dockerFile": "Dockerfile",
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"mounts": [
"source=C:/Users/[user]/.nuget,target=/home/vscode/.nuget,type=bind"
// "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind"
],
"remoteEnv": {
// [Optional] Override the default HTTP endpoints - need to listen to '*' for appPort to work
"ASPNETCORE_Kestrel__Endpoints__Http__Url": "http://*:5000"
// "ASPNETCORE_Kestrel__Endpoints__Https__Url": "https://*:5001",
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
},
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "dotnet restore",
// Uncomment the next line to have VS Code connect as an existing non-root user in the container.
// On Linux, by default, the container user's UID/GID will be updated to match your local user. See
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
// "remoteUser": "vscode",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-vscode.csharp"
]
}
我没有接触 dockerfile,dockerfile 仍然是股票 dockerfile。
有没有人有同样的问题/知道如何让它正常工作?
【问题讨论】:
标签: .net visual-studio-code nuget nuget-package-restore private-nuget-feed