Lite版无法构建:MSB4025 找不到文件TrafficMonitor.vcxproj.metaproj

ckx4rj1h  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(72)

我尝试在GitHub Actions上编译Lite版本,使用本项目的workflow文件,但只包含x64_build的job。

Run msbuild步骤的命令参数:

- name: Run msbuild
      run: MSBuild -p:Configuration="Release (lite)" -p:Platform=x64 -p:PlatformToolset=v142

部分报错信息:
开头部分

MSBuild version 17.5.0+6f08c67f3 for .NET Framework
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 3/30/2023 9:22:03 AM.
Included response file: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.rsp

Project "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release (lite)|x64".
ValidateProjects:
  The project "OpenHardwareMonitorApi" is not selected for building in solution configuration "Release (lite)|x64".
Project "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor.sln" (1) is building "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj" (2) on node 1 (default targets).
D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj : error MSB4025: The project file could not be loaded. Could not find file 'D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj'.
Done Building Project "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj" (default targets) -- FAILED.
Project "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor.sln" (1) is building "D:\a\TrafficMonitor\TrafficMonitor\PluginDemo\PluginDemo.vcxproj" (3) on node 1 (default targets).
PrepareForBuild:

结尾部分:

Done Building Project "D:\a\TrafficMonitor\TrafficMonitor\PluginDemo\PluginDemo.vcxproj" (default targets).
Done Building Project "D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor.sln" (default targets) -- FAILED.

Build FAILED.

"D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor.sln" (default target) (1) ->
"D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj" (default target) (2) ->
  D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj : error MSB4025: The project file could not be loaded. Could not find file 'D:\a\TrafficMonitor\TrafficMonitor\TrafficMonitor\TrafficMonitor.vcxproj.metaproj'.

    0 Warning(s)
    1 Error(s)

其他尝试:

  1. 构建普通版本正常!
- name: Run msbuild
  run: MSBuild -p:Configuration="Release" -p:Platform=x64 -p:PlatformToolset=v142
  1. 先构建普通版本,再构建Lite版本:普通版本正常,Lite版本失败,报错同上
- name: Run msbuild
  run: |
MSBuild -p:Configuration="Release" -p:Platform=x64 -p:PlatformToolset=v142
MSBuild -p:Configuration="Release (lite)" -p:Platform=x64 -p:PlatformToolset=v142

因此想请教一下如何正确构建Lite版本?谢谢

56lgkhnf

56lgkhnf1#

报错的原因是 lite 版并不需要 OpenHardwareMonitor 这个库,但是在构建时却不知道为什么混进去了,编译器找不到该项目,最终就没有生成 TrafficMonitor.vcxproj.metaproj 这个文件,导致构建失败

由于我不怎么熟悉 C/C++ 项目的编译,因此选择在编译直接粗暴的把 TrafficMonitor.sln 这个文件中所有与 OpenHardwareMonitor 相关的内容直接删除了

具体而言,是直接删除文件内所有包含 {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26} 的行,但是这样就破坏了普通版本的构建,只能将其分开编译

我在自己的仓库内留了一个删除完了的 TrafficMonitor.sln 文件,同时该仓库内也有补齐了 lite 版构建的Action文件,希望能够帮助到你

lstz6jyr

lstz6jyr2#

@yhdsl 我的做法也差不多,普通版本也是需要用原始的sln分开编译

相关问题