【问题标题】:VS Code / OmniSharp failing to load project; Can't find a package that is presentVS Code / OmniSharp 无法加载项目;找不到存在的包
【发布时间】:2020-10-28 01:30:40
【问题描述】:

当我启动 VS Code 或重新启动 OmniSharp 时,我收到以下错误消息:

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/user/Documents/repos/proj/proj-backend/Application/Application.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        Package Microsoft.EntityFrameworkCore.Analyzers, version 3.1.5 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/user/Documents/repos/proj/proj-backend/Application/Application.csproj'.
/Users/user/Documents/repos/proj/proj-backend/Application/Application.csproj
/usr/local/share/dotnet/sdk/3.1.301/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: Package Microsoft.EntityFrameworkCore.Analyzers, version 3.1.5 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

这是我的 csproj 文件:

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup>
    <ProjectReference Include="..\Persistence\Persistence.csproj"/>
    <ProjectReference Include="..\Domain\Domain.csproj"/>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="MediatR" Version="8.0.0"/>
    <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.0"/>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
    <PackageReference Include="RestSharp" Version="106.10.1"/>
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.6.0"/>
    <PackageReference Include="StandardModels" Version="0.1.3.15"/>
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0"/>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.5"/>
    <PackageReference Include="EPPlus" Version="5.1.1"/>
    <PackageReference Include="AutoMapper" Version="9.0.0"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="3.1.5"/>
  </ItemGroup>
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>

dotnet restore --no-cache 工作正常,构建/运行没有错误。我尝试删除 Microsoft.EntityFrameworkCore.Analyzers,但没有任何区别。

任何想法为什么我不能加载这个?

提前致谢!

【问题讨论】:

    标签: c# .net-core visual-studio-code nuget omnisharp


    【解决方案1】:

    我通过删除整个存储库、重新克隆并创建新的工作区文件解决了这个问题。这些动作的组合起到了作用。

    【讨论】:

      猜你喜欢
      • 2018-02-17
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-31
      • 2015-10-11
      • 2021-07-31
      相关资源
      最近更新 更多