c# – .NET核心项目参考问题 – “无法找到’XXX.csproj’的项目信息”

我有一个针对.NET Framework 4.5.2的ASP.NET核心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,如果有人应该遇到相同的:)

点赞