VS Code / OmniSharp 无法加载项目;找不到存在的包
VS Code / OmniSharp failing to load project; Can't find a package that is present
当我启动 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
工作正常,building/running 没有错误。我尝试删除 Microsoft.EntityFrameworkCore.Analyzers,但没有任何区别。
为什么我无法加载这个有什么想法吗?
提前致谢!
我通过删除整个存储库、重新克隆并创建一个新的工作区文件解决了这个问题。这些操作的组合起到了作用。
当我启动 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
工作正常,building/running 没有错误。我尝试删除 Microsoft.EntityFrameworkCore.Analyzers,但没有任何区别。
为什么我无法加载这个有什么想法吗?
提前致谢!
我通过删除整个存储库、重新克隆并创建一个新的工作区文件解决了这个问题。这些操作的组合起到了作用。