我有一个面向 .NET Framework 4.5.2 的 ASP.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/