You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS 2019 Community更新后项目UI重建失败,CLI正常如何解决?

问题:VS 2019 UI重建项目失败,CLI执行正常

问题场景

VS 2019 Community更新至最新版本16.11.17后,使用CLI(msbuild 16.11.2、nuget 5.11.2)执行以下命令可正常重建项目:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" "C:\MyProject" /t:restore;rebuild

但通过VS UI重建时失败,出现以下错误:

Error  NU1105  Unable to read project information for 'MyProject': Sequence contains more than one element
Error  NETSDK1005  Assets file 'C:\MyProject\obj\project.assets.json' doesn't have a target for 'net5.0-windows'. Ensure that restore has run and that you have included 'net5.0-windows' in the TargetFrameworks for your project.    MyProject   C:\Program Files\dotnet\sdk\5.0.410\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets

相关文件内容

project.assets.json

{
  "version": 3,
  "targets": {},
  "libraries": {},
  "projectFileDependencyGroups": {},
  "packageFolders": {
    "C:\\Users\\Admin\\.nuget\\packages\\": {},
    "C:\\Program Files (x86)\\DevExpress 20.2\\.NET Core Desktop Libraries\\Offline Packages": {},
    "C:\\Program Files (x86)\\DevExpress 20.2\\Components\\Offline Packages": {}
  },
  "project": {
    "restore": {
      "projectUniqueName": "C:\\MyProject\\MyProject.csproj",
      "projectPath": "C:\\MyProject\\MyProject.csproj",
      "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\",
      "outputPath": "C:\\MyProject\\obj\\",
      "projectStyle": "PackageReference",
      "fallbackFolders": [
        "C:\\Program Files (x86)\\DevExpress 20.2\\.NET Core Desktop Libraries\\Offline Packages",
        "C:\\Program Files (x86)\\DevExpress 20.2\\Components\\Offline Packages"
      ],
      "configFilePaths": [
        "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress .NET Core Desktop 20.2.config",
        "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 20.2.config",
        "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress Cloud.config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "sources": {
        "C:\\Program Files (x86)\\DevExpress 20.2\\.NET Core Desktop Libraries\\System\\Components\\Packages": {},
        "C:\\Program Files (x86)\\DevExpress 20.2\\Components\\System\\Components\\Packages": {},
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "https://api.nuget.org/v3/index.json": {},
        "https://nuget.devexpress.com/MyKey/api": {}
      }
    }
  },
  "logs": [
    {
      "code": "NU1105",
      "level": "Error",
      "message": "Unable to read project information for 'MyProject': Sequence contains more than one element"
    }
  ]
}

MyProject.csproj

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFrameworks>net48;net5.0-windows</TargetFrameworks>
        <Platforms>x86</Platforms>
        <UseWindowsForms>true</UseWindowsForms>
        <LangVersion>9.0</LangVersion>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="DevExpress.Win" Version="20.2.5" />
        <PackageReference Include="DevExpress.WindowsDesktop.Win" Version="20.2.5-ctp" />
        <PackageReference Include="DevExpress.Win.Reporting" Version="20.2.5" />
        <PackageReference Include="DevExpress.Reporting.Core" Version="20.2.5" />
    </ItemGroup>
</Project>

已安装组件

  • DevExpressComponentsBundleSetup-20.2.5.exe
  • DevExpressNetCoreDesktopSetup-20.2.5.exe

已安装.NET SDK列表

执行dotnet --list-sdks输出:

  • 2.1.602 [C:\Program Files\dotnet\sdk]
  • 2.2.202 [C:\Program Files\dotnet\sdk]
  • 5.0.300 [C:\Program Files\dotnet\sdk]
  • 5.0.410 [C:\Program Files\dotnet\sdk]

已尝试操作

  • 删除obj文件夹并执行dotnet restore,问题仍存在

请问该如何解决此问题?


内容的提问来源于stack exchange,提问作者geek175

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 11:24:23