c# - VS Code / OmniSharp failing to load project; Can't find a package that is present
问题描述
When I start up VS Code or restart OmniSharp, I get the following error message:
[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.
Here is my csproj file:
<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
works fine and building/running has no errors. I tried removing Microsoft.EntityFrameworkCore.Analyzers but it doesn't make a difference.
Any ideas why I can't get this to load?
Thanks in advance!
解决方案
I resolved this issue by deleting the entire repository, recloning, and creating a new workspace file. The combination of those actions did the trick.
推荐阅读
- date - 将字符串类型转换为 Unix 日期 Amazon Athena
- protractor - ConnectionError:连接丢失 - 在量角器中读取 ECONNRESET
- javascript - 从计算函数的 getter 中引用 v-for 元素
- sql - 在 case 内使用合并,然后使用子查询来获取逗号分隔值
- ios - 苹果音乐无法在 ios 中播放某些歌曲
- python-3.x - 在 python 中编写异步请求
- python - 通过经纬度查找最近的位置并在 Python 中填写 District 和 BusinessArea
- c++ - How to call a C++ dynamic library from Rust?
- c# - 如何更改本地 SQL Server 的登录方式?
- node.js - How we can replace an array with new value, and sort them based on specific field