重复' packageReference'找到的项目。删除重复项或使用更新功能来确保稳定的还原行为

发布于 2025-02-01 15:39:48 字数 1082 浏览 5 评论 0 原文

我正在使用Microsoft Visual Studio社区2022(64位) - 预览版17.3.0 Preview 1.1。

错误

Severity    Code    Description Project File    Line    Suppression State
Error   NU1504  Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: StyleCop.Analyzers 1.1.118, StyleCop.Analyzers 1.1.118; Roslynator.Analyzers 3.2.2, Roslynator.Analyzers 3.2.2.   Shared.DTOs C:\Users\donhu\source\repos\FSH\src\Shared\Shared.DTOs\Shared.DTOs.csproj   1   

”输入映像在此处”

错误还原软件包

“在此处输入图像说明”

如何修复它?

I am using Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.3.0 Preview 1.1.

enter image description here

Error

Severity    Code    Description Project File    Line    Suppression State
Error   NU1504  Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: StyleCop.Analyzers 1.1.118, StyleCop.Analyzers 1.1.118; Roslynator.Analyzers 3.2.2, Roslynator.Analyzers 3.2.2.   Shared.DTOs C:\Users\donhu\source\repos\FSH\src\Shared\Shared.DTOs\Shared.DTOs.csproj   1   

enter image description here

Error restoring packages

enter image description here

How to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哆啦不做梦 2025-02-08 15:39:48

临时解决方案:添加< nowarn> $(nowarn); nu1504; nu1505; nu1701</nowarn> ,例如

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>FSHTemp.Application</RootNamespace>
    <AssemblyName>FSHTemp.Application</AssemblyName>
  </PropertyGroup>
...

结果

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>FSHTemp.Application</RootNamespace>
    <AssemblyName>FSHTemp.Application</AssemblyName>
      <NoWarn>$(NoWarn);NU1504;NU1505;NU1701</NoWarn>
  </PropertyGroup>

:Restore Nuget package现在,

现在 ”>

i.sstatic.net/n2yk5.png“ rel =“ noreferrer 术语解决方案:更新到新版本的Visual Studio 2022(稳定和。或预览更新频道)

相关:

请参见更多

Temporary solution: add <NoWarn>$(NoWarn);NU1504;NU1505;NU1701</NoWarn> , for example

Old

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>FSHTemp.Application</RootNamespace>
    <AssemblyName>FSHTemp.Application</AssemblyName>
  </PropertyGroup>
...

new

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>FSHTemp.Application</RootNamespace>
    <AssemblyName>FSHTemp.Application</AssemblyName>
      <NoWarn>$(NoWarn);NU1504;NU1505;NU1701</NoWarn>
  </PropertyGroup>

result: restore Nuget package success now

enter image description here

Long-term solution: Update to new version of Visual Studio 2022 (Stability and.or Preview update channels)

Related: https://github.com/dotnet/sdk/issues/24747

See more https://github.com/unoplatform/uno.todo/commit/6e442d9b1adb8f990139969413344b135714ed93

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文