c# - .NET Core 项目引用问题 - "Cannot find project info for ' XXX.csproj'”

标签 c# reference asp.net-core .net-core

我有一个面向 .NET Framework 4.5.2ASP.NET Core Web 应用程序(.NET Framework)

添加对“类库 (.NET Framework)”类型的空类库的引用后,出现以下错误:

"Cannot find project info for 'XXX.csproj'. This can indicate a missing project reference." Below you can see a screenshot of the error.

这是我的项目文件:

<Target Name="GenerateBuildDependencyFile" 
    DependsOnTargets="_DefaultMicrosoftNETPlatformLibrary" 
    BeforeTargets="_CheckForCompileOutputs" 
    Condition=" '$(GenerateDependencyFile)' == 'true'" 
    Inputs="$(ProjectAssetsFile)" 
    Outputs="$(ProjectDepsFilePath)"> 

<GenerateDepsFile ProjectPath="$(MSBuildProjectFullPath " 
                    AssetsFilePath="$(ProjectAssetsFile)" 
                    DepsFilePath="$(ProjectDepsFilePath)" 
                    TargetFramework="$(TargetFrameworkMoniker)" 
                    AssemblyName="$(AssemblyName)" 
                    AssemblyExtension="$(TargetExt)" 
                    AssemblyVersion="$(Version)" 
                    AssemblySatelliteAssemblies="@(IntermediateSatelliteAssembliesWithTargetPath)" 
                    ReferencePaths="@(ReferencePath)" 
                    ReferenceSatellitePaths="@(ReferenceSatellitePaths)" 
                    RuntimeIdentifier="$(RuntimeIdentifier)" 
                    PlatformLibraryName="$(MicrosoftNETPlatformLibrary)" 
                    CompilerOptions="@(DependencyFileCompilerOptions)"> 
</GenerateDepsFile> 
<ItemGroup>     
    <FileWrites Include="$(ProjectDepsFilePath)" Condition="Exists('$(ProjectDepsFilePath)')"/> 
</ItemGroup> 
</Target> 

Source of the project file
我在互联网上搜索了一个解决方案,发现它可能与项目之间的传递依赖有关。如果 A -> B -> C 那么 A -> C。但是我只有一个 .NET Core 项目和一个空类库。

最佳答案

为我解决这个问题的方法是将目标框架从 4.5.2 更改为 4.6.1,如果有人遇到同样的情况的话:)

关于c# - .NET Core 项目引用问题 - "Cannot find project info for ' XXX.csproj'”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44390805/

相关文章:

c# - ASP.Net Core Serilog 如何在运行时读取日志文件

javascript - 在 ASP.NET Core 中使用 Javascript 文件

c# - 我应该使用一个 LINQ DataContext 还是多个?

c# - 在重写模板方法中访问中间类属性

rust - rust : insert uint in hashmap reference

java - 如何在 Java XML 中使用引用 URI 加载外部资源

asp.net-core - ActionResult<bool> 中的隐式转换运算符不起作用

SSIS 中的 C# 脚本任务

c# - 在 x :Bind to a textbox 上获取 Windows.UI.Xaml.UnhandledExceptionEventArgs

for-loop - 何时在 for 循环中使用引用?