【问题标题】:.NET Core project reference issues - "Cannot find project info for 'XXX.csproj'".NET Core 项目参考问题 - “找不到‘XXX.csproj’的项目信息”
【发布时间】:2017-11-07 12:25:13
【问题描述】:

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

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

“找不到‘XXX.csproj’的项目信息。这可能表示 缺少项目参考。”下面你可以看到截图 错误。

这是我的项目文件:

<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 项目和一个空的类库。

【问题讨论】:

  • 前段时间也有这个问题,关闭VS并在项目上做dotnet restore为我解决了这个问题。
  • 感谢您的建议!我试过了,但遗憾的是我仍然有问题
  • 请将项目文件内容和错误消息发布为文本,而不是显示屏幕截图。这使得它更容易阅读,并且对搜索引擎更有帮助。
  • 我遇到了类似的问题(但使用 .Net Core 2.0 作为目标平台),添加新的空类库时出现上述错误。 jAC(dotnet restore)建议的解决方案,帮助了我,谢谢!

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-21
    相关资源
    最近更新 更多