简体   繁体   English

发布 WPF 应用程序因未授权而失败。NuGet 服务索引 (Azure DevOps)

[英]Publishing WPF application fails du to unauthorized .NuGet service index (Azure DevOps)

I want to publish one of my WPF applications (to a folder).我想发布我的 WPF 应用程序之一(到文件夹)。
The app needs some NuGet packages that I published via Azure Devops.该应用程序需要我通过 Azure Devops 发布的一些 NuGet 包。 I signed in with Visual Studio with exactly the same account I use also in DevOps and for this reason it is no problem to install/remove the packages via the "Manage Packages for Solution".我使用我在 DevOps 中使用的完全相同的帐户登录 Visual Studio,因此通过“管理解决方案的包”安装/删除包没有问题。
Building and running my solution is also no problem.构建和运行我的解决方案也没有问题。

But when I want to publish my solution I get an unauthorized message that I do not understand:但是当我想发布我的解决方案时,我收到了一条我不理解的未经授权的消息:

The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
4>Unable to load the service index for source https://pkgs.dev.azure.com/MyProjectName/_packaging/MyNuGetFeed/nuget/v3/index.json.

What could I try here?我可以在这里尝试什么? Why is VS having no issues to access the feed when I build and run the project locally but publishing is an issue?为什么当我在本地构建和运行项目时 VS 在访问提要时没有问题,但发布是一个问题?

Any proposals are welcome欢迎任何建议

Update:更新:

This happens only if I choose the "Self contained" option.仅当我选择“独立”选项时才会发生这种情况。 If I publish with "Framework independent" it works without problems.如果我使用“独立于框架”发布,它可以毫无问题地工作。

I got a similar error on Teamcity:我在 Teamcity 上遇到了类似的错误:

When I want to publish my wpf app, (on a website, with clickonce...)当我想发布我的 wpf 应用程序时,(在网站上,使用 clickonce ...)

The plugin credential provider could not acquire credentials.插件凭据提供程序无法获取凭据。 Authentication may require manual action.身份验证可能需要手动操作。 Consider re-running the command with --interactive for do.net , /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for NuGet考虑为 do.net 使用 --interactive 重新运行命令,为do.net使用 /p:NuGetInteractive="true" 或为NuGet删除 -NonInteractive 开关

Inspirred by灵感来自在此处输入图像描述 your comment, I tried to switch to self-Contained (after looking for the Framework-independent;-) option) and got this info:你的评论,我试图切换到独立的(在寻找独立于框架的;-)选项之后)并得到了这个信息:

Found conflicts between different versions of "System.Drawing.Common" that could not be resolved.
6>There was a conflict between 
  "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, and 
  "System.Drawing.Common, Version=5.0.0.0, Culture=neutral, 
6>"System.Drawing.Common, Version=4.0.0.0, Culture=neutral, was chosen because it was primary and 
  "System.Drawing.Common, Version=5.0.0.0, Culture=neutral, was not.

Ahh different versions of underlying .NET used.... !啊,使用了底层 .NET 的不同版本……!

6> References which depend on 
   "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, 
     [...nuget\packages\system.drawing.common\4.5.0\ref\netstandard2.0\System.Drawing.Common.dll].
6>    ...nuget\packages\system.drawing.common\4.5.0\ref\netstandard2.0\System.Drawing.Common.dll
6> Project file item includes which caused reference 
     "...nuget\packages\system.drawing.common\4.5.0\ref\netstandard2.0\System.Drawing.Common.dll".
6>    ...nuget\packages\system.drawing.common\4.5.0\ref\netstandard2.0\System.Drawing.Common.dll

6> References which depend on 
"System.Drawing.Common, Version=5.0.0.0, Culture=neutral, 
     [].
6>  ...Release\net5.0-windows\xyz.dll
6> Project file item includes which caused reference 
   "...Release\net5.0-windows\xyz.dll".
6>  ...Release\net5.0-windows\xyz.dll

The xyz project or one of the nugets it relies on causes the problem;-) (ie uses .net in a different version) xyz 项目或其依赖的 nugets 之一导致了问题;-)(即在不同版本中使用 .net)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM